1
|
|
|
<?php |
2
|
|
|
|
|
|
|
|
3
|
|
|
namespace BristolSU\Module\UploadFile\Events; |
4
|
|
|
|
5
|
|
|
use BristolSU\Module\UploadFile\Models\Comment; |
6
|
|
|
use BristolSU\Support\Action\Contracts\TriggerableEvent; |
7
|
|
|
|
8
|
|
|
class CommentUpdated implements TriggerableEvent |
|
|
|
|
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
/** |
|
|
|
|
12
|
|
|
* @var Comment |
13
|
|
|
*/ |
14
|
|
|
public $comment; |
15
|
|
|
|
16
|
10 |
|
public function __construct(Comment $comment) |
|
|
|
|
17
|
|
|
{ |
18
|
10 |
|
$this->comment = $comment; |
19
|
10 |
|
} |
20
|
|
|
|
21
|
|
|
/** |
|
|
|
|
22
|
|
|
* @inheritDoc |
23
|
|
|
*/ |
|
|
|
|
24
|
2 |
|
public function getFields(): array |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
2 |
|
'file_id' => $this->comment->file->id, |
28
|
2 |
|
'file_title' => $this->comment->file->title, |
29
|
2 |
|
'file_description' => $this->comment->file->description, |
30
|
2 |
|
'file_filename' => $this->comment->file->filename, |
31
|
2 |
|
'file_mime' => $this->comment->file->mime, |
32
|
2 |
|
'file_size' => $this->comment->file->size, |
33
|
2 |
|
'file_uploaded_by_id' => $this->comment->file->uploaded_by->id(), |
|
|
|
|
34
|
2 |
|
'file_uploaded_by_email' => $this->comment->file->uploaded_by->data()->email(), |
35
|
2 |
|
'file_uploaded_by_first_name' => $this->comment->file->uploaded_by->data()->firstName(), |
36
|
2 |
|
'file_uploaded_by_last_name' => $this->comment->file->uploaded_by->data()->lastName(), |
37
|
2 |
|
'file_uploaded_by_preferred_name' => $this->comment->file->uploaded_by->data()->preferredName(), |
38
|
2 |
|
'file_module_instance_id' => $this->comment->file->module_instance_id, |
39
|
2 |
|
'file_activity_instance_id' => $this->comment->file->activity_instance_id, |
40
|
2 |
|
'file_uploaded_at' => $this->comment->file->created_at->format('Y-m-d H:i:s'), |
41
|
2 |
|
'file_updated_at' => $this->comment->file->updated_at->format('Y-m-d H:i:s'), |
42
|
2 |
|
'comment' => $this->comment->comment, |
43
|
2 |
|
'comment_id' => $this->comment->id, |
44
|
2 |
|
'comment_posted_at' => $this->comment->created_at->format('Y-m-d H:i:s'), |
45
|
2 |
|
'comment_edited_at' => $this->comment->updated_at->format('Y-m-d H:i:s'), |
46
|
2 |
|
'comment_posted_by_id' => $this->comment->posted_by->id(), |
|
|
|
|
47
|
2 |
|
'comment_posted_by_email' => $this->comment->posted_by->data()->email(), |
48
|
2 |
|
'comment_posted_by_first_name' => $this->comment->posted_by->data()->firstName(), |
49
|
2 |
|
'comment_posted_by_last_name' => $this->comment->posted_by->data()->lastName(), |
50
|
2 |
|
'comment_posted_by_preferred_name' => $this->comment->posted_by->data()->preferredName(), |
51
|
|
|
]; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
|
|
|
|
55
|
|
|
* @inheritDoc |
56
|
|
|
*/ |
|
|
|
|
57
|
1 |
|
public static function getFieldMetaData(): array |
58
|
|
|
{ |
59
|
|
|
return [ |
60
|
|
|
'file_id' => [ |
61
|
1 |
|
'label' => 'File ID', |
62
|
|
|
'helptext' => 'The ID of the file' |
63
|
|
|
], |
64
|
|
|
'file_title' => [ |
65
|
|
|
'label' => 'File Title', |
66
|
|
|
'helptext' => 'The title given to the document when uploaded', |
67
|
|
|
], |
68
|
|
|
'file_description' => [ |
69
|
|
|
'label' => 'File Description', |
70
|
|
|
'helptext' => 'A description of the file' |
71
|
|
|
], |
72
|
|
|
'file_filename' => [ |
73
|
|
|
'label' => 'Filename', |
74
|
|
|
'helptext' => 'The original filename of the document' |
75
|
|
|
], |
76
|
|
|
'file_mime' => [ |
77
|
|
|
'label' => 'File Mimetype', |
78
|
|
|
'helptext' => 'The mime type of the file' |
79
|
|
|
], |
80
|
|
|
'file_size' => [ |
81
|
|
|
'label' => 'File Size', |
82
|
|
|
'helptext' => 'The size of the file in bytes' |
83
|
|
|
], |
84
|
|
|
'file_uploaded_by_id' => [ |
85
|
|
|
'label' => 'File Uploader User ID', |
86
|
|
|
'helptext' => 'ID of the user who uploaded the file' |
87
|
|
|
], |
88
|
|
|
'file_uploaded_by_email' => [ |
89
|
|
|
'label' => 'File Uploader User Email', |
90
|
|
|
'helptext' => 'Email of the user who uploaded the file' |
91
|
|
|
], |
92
|
|
|
'file_uploaded_by_first_name' => [ |
93
|
|
|
'label' => 'File Uploader User First Name', |
94
|
|
|
'helptext' => 'First Name of the user who uploaded the file' |
95
|
|
|
], |
96
|
|
|
'file_uploaded_by_last_name' => [ |
97
|
|
|
'label' => 'File Uploader User Last Name', |
98
|
|
|
'helptext' => 'Last Name of the user who uploaded the file' |
99
|
|
|
], |
100
|
|
|
'file_uploaded_by_preferred_name' => [ |
101
|
|
|
'label' => 'File Uploader User Preferred Name', |
102
|
|
|
'helptext' => 'Preferred Name of the user who uploaded the file' |
103
|
|
|
], |
104
|
|
|
'file_module_instance_id' => [ |
105
|
|
|
'label' => 'Module Instance ID', |
106
|
|
|
'helptext' => 'ID of the module instance the file was uploaded to' |
107
|
|
|
], |
108
|
|
|
'file_activity_instance_id' => [ |
109
|
|
|
'label' => 'Activity Instance ID', |
110
|
|
|
'helptext' => 'ID of the activity instance that uploaded the file' |
111
|
|
|
], |
112
|
|
|
'file_uploaded_at' => [ |
113
|
|
|
'label' => 'File Uploaded At', |
114
|
|
|
'helptext' => 'Time and date the file was uploaded at' |
115
|
|
|
], |
116
|
|
|
'file_updated_at' => [ |
117
|
|
|
'label' => 'File Updated At', |
118
|
|
|
'helptext' => 'Time and date the file was last updated' |
119
|
|
|
], |
120
|
|
|
'comment' => [ |
121
|
|
|
'label' => 'Comment Text', |
122
|
|
|
'helptext' => 'The text that makes up the comment' |
123
|
|
|
], |
124
|
|
|
'comment_id' => [ |
125
|
|
|
'label' => 'Comment ID', |
126
|
|
|
'helptext' => 'The ID of the comment' |
127
|
|
|
], |
128
|
|
|
'comment_posted_at' => [ |
129
|
|
|
'label' => 'Comment Posted At', |
130
|
|
|
'helptext' => 'The date and time at which the comment was posted' |
131
|
|
|
], |
132
|
|
|
'comment_edited_at' => [ |
133
|
|
|
'label' => 'Comment Edited At', |
134
|
|
|
'helptext' => 'The date and time at which the comment was last edited' |
135
|
|
|
], |
136
|
|
|
'comment_posted_by_id' => [ |
137
|
|
|
'label' => 'Comment Posted By', |
138
|
|
|
'helptext' => 'ID of the user who posted the comment' |
139
|
|
|
], |
140
|
|
|
'comment_posted_by_email' => [ |
141
|
|
|
'label' => 'Comment Posted By Email', |
142
|
|
|
'helptext' => 'Email of the user who posted the comment' |
143
|
|
|
], |
144
|
|
|
'comment_posted_by_first_name' => [ |
145
|
|
|
'label' => 'Comment Posted By First Name', |
146
|
|
|
'helptext' => 'First Name of the user who posted the comment' |
147
|
|
|
], |
148
|
|
|
'comment_posted_by_last_name' => [ |
149
|
|
|
'label' => 'Comment Posted By Last Name', |
150
|
|
|
'helptext' => 'Last Name of the user who posted the comment' |
151
|
|
|
], |
152
|
|
|
'comment_posted_by_preferred_name' => [ |
153
|
|
|
'label' => 'Comment Posted By Preferred Name', |
154
|
|
|
'helptext' => 'Preferred Name of the user who posted the comment' |
155
|
|
|
], |
156
|
|
|
]; |
157
|
|
|
} |
158
|
|
|
} |