ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilForumCronNotificationDataProvider.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Modules/Forum/interfaces/interface.ilForumNotificationMailData.php';
5 
12 {
16  public $notification_type = NULL;
17 
21  protected $ref_id = 0;
22 
26  protected $obj_id = 0;
27 
31  protected $post_user_name = '';
32 
36  protected $forum_id = 0;
37 
41  protected $forum_title = '';
42 
46  protected $thread_id = 0;
47 
51  protected $thread_title = '';
52 
56  protected $post_id = 0;
60  protected $post_title = '';
64  protected $post_message = '';
68  protected $post_date = NULL;
72  protected $post_update = NULL;
73 
77  protected $post_censored = false;
81  protected $post_censored_date = NULL;
85  protected $post_censored_comment = '';
86 
90  protected $pos_usr_alias = '';
94  protected $pos_display_user_id = 0;
95 
99  protected $attachments = array();
100 
104  protected $cron_recipients = array();
105 
109  public $objPost = NULL;
110 
115 
119  public $pos_author_id = 0;
120 
124  public function __construct($row)
125  {
126  $this->obj_id = $row['obj_id'];
127  $this->ref_id = $row['ref_id'];
128 
129  $this->thread_id = $row['thread_id'];
130  $this->thread_title = $row['thr_subject'];
131 
132  $this->forum_id = $row['pos_top_fk'];
133  $this->forum_title = $row['top_name'];
134 
135  $this->post_id = $row['pos_pk'];
136  $this->post_title = $row['pos_subject'];
137  $this->post_message = $row['pos_message'];
138  $this->post_date = $row['pos_date'];
139  $this->post_update = $row['pos_update'];
140  $this->post_update_user_id = $row['update_user'];
141 
142  $this->post_censored = $row['pos_cens'];
143  $this->post_censored_date = $row['pos_cens_date'];
144  $this->post_censored_comment = $row['pos_cens_com'];
145 
146  $this->pos_usr_alias = $row['pos_usr_alias'];
147  $this->pos_display_user_id = $row['pos_display_user_id'];
148  $this->pos_author_id = $row['pos_author_id'];
149 
150  $this->read();
151  }
152 
156  protected function read()
157  {
158  $this->readAttachments();
159  }
160 
164  private function readAttachments()
165  {
166  // get attachments
167  include_once "./Modules/Forum/classes/class.ilFileDataForum.php";
168  $fileDataForum = new ilFileDataForum($this->getObjId(), $this->getPostId());
169  $filesOfPost = $fileDataForum->getFilesOfPost();
170 
171  foreach($filesOfPost as $attachment)
172  {
173  $this->attachments[] = $attachment['name'];
174  }
175  }
176 
180  public function addRecipient($user_id)
181  {
182  $this->cron_recipients[] = (int)$user_id;
183  }
184 
188  public function getCronRecipients()
189  {
190  return $this->cron_recipients;
191  }
192 
196  public function getRefId()
197  {
198  return $this->ref_id;
199  }
200 
204  public function getObjId()
205  {
206  return $this->obj_id;
207  }
208 
212  public function getForumId()
213  {
214  return $this->forum_id;
215  }
216 
220  public function getForumTitle()
221  {
222  return $this->forum_title;
223  }
224 
228  public function getThreadId()
229  {
230  return $this->thread_id;
231  }
232 
236  public function getThreadTitle()
237  {
238  return $this->thread_title;
239  }
240 
244  public function getPostId()
245  {
246  return $this->post_id;
247  }
248 
252  public function getPostTitle()
253  {
254  return $this->post_title;
255  }
256 
260  public function getPostMessage()
261  {
262  return $this->post_message;
263  }
264 
268  public function getPostUserName($user_lang)
269  {
270  // GET AUTHOR OF NEW POST
271  if($this->getPosDisplayUserId())
272  {
273  $this->post_user_name = ilObjUser::_lookupLogin($this->getPosDisplayUserId());
274  }
275  else if(strlen($this->getPosUserAlias()))
276  {
277  $this->post_user_name = $this->getPosUserAlias() . ' (' . $user_lang->txt('frm_pseudonym') . ')';
278  }
279 
280  if($this->post_user_name == '')
281  {
282  $this->post_user_name = $user_lang->txt('forums_anonymous');
283  }
284 
285  return $this->post_user_name;
286  }
287 
291  public function getPostDate()
292  {
293  return $this->post_date;
294  }
295 
299  public function getPostUpdate()
300  {
301  return $this->post_update;
302  }
303 
308  public function getPostUpdateUserName($user_lang)
309  {
310  // GET AUTHOR OF UPDATED POST
311  if($this->getPostUpdateUserId() > 0)
312  {
313  $this->post_user_name = ilObjUser::_lookupLogin($this->getPostUpdateUserId());
314  }
315 
316  if($this->getPosDisplayUserId() == 0 && $this->getPosAuthorId() == $this->getPostUpdateUserId())
317  {
318  if(strlen($this->getPosUserAlias()))
319  {
320  $this->post_user_name = $this->getPosUserAlias() . ' (' . $user_lang->txt('frm_pseudonym') . ')';
321  }
322 
323  if($this->post_user_name == '')
324  {
325  $this->post_user_name = $user_lang->txt('forums_anonymous');
326  }
327  }
328  return $this->post_user_name;
329  }
330 
334  public function getPostCensored()
335  {
336  return $this->post_censored;
337  }
338 
342  public function getPostCensoredDate()
343  {
345  }
346 
350  public function getCensorshipComment()
351  {
353  }
354 
358  public function getAttachments()
359  {
360  return $this->attachments;
361  }
362 
367  {
368  $this->notification_type = $notification_type;
369  }
370 
374  public function getPosDisplayUserId()
375  {
377  }
378 
379 
383  public function getPosUserAlias()
384  {
385  return $this->pos_usr_alias;
386  }
387 
391  public function getPostUpdateUserId()
392  {
394  }
395 
400  {
401  $this->post_update_user_id = $post_update_user_id;
402  }
403 
405  {
406  $this->pos_author_id = $pos_author_id;
407  }
408  public function getPosAuthorId()
409  {
410  return $this->pos_author_id;
411  }
412 }
static _lookupLogin($a_user_id)
lookup login
Interface ilForumNotificationMailData.
This class handles all operations on files for the forum object.