1 | <?php |
||
15 | class Activity implements IExtension { |
||
16 | |||
17 | const APP_NAME = 'files_antivirus'; |
||
18 | |||
19 | /** |
||
20 | * Filter with all app related activities |
||
21 | */ |
||
22 | const FILTER_AVIR = 'files_antivirus'; |
||
23 | |||
24 | /** |
||
25 | * Activity types known to this extension |
||
26 | */ |
||
27 | const TYPE_VIRUS_DETECTED = 'virus_detected'; |
||
28 | |||
29 | /** |
||
30 | * Subject keys for translation of the subjections |
||
31 | */ |
||
32 | const SUBJECT_VIRUS_DETECTED = 'virus_detected'; |
||
33 | |||
34 | /** |
||
35 | * Infected file deletion notice |
||
36 | */ |
||
37 | const MESSAGE_FILE_DELETED = 'file_deleted'; |
||
38 | |||
39 | |||
40 | /** |
||
41 | * @var Factory |
||
42 | */ |
||
43 | protected $languageFactory; |
||
44 | |||
45 | /** |
||
46 | * @var IURLGenerator |
||
47 | */ |
||
48 | protected $URLGenerator; |
||
49 | |||
50 | /** |
||
51 | * @param Factory $languageFactory |
||
52 | * @param IURLGenerator $URLGenerator |
||
53 | */ |
||
54 | 3 | public function __construct(Factory $languageFactory, IURLGenerator $URLGenerator) { |
|
58 | |||
59 | protected function getL10N($languageCode = null) { |
||
62 | |||
63 | /** |
||
64 | * The extension can return an array of additional notification types. |
||
65 | * If no additional types are to be added false is to be returned |
||
66 | * |
||
67 | * @param string $languageCode |
||
68 | * |
||
69 | * @return array|false |
||
70 | */ |
||
71 | public function getNotificationTypes($languageCode) { |
||
80 | |||
81 | /** |
||
82 | * For a given method additional types to be displayed in the settings can be returned. |
||
83 | * In case no additional types are to be added false is to be returned. |
||
84 | * |
||
85 | * @param string $method |
||
86 | * @return array|false |
||
87 | */ |
||
88 | public function getDefaultTypes($method) { |
||
95 | |||
96 | /** |
||
97 | * A string naming the css class for the icon to be used can be returned. |
||
98 | * If no icon is known for the given type false is to be returned. |
||
99 | * |
||
100 | * @param string $type |
||
101 | * @return string|false |
||
102 | */ |
||
103 | 1 | public function getTypeIcon($type) { |
|
110 | |||
111 | /** |
||
112 | * The extension can translate a given message to the requested languages. |
||
113 | * If no translation is available false is to be returned. |
||
114 | * |
||
115 | * @param string $app |
||
116 | * @param string $text |
||
117 | * @param array $params |
||
118 | * @param boolean $stripPath |
||
119 | * @param boolean $highlightParams |
||
120 | * @param string $languageCode |
||
121 | * |
||
122 | * @return string|false |
||
123 | */ |
||
124 | public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode) { |
||
138 | |||
139 | /** |
||
140 | * The extension can define the type of parameters for translation |
||
141 | * |
||
142 | * Currently known types are: |
||
143 | * * file => will strip away the path of the file and add a tooltip with it |
||
144 | * * username => will add the avatar of the user |
||
145 | * |
||
146 | * @param string $app |
||
147 | * @param string $text |
||
148 | * |
||
149 | * @return array|false |
||
150 | */ |
||
151 | 1 | public function getSpecialParameterList($app, $text) { |
|
154 | |||
155 | /** |
||
156 | * The extension can define the parameter grouping by returning the index as integer. |
||
157 | * In case no grouping is required false is to be returned. |
||
158 | * |
||
159 | * @param array $activity |
||
160 | * |
||
161 | * @return integer|false |
||
162 | */ |
||
163 | 1 | public function getGroupParameter($activity) { |
|
166 | |||
167 | /** |
||
168 | * The extension can define additional navigation entries. The array returned has to contain two keys 'top' |
||
169 | * and 'apps' which hold arrays with the relevant entries. |
||
170 | * If no further entries are to be added false is no be returned. |
||
171 | * |
||
172 | * @return array|false |
||
173 | */ |
||
174 | public function getNavigation() { |
||
190 | |||
191 | /** |
||
192 | * The extension can check if a customer filter (given by |
||
193 | * a query string like filter=abc) is valid or not. |
||
194 | * |
||
195 | * @param string $filterValue |
||
196 | * |
||
197 | * @return boolean |
||
198 | */ |
||
199 | public function isFilterValid($filterValue) { |
||
202 | |||
203 | /** |
||
204 | * The extension can filter the types based on the filter if required. |
||
205 | * In case no filter is to be applied false is to be returned unchanged. |
||
206 | * |
||
207 | * @param array $types |
||
208 | * @param string $filter |
||
209 | * |
||
210 | * @return array|false |
||
211 | */ |
||
212 | public function filterNotificationTypes($types, $filter) { |
||
215 | |||
216 | /** |
||
217 | * For a given filter the extension can specify the sql query conditions |
||
218 | * including parameters for that query. |
||
219 | * In case the extension does not know the filter false is to be returned. |
||
220 | * The query condition and the parameters are to be returned as array with two elements. |
||
221 | * E.g. return ['`app` = ? and `message` like ?', array('mail', 'ownCloud%')]; |
||
222 | * |
||
223 | * @param string $filter |
||
224 | * |
||
225 | * @return array|false |
||
226 | */ |
||
227 | public function getQueryForFilter($filter) { |
||
236 | } |
||
237 |