Commit 5eb19a4653a3c4c2367138661bed3f72e2e53601

Authored by Kevin Fourie
1 parent 8ac13258

KTS-2273

"Typo in subscriptions.inc.php"
Fixed. Corrected var name.

Committed By: Kevin Fourie
Reviewed By: Jalaloedien Abrahams



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7082 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/subscriptions/subscriptions.inc.php
... ... @@ -6,7 +6,7 @@
6 6 * License Version 1.1.2 ("License"); You may not use this file except in
7 7 * compliance with the License. You may obtain a copy of the License at
8 8 * http://www.knowledgetree.com/KPL
9   - *
  9 + *
10 10 * Software distributed under the License is distributed on an "AS IS"
11 11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
12 12 * See the License for the specific language governing rights and
... ... @@ -17,9 +17,9 @@
17 17 * (ii) the KnowledgeTree copyright notice
18 18 * in the same form as they appear in the distribution. See the License for
19 19 * requirements.
20   - *
  20 + *
21 21 * The Original Code is: KnowledgeTree Open Source
22   - *
  22 + *
23 23 * The Initial Developer of the Original Code is The Jam Warehouse Software
24 24 * (Pty) Ltd, trading as KnowledgeTree.
25 25 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
... ... @@ -30,7 +30,7 @@
30 30 *
31 31 * -------------------------------------------------------------------------
32 32 *
33   - * Subscription notification type.
  33 + * Subscription notification type.
34 34 *
35 35 * To use this, instantiate a SubscriptionEvent, and call the
36 36 * appropriate "event" method.
... ... @@ -60,52 +60,52 @@ class SubscriptionEvent {
60 60 "ArchivedDocument",
61 61 "RestoredArchivedDocument",
62 62 );
63   -
  63 +
64 64 var $subscriptionTypes = array(
65 65 "Document" => 1,
66 66 "Folder" => 2,
67 67 );
68   -
  68 +
69 69 function &subTypes($sType) {
70 70 $subscriptionTypes = array(
71 71 "Document" => 1,
72 72 "Folder" => 2,
73 73 );
74   -
  74 +
75 75 return KTUtil::arrayGet($subscriptionTypes, $sType, null);
76 76 }
77   -
  77 +
78 78 var $alertedUsers = array(); // per-instance (e.g. per-event) list of users who were contacted.
79   - var $_parameters = array(); // internal storage for
  79 + var $_parameters = array(); // internal storage for
80 80 var $child = -1; // the child object-id (e.g. which initiated the event: document OR folder)
81 81 var $parent = -1; // the folder-id of the parent
82 82  
83 83 // FIXME stubs.
84   - /* Each of these functions handles appropriate propogation (e.g. both
  84 + /* Each of these functions handles appropriate propogation (e.g. both
85 85 * folder and document subscription) without calling secondary functions.
86 86 * Every attempt is made to be as explicit as possible.
87 87 */
88   -
  88 +
89 89 // alerts users who are subscribed to $iParentFolderId.
90   - function AddFolder($oAddedFolder, $oParentFolder) {
  90 + function AddFolder($oAddedFolder, $oParentFolder) {
91 91 $content = new SubscriptionContent(); // needed for i18n
92   -
  92 +
93 93 // only useful for folder subscriptions.
94 94 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
95 95 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
96 96 foreach ($aUsers as $oSubscriber) {
97   -
98   - // notification object first.
  97 +
  98 + // notification object first.
99 99 $aNotificationOptions = array();
100 100 $aNotificationOptions['target_user'] = $oSubscriber->getID();
101 101 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
102 102 $aNotificationOptions['target_name'] = $oAddedFolder->getName();
103 103 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
104 104 $aNotificationOptions['object_id'] = $oAddedFolder->getId(); // parent folder_id, in this case.
105   - $aNotificationOptions['event_type'] = "AddFolder";
  105 + $aNotificationOptions['event_type'] = "AddFolder";
106 106 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
107   -
108   - // now the email content.
  107 +
  108 + // now the email content.
109 109 // FIXME this needs to be handled entirely within notifications from now on.
110 110 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
111 111 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -115,25 +115,25 @@ class SubscriptionEvent {
115 115 }
116 116 }
117 117 }
118   - function AddDocument ($oAddedDocument, $oParentFolder) {
119   - $content = new SubscriptionContent(); // needed for i18n
120   - // two parts to this:
  118 + function AddDocument ($oAddedDocument, $oParentFolder) {
  119 + $content = new SubscriptionContent(); // needed for i18n
  120 + // two parts to this:
121 121 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
122 122 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
123 123 foreach ($aUsers as $oSubscriber) {
124   -
125   - // notification object first.
  124 +
  125 + // notification object first.
126 126 $aNotificationOptions = array();
127 127 $aNotificationOptions['target_user'] = $oSubscriber->getID();
128 128 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null - is this valid?
129 129 $aNotificationOptions['target_name'] = $oAddedDocument->getName();
130 130 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
131 131 $aNotificationOptions['object_id'] = $oAddedDocument->getId(); // parent folder_id, in this case.
132   - $aNotificationOptions['event_type'] = "AddDocument";
133   -
  132 + $aNotificationOptions['event_type'] = "AddDocument";
  133 +
134 134 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
135   -
136   - // now the email content.
  135 +
  136 + // now the email content.
137 137 // FIXME this needs to be handled entirely within notifications from now on.
138 138 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
139 139 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -144,27 +144,27 @@ class SubscriptionEvent {
144 144 }
145 145 }
146 146 function RemoveFolder($oRemovedFolder, $oParentFolder) {
147   - $content = new SubscriptionContent(); // needed for i18n
  147 + $content = new SubscriptionContent(); // needed for i18n
148 148 // two cases to consider here:
149 149 // - notify people who are subscribed to the parent folder.
150 150 // - notify and unsubscribe people who are subscribed to the actual folder.
151   -
  151 +
152 152 // we need to start with the latter, so we don't "lose" any.
153 153 $aUsers = $this->_getSubscribers($oRemovedFolder->getId(), $this->subscriptionTypes["Folder"]);
154 154 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
155 155 foreach ($aUsers as $oSubscriber) {
156   -
157   - // notification object first.
  156 +
  157 + // notification object first.
158 158 $aNotificationOptions = array();
159 159 $aNotificationOptions['target_user'] = $oSubscriber->getID();
160 160 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
161 161 $aNotificationOptions['target_name'] = $oRemovedFolder->getName();
162 162 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
163 163 $aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
164   - $aNotificationOptions['event_type'] = "RemoveSubscribedFolder";
  164 + $aNotificationOptions['event_type'] = "RemoveSubscribedFolder";
165 165 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
166   -
167   - // now the email content.
  166 +
  167 + // now the email content.
168 168 // FIXME this needs to be handled entirely within notifications from now on.
169 169 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
170 170 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -172,30 +172,30 @@ class SubscriptionEvent {
172 172 $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
173 173 $oEmail->send();
174 174 }
175   -
  175 +
176 176 // now grab each oSubscribers oSubscription, and delete.
177 177 $oSubscription = Subscription::getByIds($oSubscriber->getId(), $oRemovedFolder->getId(), $this->subscriptionTypes["Folder"]);
178 178 if (!(PEAR::isError($oSubscription) || ($oSubscription == false))) {
179 179 $oSubscription->delete();
180 180 }
181 181 }
182   -
  182 +
183 183 // now handle (for those who haven't been alerted) users watching the folder.
184 184 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
185 185 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
186 186 foreach ($aUsers as $oSubscriber) {
187   -
188   - // notification object first.
  187 +
  188 + // notification object first.
189 189 $aNotificationOptions = array();
190 190 $aNotificationOptions['target_user'] = $oSubscriber->getID();
191 191 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
192 192 $aNotificationOptions['target_name'] = $oRemovedFolder->getName();
193 193 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
194 194 $aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
195   - $aNotificationOptions['event_type'] = "RemoveChildFolder";
  195 + $aNotificationOptions['event_type'] = "RemoveChildFolder";
196 196 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
197   -
198   - // now the email content.
  197 +
  198 + // now the email content.
199 199 // FIXME this needs to be handled entirely within notifications from now on.
200 200 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
201 201 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -204,30 +204,30 @@ class SubscriptionEvent {
204 204 $oEmail->send();
205 205 }
206 206 }
207   -
  207 +
208 208 }
209 209 function RemoveDocument($oRemovedDocument, $oParentFolder) {
210   - $content = new SubscriptionContent(); // needed for i18n
  210 + $content = new SubscriptionContent(); // needed for i18n
211 211 // two cases to consider here:
212 212 // - notify people who are subscribed to the parent folder.
213 213 // - notify and unsubscribe people who are subscribed to the actual folder.
214   -
  214 +
215 215 // we need to start with the latter, so we don't "lose" any.
216 216 $aUsers = $this->_getSubscribers($oRemovedDocument->getId(), $this->subscriptionTypes["Document"]);
217 217 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
218 218 foreach ($aUsers as $oSubscriber) {
219   -
220   - // notification object first.
  219 +
  220 + // notification object first.
221 221 $aNotificationOptions = array();
222 222 $aNotificationOptions['target_user'] = $oSubscriber->getID();
223 223 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
224 224 $aNotificationOptions['target_name'] = $oRemovedDocument->getName();
225 225 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
226 226 $aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
227   - $aNotificationOptions['event_type'] = "RemoveSubscribedDocument";
  227 + $aNotificationOptions['event_type'] = "RemoveSubscribedDocument";
228 228 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
229   -
230   - // now the email content.
  229 +
  230 + // now the email content.
231 231 // FIXME this needs to be handled entirely within notifications from now on.
232 232 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
233 233 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -235,30 +235,30 @@ class SubscriptionEvent {
235 235 $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
236 236 $oEmail->send();
237 237 }
238   -
  238 +
239 239 // now grab each oSubscribers oSubscription, and delete.
240 240 $oSubscription = Subscription::getByIds($oSubscriber->getId(), $oRemovedDocument->getId(), $this->subscriptionTypes["Document"]);
241 241 if (!(PEAR::isError($oSubscription) || ($oSubscription == false))) {
242 242 $oSubscription->delete();
243 243 }
244 244 }
245   -
  245 +
246 246 // now handle (for those who haven't been alerted) users watching the folder.
247 247 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
248 248 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
249 249 foreach ($aUsers as $oSubscriber) {
250   -
251   - // notification object first.
  250 +
  251 + // notification object first.
252 252 $aNotificationOptions = array();
253 253 $aNotificationOptions['target_user'] = $oSubscriber->getID();
254 254 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
255 255 $aNotificationOptions['target_name'] = $oRemovedDocument->getName();
256 256 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
257 257 $aNotificationOptions['object_id'] = $oParentFolder->getId(); // parent folder_id, since the removed one is removed.
258   - $aNotificationOptions['event_type'] = "RemoveChildDocument";
  258 + $aNotificationOptions['event_type'] = "RemoveChildDocument";
259 259 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
260   -
261   - // now the email content.
  260 +
  261 + // now the email content.
262 262 // FIXME this needs to be handled entirely within notifications from now on.
263 263 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
264 264 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -267,26 +267,26 @@ class SubscriptionEvent {
267 267 $oEmail->send();
268 268 }
269 269 }
270   -
  270 +
271 271 }
272   - function ModifyDocument($oModifiedDocument, $oParentFolder) {
273   - $content = new SubscriptionContent(); // needed for i18n
  272 + function ModifyDocument($oModifiedDocument, $oParentFolder) {
  273 + $content = new SubscriptionContent(); // needed for i18n
274 274 // OK: two actions: document registrants, folder registrants.
275 275 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
276 276 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
277 277 foreach ($aUsers as $oSubscriber) {
278   -
279   - // notification object first.
  278 +
  279 + // notification object first.
280 280 $aNotificationOptions = array();
281 281 $aNotificationOptions['target_user'] = $oSubscriber->getID();
282 282 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
283 283 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
284 284 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
285 285 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
286   - $aNotificationOptions['event_type'] = "ModifyDocument";
  286 + $aNotificationOptions['event_type'] = "ModifyDocument";
287 287 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
288   -
289   - // now the email content.
  288 +
  289 + // now the email content.
290 290 // FIXME this needs to be handled entirely within notifications from now on.
291 291 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
292 292 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -295,23 +295,23 @@ class SubscriptionEvent {
295 295 $oEmail->send();
296 296 }
297 297 }
298   -
299   -
  298 +
  299 +
300 300 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
301 301 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
302 302 foreach ($aUsers as $oSubscriber) {
303   -
304   - // notification object first.
  303 +
  304 + // notification object first.
305 305 $aNotificationOptions = array();
306 306 $aNotificationOptions['target_user'] = $oSubscriber->getID();
307 307 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
308 308 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
309 309 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
310 310 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
311   - $aNotificationOptions['event_type'] = "ModifyDocument";
  311 + $aNotificationOptions['event_type'] = "ModifyDocument";
312 312 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
313   -
314   - // now the email content.
  313 +
  314 + // now the email content.
315 315 // FIXME this needs to be handled entirely within notifications from now on.
316 316 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
317 317 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -321,25 +321,25 @@ class SubscriptionEvent {
321 321 }
322 322 }
323 323 }
324   -
325   - function DiscussDocument($oModifiedDocument, $oParentFolder) {
326   - $content = new SubscriptionContent(); // needed for i18n
  324 +
  325 + function DiscussDocument($oModifiedDocument, $oParentFolder) {
  326 + $content = new SubscriptionContent(); // needed for i18n
327 327 // OK: two actions: document registrants, folder registrants.
328 328 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
329 329 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
330 330 foreach ($aUsers as $oSubscriber) {
331   -
332   - // notification object first.
  331 +
  332 + // notification object first.
333 333 $aNotificationOptions = array();
334 334 $aNotificationOptions['target_user'] = $oSubscriber->getID();
335 335 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
336 336 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
337 337 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
338 338 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
339   - $aNotificationOptions['event_type'] = "DiscussDocument";
  339 + $aNotificationOptions['event_type'] = "DiscussDocument";
340 340 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
341   -
342   - // now the email content.
  341 +
  342 + // now the email content.
343 343 // FIXME this needs to be handled entirely within notifications from now on.
344 344 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
345 345 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -348,22 +348,22 @@ class SubscriptionEvent {
348 348 $oEmail->send();
349 349 }
350 350 }
351   -
  351 +
352 352 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
353 353 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
354 354 foreach ($aUsers as $oSubscriber) {
355   -
356   - // notification object first.
  355 +
  356 + // notification object first.
357 357 $aNotificationOptions = array();
358 358 $aNotificationOptions['target_user'] = $oSubscriber->getID();
359 359 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
360 360 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
361 361 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
362 362 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
363   - $aNotificationOptions['event_type'] = "DiscussDocument";
  363 + $aNotificationOptions['event_type'] = "DiscussDocument";
364 364 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
365   -
366   - // now the email content.
  365 +
  366 + // now the email content.
367 367 // FIXME this needs to be handled entirely within notifications from now on.
368 368 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
369 369 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -373,25 +373,25 @@ class SubscriptionEvent {
373 373 }
374 374 }
375 375 }
376   -
377   - function CheckInDocument($oModifiedDocument, $oParentFolder) {
378   - $content = new SubscriptionContent(); // needed for i18n
  376 +
  377 + function CheckInDocument($oModifiedDocument, $oParentFolder) {
  378 + $content = new SubscriptionContent(); // needed for i18n
379 379 // OK: two actions: document registrants, folder registrants.
380 380 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
381 381 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
382 382 foreach ($aUsers as $oSubscriber) {
383   -
384   - // notification object first.
  383 +
  384 + // notification object first.
385 385 $aNotificationOptions = array();
386 386 $aNotificationOptions['target_user'] = $oSubscriber->getID();
387 387 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
388 388 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
389 389 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
390 390 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
391   - $aNotificationOptions['event_type'] = "CheckInDocument";
  391 + $aNotificationOptions['event_type'] = "CheckInDocument";
392 392 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
393   -
394   - // now the email content.
  393 +
  394 + // now the email content.
395 395 // FIXME this needs to be handled entirely within notifications from now on.
396 396 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
397 397 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -400,23 +400,23 @@ class SubscriptionEvent {
400 400 $oEmail->send();
401 401 }
402 402 }
403   -
404   -
  403 +
  404 +
405 405 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
406 406 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
407 407 foreach ($aUsers as $oSubscriber) {
408   -
409   - // notification object first.
  408 +
  409 + // notification object first.
410 410 $aNotificationOptions = array();
411 411 $aNotificationOptions['target_user'] = $oSubscriber->getID();
412 412 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
413 413 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
414 414 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
415 415 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
416   - $aNotificationOptions['event_type'] = "CheckInDocument";
  416 + $aNotificationOptions['event_type'] = "CheckInDocument";
417 417 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
418   -
419   - // now the email content.
  418 +
  419 + // now the email content.
420 420 // FIXME this needs to be handled entirely within notifications from now on.
421 421 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
422 422 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -427,24 +427,24 @@ class SubscriptionEvent {
427 427 }
428 428 }
429 429 }
430   - function CheckOutDocument($oModifiedDocument, $oParentFolder) {
431   - $content = new SubscriptionContent(); // needed for i18n
  430 + function CheckOutDocument($oModifiedDocument, $oParentFolder) {
  431 + $content = new SubscriptionContent(); // needed for i18n
432 432 // OK: two actions: document registrants, folder registrants.
433 433 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
434 434 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
435 435 foreach ($aUsers as $oSubscriber) {
436   -
437   - // notification object first.
  436 +
  437 + // notification object first.
438 438 $aNotificationOptions = array();
439 439 $aNotificationOptions['target_user'] = $oSubscriber->getID();
440 440 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
441 441 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
442 442 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
443 443 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
444   - $aNotificationOptions['event_type'] = "CheckOutDocument";
  444 + $aNotificationOptions['event_type'] = "CheckOutDocument";
445 445 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
446   -
447   - // now the email content.
  446 +
  447 + // now the email content.
448 448 // FIXME this needs to be handled entirely within notifications from now on.
449 449 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
450 450 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -453,23 +453,23 @@ class SubscriptionEvent {
453 453 $oEmail->send();
454 454 }
455 455 }
456   -
457   -
  456 +
  457 +
458 458 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
459 459 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
460 460 foreach ($aUsers as $oSubscriber) {
461   -
462   - // notification object first.
  461 +
  462 + // notification object first.
463 463 $aNotificationOptions = array();
464 464 $aNotificationOptions['target_user'] = $oSubscriber->getID();
465 465 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
466 466 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
467 467 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
468 468 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
469   - $aNotificationOptions['event_type'] = "CheckOutDocument";
  469 + $aNotificationOptions['event_type'] = "CheckOutDocument";
470 470 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
471   -
472   - // now the email content.
  471 +
  472 + // now the email content.
473 473 // FIXME this needs to be handled entirely within notifications from now on.
474 474 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
475 475 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -480,24 +480,24 @@ class SubscriptionEvent {
480 480 }
481 481 }
482 482  
483   - function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder) {
484   - $content = new SubscriptionContent(); // needed for i18n
  483 + function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder) {
  484 + $content = new SubscriptionContent(); // needed for i18n
485 485 // OK: two actions: document registrants, folder registrants.
486 486 $aUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]);
487 487 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
488 488  
489 489 foreach ($aUsers as $oSubscriber) {
490   - // notification object first.
  490 + // notification object first.
491 491 $aNotificationOptions = array();
492 492 $aNotificationOptions['target_user'] = $oSubscriber->getID();
493 493 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
494 494 $aNotificationOptions['target_name'] = $oMovedDocument->getName();
495 495 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oToFolder->getId());
496 496 $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
497   - $aNotificationOptions['event_type'] = "MovedDocument";
  497 + $aNotificationOptions['event_type'] = "MovedDocument";
498 498 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
499   -
500   - // now the email content.
  499 +
  500 + // now the email content.
501 501 // FIXME this needs to be handled entirely within notifications from now on.
502 502 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
503 503 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -506,23 +506,23 @@ class SubscriptionEvent {
506 506 $oEmail->send();
507 507 }
508 508 }
509   -
510   -
  509 +
  510 +
511 511 $aUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]);
512 512 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
513 513 foreach ($aUsers as $oSubscriber) {
514   -
515   - // notification object first.
  514 +
  515 + // notification object first.
516 516 $aNotificationOptions = array();
517 517 $aNotificationOptions['target_user'] = $oSubscriber->getID();
518 518 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
519 519 $aNotificationOptions['target_name'] = $oMovedDocument->getName();
520 520 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oToFolder->getId());
521 521 $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
522   - $aNotificationOptions['event_type'] = "MovedDocument";
  522 + $aNotificationOptions['event_type'] = "MovedDocument";
523 523 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
524   -
525   - // now the email content.
  524 +
  525 + // now the email content.
526 526 // FIXME this needs to be handled entirely within notifications from now on.
527 527 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
528 528 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -531,22 +531,22 @@ class SubscriptionEvent {
531 531 $oEmail->send();
532 532 }
533 533 }
534   -
  534 +
535 535 $aUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]);
536 536 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
537 537 foreach ($aUsers as $oSubscriber) {
538   -
539   - // notification object first.
  538 +
  539 + // notification object first.
540 540 $aNotificationOptions = array();
541 541 $aNotificationOptions['target_user'] = $oSubscriber->getID();
542 542 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
543 543 $aNotificationOptions['target_name'] = $oMovedDocument->getName();
544 544 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
545 545 $aNotificationOptions['object_id'] = $oToFolder->getId(); // parent folder_id, in this case.
546   - $aNotificationOptions['event_type'] = "MovedDocument";
  546 + $aNotificationOptions['event_type'] = "MovedDocument";
547 547 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
548   -
549   - // now the email content.
  548 +
  549 + // now the email content.
550 550 // FIXME this needs to be handled entirely within notifications from now on.
551 551 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
552 552 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -554,26 +554,26 @@ class SubscriptionEvent {
554 554 $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
555 555 $oEmail->send();
556 556 }
557   - }
  557 + }
558 558 }
559   - function ArchivedDocument($oModifiedDocument, $oParentFolder) {
560   - $content = new SubscriptionContent(); // needed for i18n
  559 + function ArchivedDocument($oModifiedDocument, $oParentFolder) {
  560 + $content = new SubscriptionContent(); // needed for i18n
561 561 // OK: two actions: document registrants, folder registrants.
562 562 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
563 563 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
564 564 foreach ($aUsers as $oSubscriber) {
565   -
566   - // notification object first.
  565 +
  566 + // notification object first.
567 567 $aNotificationOptions = array();
568 568 $aNotificationOptions['target_user'] = $oSubscriber->getID();
569 569 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
570 570 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
571 571 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
572 572 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
573   - $aNotificationOptions['event_type'] = "ArchivedDocument";
  573 + $aNotificationOptions['event_type'] = "ArchivedDocument";
574 574 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
575   -
576   - // now the email content.
  575 +
  576 + // now the email content.
577 577 // FIXME this needs to be handled entirely within notifications from now on.
578 578 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
579 579 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -582,23 +582,23 @@ class SubscriptionEvent {
582 582 $oEmail->send();
583 583 }
584 584 }
585   -
586   -
  585 +
  586 +
587 587 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
588 588 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
589 589 foreach ($aUsers as $oSubscriber) {
590   -
591   - // notification object first.
  590 +
  591 + // notification object first.
592 592 $aNotificationOptions = array();
593 593 $aNotificationOptions['target_user'] = $oSubscriber->getID();
594 594 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
595 595 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
596 596 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
597 597 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
598   - $aNotificationOptions['event_type'] = "ArchivedDocument";
  598 + $aNotificationOptions['event_type'] = "ArchivedDocument";
599 599 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
600   -
601   - // now the email content.
  600 +
  601 + // now the email content.
602 602 // FIXME this needs to be handled entirely within notifications from now on.
603 603 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
604 604 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -608,25 +608,25 @@ class SubscriptionEvent {
608 608 }
609 609 }
610 610 }
611   -
612   - function RestoreDocument($oModifiedDocument, $oParentFolder) {
613   - $content = new SubscriptionContent(); // needed for i18n
  611 +
  612 + function RestoreDocument($oModifiedDocument, $oParentFolder) {
  613 + $content = new SubscriptionContent(); // needed for i18n
614 614 // OK: two actions: document registrants, folder registrants.
615 615 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
616 616 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
617 617 foreach ($aUsers as $oSubscriber) {
618   -
619   - // notification object first.
  618 +
  619 + // notification object first.
620 620 $aNotificationOptions = array();
621 621 $aNotificationOptions['target_user'] = $oSubscriber->getID();
622 622 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
623 623 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
624 624 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
625 625 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
626   - $aNotificationOptions['event_type'] = "RestoreArchivedDocument";
  626 + $aNotificationOptions['event_type'] = "RestoreArchivedDocument";
627 627 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
628   -
629   - // now the email content.
  628 +
  629 + // now the email content.
630 630 // FIXME this needs to be handled entirely within notifications from now on.
631 631 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
632 632 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -635,23 +635,23 @@ class SubscriptionEvent {
635 635 $oEmail->send();
636 636 }
637 637 }
638   -
639   -
  638 +
  639 +
640 640 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
641 641 $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.
642 642 foreach ($aUsers as $oSubscriber) {
643   -
644   - // notification object first.
  643 +
  644 + // notification object first.
645 645 $aNotificationOptions = array();
646 646 $aNotificationOptions['target_user'] = $oSubscriber->getID();
647 647 $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
648 648 $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
649 649 $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
650 650 $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
651   - $aNotificationOptions['event_type'] = "RestoreArchivedDocument";
  651 + $aNotificationOptions['event_type'] = "RestoreArchivedDocument";
652 652 $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
653   -
654   - // now the email content.
  653 +
  654 + // now the email content.
655 655 // FIXME this needs to be handled entirely within notifications from now on.
656 656 if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
657 657 $emailContent = $content->getEmailAlertContent($oNotification);
... ... @@ -666,11 +666,11 @@ class SubscriptionEvent {
666 666 function _getKeyForType($sEventType) {
667 667 foreach ($this->eventTypes as $key => $val) {
668 668 if ($val == $sSubType) { return $key; }
669   - }
  669 + }
670 670 return -1;
671 671 }
672   -
673   - // helper function to get & adjust the $alertedUsers
  672 +
  673 + // helper function to get & adjust the $alertedUsers
674 674 // note that this has side-effects: $this->alertedUsers is a merged version
675 675 // after this has been called.
676 676 function _pruneAlertedUsers($aUserIds) {
... ... @@ -678,39 +678,39 @@ class SubscriptionEvent {
678 678 $this->alertedUsers = kt_array_merge($returnArray, $this->alertedUsers); // now contains all users who will have been alerted.
679 679 return $returnArray;
680 680 }
681   -
  681 +
682 682 // gets subscribers to object, with appropriate type (e.g. folder or document).
683 683 // need the second part because docs and folders have separate ids.
684 684 // based on the old SubscriptionEngine::retrieveSubscribers.
685 685 function _getSubscribers($iObjectId, $iSubType) {
686 686 global $default; // for the logging.
687 687 $default->log->debug("_getSubscribers(id=$iObjectId, type=$iSubType); table=" .Subscription::getTableName($iSubType). "; id=" .Subscription::getIdFieldName($iSubType));
688   -
689   - $aUsers = array();
  688 +
  689 + $aUsers = array();
690 690 $sQuery = "SELECT user_id FROM " . Subscription::getTableName($iSubType) . " WHERE " . Subscription::getIdFieldName($iSubType) . " = ?";
691 691 $aParams = array($iObjectId);
692   -
  692 +
693 693 $aNewUsers = DBUtil::getResultArrayKey(array($sQuery, $aParams), "user_id");
694   -
  694 +
695 695 // notionally less efficient than the old code. if its a big issue, can easily
696 696 // be refactored.
697 697 foreach ($aNewUsers as $iUserId) {
698 698 $oUser = & User::get($iUserId);
699   -
  699 +
700 700 // do a quick prune here, for performance/maintenance reasons.
701 701 if (PEAR::isError($oUser) || ($oUser == false)) {
702 702 $sQuery = "DELETE FROM " . Subscription::getTableName($iSubType) . " WHERE user_id = ?";
703 703 $aParams = array($iUserId);
704 704 DBUtil::runQuery(array($sQuery, $sParams));
705   - $default->log->error("SubscriptionEvent::fireSubscription error removing subscription for user id=$iUserID");
  705 + $default->log->error("SubscriptionEvent::fireSubscription error removing subscription for user id=$iUserId");
706 706 } else {
707 707 $aUsers[] = $oUser;
708   - }
  708 + }
709 709 }
710   -
  710 +
711 711 $default->log->debug('retrieveSubscribers found count=' . count($aUsers));
712   - return $aUsers;
713   - }
  712 + return $aUsers;
  713 + }
714 714 }
715 715  
716 716 // interesting: how do we want to generate email & notification content?
... ... @@ -735,7 +735,7 @@ class SubscriptionContent {
735 735 "MovedDocument" => _kt('Document moved'),
736 736 "ArchivedDocument" => _kt('Document archived'), // can go through and request un-archival (?)
737 737 "RestoredArchivedDocument" => _kt('Document restored'),
738   - "DiscussDocument" => _kt('Document Discussions updated'),
  738 + "DiscussDocument" => _kt('Document Discussions updated'),
739 739 );
740 740 }
741 741  
... ... @@ -745,34 +745,34 @@ class SubscriptionContent {
745 745 $str = '<html><body>' . $this->getNotificationAlertContent($oKTNotification) . '</body></html>';
746 746 return $str;
747 747 }
748   -
749   - function getEmailAlertSubject($oKTNotification) {
  748 +
  749 + function getEmailAlertSubject($oKTNotification) {
750 750 $info = $this->_getSubscriptionData($oKTNotification);
751   - return $info["title"];
  751 + return $info["title"];
752 752 }
753   -
  753 +
754 754 function getNotificationAlertContent($oKTNotification) {
755 755 $info = $this->_getSubscriptionData($oKTNotification);
756 756 $oTemplating =& KTTemplating::getSingleton();
757   -
  757 +
758 758 $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions." . $info['event_type']);
759 759 // if, for some reason, this doesn't actually work, use the "generic" title.
760 760 if (PEAR::isError($oTemplate)) {
761 761 $oTemplate = $oTemplating->loadTemplate("kt3/notifications/subscriptions.generic");
762 762 }
763 763 // FIXME we need to specify the i18n by user.
764   -
  764 +
765 765 $isBroken = false;
766 766 if (PEAR::isError($info['object']) || ($info['object'] === false) || is_null($info['object'])) {
767 767 $isBroken = true;
768 768 }
769   -
  769 +
770 770 $aTemplateData = array("context" => $oKTNotification,
771 771 "info" => $info,
772 772 "is_broken" => $isBroken,
773 773 );
774 774 return $oTemplate->render($aTemplateData);
775   - }
  775 + }
776 776 // no separate subject function, its rolled into get...Content()
777 777  
778 778 var $_eventObjectMap = array(
... ... @@ -788,10 +788,10 @@ class SubscriptionContent {
788 788 "MovedDocument" => 'document',
789 789 "ArchivedDocument" => 'document', // can go through and request un-archival (?)
790 790 "RestoredArchivedDocument" => 'document',
791   - "DiscussDocument" => 'document');
  791 + "DiscussDocument" => 'document');
  792 +
792 793  
793 794  
794   -
795 795 function _getSubscriptionData($oKTNotification) {
796 796 $info = array(
797 797 'object_name' => $oKTNotification->getLabel(),
... ... @@ -802,9 +802,9 @@ class SubscriptionContent {
802 802 'has_actor' => false,
803 803 'notify_id' => $oKTNotification->getId(),
804 804 );
805   -
  805 +
806 806 $info['title'] = KTUtil::arrayGet($this->_eventTypeNames, $info['event_type'], 'Subscription alert:') .': ' . $info['object_name'];
807   -
  807 +
808 808 if ($info['actor_id'] !== null) {
809 809 $oTempUser = User::get($info['actor_id']);
810 810 if (PEAR::isError($oTempUser) || ($oTempUser == false)) {
... ... @@ -823,37 +823,37 @@ class SubscriptionContent {
823 823 $sName .= sprintf(" (%s)", $oUnit->getName());
824 824 }
825 825 }
826   -
  826 +
827 827 $info['actor_name'] = $sName;
828 828 }
829 829 }
830   -
  830 +
831 831 if ($info['object_id'] !== null) {
832 832 $info['object'] = $this->_getEventObject($info['event_type'], $info['object_id']);
833 833 }
834   -
  834 +
835 835 return $info;
836   - }
837   -
  836 + }
  837 +
838 838 // resolve the object type based on the alert type.
839 839 function _getEventObject($sAlertType, $id) {
840 840 $t = KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,'');
841 841 if ($t == 'document') {
842 842 $o = Document::get($id);
843   - if (PEAR::isError($o) || ($o == false)) { return null;
  843 + if (PEAR::isError($o) || ($o == false)) { return null;
844 844 } else { return $o; }
845 845 } else if ($t == 'folder') {
846 846 $o = Folder::get($id);
847   - if (PEAR::isError($o) || ($o == false)) { return null;
  847 + if (PEAR::isError($o) || ($o == false)) { return null;
848 848 } else { return $o; }
849 849 } else {
850 850 return null;
851 851 }
852 852 }
853   -
  853 +
854 854 function _getEventObjectType($sAlertType) {
855 855 return KTUtil::arrayGet($this->_eventObjectMap, $sAlertType ,'');
856   - }
  856 + }
857 857 }
858 858  
859 859 ?>
... ...