ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjForumNotificationDataProvider Class Reference

Class ilObjForumNotificationDataProvider. More...

+ Inheritance diagram for ilObjForumNotificationDataProvider:
+ Collaboration diagram for ilObjForumNotificationDataProvider:

Public Member Functions

 __construct (ilForumPost $objPost, $ref_id)
 
 getRefId ()
 
 getObjId ()
 
 getThreadId ()
 
 getPostId ()
 
 getForumId ()
 
 getForumTitle ()
 
 getThreadTitle ()
 
 getPostTitle ()
 
 getPostMessage ()
 
 getPosDisplayUserId ()
 
 getPostDate ()
 
 getPostUpdate ()
 
 getPostCensored ()
 
 getPostCensoredDate ()
 
 getCensorshipComment ()
 
 getAttachments ()
 
 getPosUserAlias ()
 
 isAnonymized ()
 
 getImportName ()
 
 getPostUpdateUserId ()
 
Returns
int
More...
 
 getPostUserName (\ilLanguage $user_lang)
 
Parameters
\ilLanguage$user_lang
Returns
string
More...
 
 getPostUpdateUserName (\ilLanguage $user_lang)
 
Parameters
\ilLanguage$user_lang
Returns
string
More...
 
 getPublicUserInformation (ilForumAuthorInformation $authorinfo)
 
 getForumNotificationRecipients ()
 
 getThreadNotificationRecipients ()
 
 getPostAnsweredRecipients ()
 
 getPostActivationRecipients ()
 
 setPosAuthorId ($pos_author_id)
 
 getPosAuthorId ()
 
 getRefId ()
 
 getObjId ()
 
 getForumId ()
 
 getForumTitle ()
 
 getThreadId ()
 
 getThreadTitle ()
 
 getPostId ()
 
 getPostTitle ()
 
 getPostMessage ()
 
 getPosAuthorId ()
 
 getPostUpdateUserId ()
 
 getPosDisplayUserId ()
 
 getPosUserAlias ()
 
 getPostUserName (\ilLanguage $user_lang)
 
 getPostDate ()
 
 getPostUpdate ()
 
 getPostUpdateUserName (\ilLanguage $user_lang)
 
 getPostCensored ()
 
 getPostCensoredDate ()
 
 getCensorshipComment ()
 
 getAttachments ()
 

Data Fields

 $pos_author_id = 0
 
 $objPost
 

Protected Member Functions

 read ()
 

Protected Attributes

 $ref_id = 0
 
 $obj_id = 0
 
 $post_user_name = null
 
 $update_user_name = null
 
 $forum_id = 0
 
 $forum_title = ''
 
 $thread_title = ''
 
 $attachments = array()
 
 $is_anonymized = false
 

Private Member Functions

 readThreadTitle ()
 
 readForumData ()
 
 readAttachments ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjForumNotificationDataProvider::__construct ( ilForumPost  $objPost,
  $ref_id 
)
Parameters
ilForumPost$objPost
int$ref_id

Definition at line 71 of file class.ilObjForumNotificationDataProvider.php.

References $objPost, $ref_id, ilObject\_lookupObjId(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAttachments()

ilObjForumNotificationDataProvider::getAttachments ( )

◆ getCensorshipComment()

ilObjForumNotificationDataProvider::getCensorshipComment ( )
Returns
string

Implements ilForumNotificationMailData.

Definition at line 190 of file class.ilObjForumNotificationDataProvider.php.

191 {
192 return $this->objPost->getCensorshipComment();
193 }

◆ getForumId()

ilObjForumNotificationDataProvider::getForumId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 114 of file class.ilObjForumNotificationDataProvider.php.

References $forum_id.

Referenced by getForumNotificationRecipients().

+ Here is the caller graph for this function:

◆ getForumNotificationRecipients()

ilObjForumNotificationDataProvider::getForumNotificationRecipients ( )
Returns
array

Definition at line 367 of file class.ilObjForumNotificationDataProvider.php.

368 {
369 global $ilDB, $ilAccess, $ilUser;
370
371 $res = $ilDB->queryf('
372 SELECT frm_notification.user_id FROM frm_notification, frm_data
373 WHERE frm_data.top_pk = %s
374 AND frm_notification.frm_id = frm_data.top_frm_fk
375 AND frm_notification.user_id <> %s
376 GROUP BY frm_notification.user_id',
377 array('integer', 'integer'),
378 array($this->getForumId(), $ilUser->getId()));
379
380 // get all references of obj_id
381 $frm_references = ilObject::_getAllReferences($this->getObjId());
382 $rcps = array();
383 while($row = $ilDB->fetchAssoc($res))
384 {
385 // do rbac check before sending notification
386 foreach((array)$frm_references as $ref_id)
387 {
388 if($ilAccess->checkAccessOfUser($row['user_id'], 'read', '', $ref_id))
389 {
390 $rcps[] = $row['user_id'];
391 }
392 }
393 }
394
395 return array_unique($rcps);
396 }
static _getAllReferences($a_id)
get all reference ids of object
global $ilDB
$ilUser
Definition: imgupload.php:18

References $ilDB, $ilUser, $ref_id, $res, $row, ilObject\_getAllReferences(), getForumId(), and getObjId().

+ Here is the call graph for this function:

◆ getForumTitle()

ilObjForumNotificationDataProvider::getForumTitle ( )
Returns
string frm_data.top_name

Implements ilForumNotificationMailData.

Definition at line 122 of file class.ilObjForumNotificationDataProvider.php.

References $forum_title.

◆ getImportName()

ilObjForumNotificationDataProvider::getImportName ( )
Returns
string

Definition at line 221 of file class.ilObjForumNotificationDataProvider.php.

222 {
223 return $this->objPost->getImportName();
224 }

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getObjId()

ilObjForumNotificationDataProvider::getObjId ( )

◆ getPosAuthorId()

ilObjForumNotificationDataProvider::getPosAuthorId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 466 of file class.ilObjForumNotificationDataProvider.php.

References $pos_author_id.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getPosDisplayUserId()

ilObjForumNotificationDataProvider::getPosDisplayUserId ( )
Returns
string frm_posts.pos_display_user_id

Implements ilForumNotificationMailData.

Definition at line 154 of file class.ilObjForumNotificationDataProvider.php.

155 {
156 return $this->objPost->getDisplayUserId();
157 }

Referenced by getPostUserName().

+ Here is the caller graph for this function:

◆ getPostActivationRecipients()

ilObjForumNotificationDataProvider::getPostActivationRecipients ( )
Returns
array

Definition at line 447 of file class.ilObjForumNotificationDataProvider.php.

448 {
449 include_once './Modules/Forum/classes/class.ilForum.php';
450 // get moderators to notify about needed activation
451 $rcps = ilForum::_getModerators($this->getRefId());
452 return (array)$rcps;
453 }
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)

References ilForum\_getModerators(), and getRefId().

+ Here is the call graph for this function:

◆ getPostAnsweredRecipients()

ilObjForumNotificationDataProvider::getPostAnsweredRecipients ( )
Returns
array

Definition at line 433 of file class.ilObjForumNotificationDataProvider.php.

434 {
435 include_once './Modules/Forum/classes/class.ilForumPost.php';
436 $parent_objPost = new ilForumPost($this->objPost->getParentId());
437
438 $rcps = array();
439 $rcps[] = $parent_objPost->getPosAuthorId();
440
441 return $rcps;
442 }

◆ getPostCensored()

ilObjForumNotificationDataProvider::getPostCensored ( )
Returns
bool frm_posts.pos_cens

Implements ilForumNotificationMailData.

Definition at line 177 of file class.ilObjForumNotificationDataProvider.php.

178 {
179 return $this->objPost->isCensored();
180 }

◆ getPostCensoredDate()

ilObjForumNotificationDataProvider::getPostCensoredDate ( )
Returns
string frm_posts.pos_cens_date

Implements ilForumNotificationMailData.

Definition at line 185 of file class.ilObjForumNotificationDataProvider.php.

186 {
187 return $this->objPost->getCensoredDate();
188 }

◆ getPostDate()

ilObjForumNotificationDataProvider::getPostDate ( )
Returns
string frm_posts.pos_date

Implements ilForumNotificationMailData.

Definition at line 162 of file class.ilObjForumNotificationDataProvider.php.

163 {
164 return $this->objPost->getCreateDate();
165 }

◆ getPostId()

ilObjForumNotificationDataProvider::getPostId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 106 of file class.ilObjForumNotificationDataProvider.php.

107 {
108 return $this->objPost->getId();
109 }

◆ getPostMessage()

ilObjForumNotificationDataProvider::getPostMessage ( )
Returns
string frm_posts.pos_message

Implements ilForumNotificationMailData.

Definition at line 146 of file class.ilObjForumNotificationDataProvider.php.

147 {
148 return $this->objPost->getMessage();
149 }

◆ getPostTitle()

ilObjForumNotificationDataProvider::getPostTitle ( )
Returns
string frm_posts.pos_subject

Implements ilForumNotificationMailData.

Definition at line 138 of file class.ilObjForumNotificationDataProvider.php.

139 {
140 return $this->objPost->getSubject();
141 }

◆ getPostUpdate()

ilObjForumNotificationDataProvider::getPostUpdate ( )
Returns
string frm_posts.pos_update

Implements ilForumNotificationMailData.

Definition at line 170 of file class.ilObjForumNotificationDataProvider.php.

171 {
172 return $this->objPost->getChangeDate();
173 }

◆ getPostUpdateUserId()

ilObjForumNotificationDataProvider::getPostUpdateUserId ( )

Returns
int

Implements ilForumNotificationMailData.

Definition at line 229 of file class.ilObjForumNotificationDataProvider.php.

230 {
231 return $this->objPost->getUpdateUserId();
232 }

Referenced by getPostUpdateUserName().

+ Here is the caller graph for this function:

◆ getPostUpdateUserName()

ilObjForumNotificationDataProvider::getPostUpdateUserName ( \ilLanguage  $user_lang)

Parameters
\ilLanguage$user_lang
Returns
string

Implements ilForumNotificationMailData.

Definition at line 257 of file class.ilObjForumNotificationDataProvider.php.

References $update_user_name, getImportName(), getPosAuthorId(), getPostUpdateUserId(), getPosUserAlias(), and getPublicUserInformation().

+ Here is the call graph for this function:

◆ getPostUserName()

ilObjForumNotificationDataProvider::getPostUserName ( \ilLanguage  $user_lang)

Parameters
\ilLanguage$user_lang
Returns
string

Implements ilForumNotificationMailData.

Definition at line 237 of file class.ilObjForumNotificationDataProvider.php.

238 {
239 if ($this->post_user_name === null) {
240 $authorinfo = new ilForumAuthorInformation(
241 $this->getPosAuthorId(),
242 $this->getPosDisplayUserId(),
243 $this->getPosUserAlias(),
244 $this->getImportName(),
245 array(),
246 $user_lang
247 );
248 $this->post_user_name = $this->getPublicUserInformation($authorinfo);
249 }
250
251 return (string)$this->post_user_name;
252 }

References $post_user_name, getImportName(), getPosAuthorId(), getPosDisplayUserId(), getPosUserAlias(), and getPublicUserInformation().

+ Here is the call graph for this function:

◆ getPosUserAlias()

ilObjForumNotificationDataProvider::getPosUserAlias ( )
Returns
string frm_posts.pos_usr_alias

Implements ilForumNotificationMailData.

Definition at line 206 of file class.ilObjForumNotificationDataProvider.php.

207 {
208 return $this->objPost->getUserAlias();
209 }

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getPublicUserInformation()

ilObjForumNotificationDataProvider::getPublicUserInformation ( ilForumAuthorInformation  $authorinfo)
Parameters
ilForumAuthorInformation$authorinfo
Returns
string

Definition at line 278 of file class.ilObjForumNotificationDataProvider.php.

279 {
280 if($authorinfo->hasSuffix())
281 {
282 $public_name = $authorinfo->getAuthorName();
283 }
284 else
285 {
286 $public_name = $authorinfo->getAuthorShortName();
287
288 if($authorinfo->getAuthorName() && !$this->isAnonymized())
289 {
290 $public_name = $authorinfo->getAuthorName();
291 }
292 }
293
294 return $public_name;
295 }
getAuthorName($without_short_name=false)

References ilForumAuthorInformation\getAuthorName(), ilForumAuthorInformation\getAuthorShortName(), and ilForumAuthorInformation\hasSuffix().

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilObjForumNotificationDataProvider::getRefId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 82 of file class.ilObjForumNotificationDataProvider.php.

83 {
84 return $this->ref_id;
85 }

References $ref_id.

Referenced by getPostActivationRecipients().

+ Here is the caller graph for this function:

◆ getThreadId()

ilObjForumNotificationDataProvider::getThreadId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 98 of file class.ilObjForumNotificationDataProvider.php.

99 {
100 return $this->objPost->getThreadId();
101 }

Referenced by getThreadNotificationRecipients().

+ Here is the caller graph for this function:

◆ getThreadNotificationRecipients()

ilObjForumNotificationDataProvider::getThreadNotificationRecipients ( )
Returns
array

Definition at line 401 of file class.ilObjForumNotificationDataProvider.php.

402 {
403 global $ilDB, $ilAccess, $ilUser;
404
405 // GET USERS WHO WANT TO BE INFORMED ABOUT NEW POSTS
406 $res = $ilDB->queryf('
407 SELECT user_id FROM frm_notification
408 WHERE thread_id = %s
409 AND user_id <> %s',
410 array('integer', 'integer'),
411 array($this->getThreadId(), $GLOBALS['DIC']['ilUser']->getId()));
412
413 // get all references of obj_id
414 $frm_references = ilObject::_getAllReferences($this->getObjId());
415 $rcps = array();
416 while($row = $ilDB->fetchAssoc($res))
417 {
418 // do rbac check before sending notification
419 foreach((array)$frm_references as $ref_id)
420 {
421 if($ilAccess->checkAccessOfUser($row['user_id'], 'read', '', $ref_id))
422 {
423 $rcps[] = $row['user_id'];
424 }
425 }
426 }
427 return $rcps;
428 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, $ilDB, $ilUser, $ref_id, $res, $row, ilObject\_getAllReferences(), getObjId(), and getThreadId().

+ Here is the call graph for this function:

◆ getThreadTitle()

ilObjForumNotificationDataProvider::getThreadTitle ( )
Returns
string frm_threads.thr_subject

Implements ilForumNotificationMailData.

Definition at line 130 of file class.ilObjForumNotificationDataProvider.php.

References $thread_title.

◆ isAnonymized()

ilObjForumNotificationDataProvider::isAnonymized ( )

◆ read()

ilObjForumNotificationDataProvider::read ( )
protected

Definition at line 300 of file class.ilObjForumNotificationDataProvider.php.

References readAttachments(), readForumData(), and readThreadTitle().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAttachments()

ilObjForumNotificationDataProvider::readAttachments ( )
private

Definition at line 345 of file class.ilObjForumNotificationDataProvider.php.

346 {
347 if(ilForumProperties::isSendAttachmentsByMailEnabled())
348 {
349 require_once 'Modules/Forum/classes/class.ilFileDataForum.php';
350 $fileDataForum = new ilFileDataForum($this->getObjId(), $this->objPost->getId());
351 $filesOfPost = $fileDataForum->getFilesOfPost();
352
353 require_once 'Services/Mail/classes/class.ilFileDataMail.php';
354 $fileDataMail = new ilFileDataMail(ANONYMOUS_USER_ID);
355
356 foreach($filesOfPost as $attachment)
357 {
358 $this->attachments[$attachment['path']] = $attachment['name'];
359 $fileDataMail->copyAttachmentFile($attachment['path'], $attachment['name']);
360 }
361 }
362 }
This class handles all operations on files for the forum object.
This class handles all operations on files (attachments) in directory ilias_data/mail.

References getObjId().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readForumData()

ilObjForumNotificationDataProvider::readForumData ( )
private

Definition at line 326 of file class.ilObjForumNotificationDataProvider.php.

327 {
328 global $ilDB;
329
330 $result = $ilDB->queryf('
331 SELECT top_pk, top_name, frm_settings.anonymized FROM frm_data
332 INNER JOIN frm_settings ON top_frm_fk = frm_settings.obj_id
333 WHERE top_frm_fk = %s',
334 array('integer'), array($this->getObjId()));
335
336 $row = $ilDB->fetchAssoc($result);
337 $this->forum_id = $row['top_pk'];
338 $this->forum_title = $row['top_name'];
339 $this->is_anonymized = (bool)$row['anonymized'];
340 }
$result

References $ilDB, $result, $row, and getObjId().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readThreadTitle()

ilObjForumNotificationDataProvider::readThreadTitle ( )
private

Definition at line 310 of file class.ilObjForumNotificationDataProvider.php.

311 {
312 global $ilDB;
313
314 $result = $ilDB->queryf('
315 SELECT thr_subject FROM frm_threads
316 WHERE thr_pk = %s',
317 array('integer'), array($this->objPost->getThreadId()));
318
319 $row = $ilDB->fetchAssoc($result);
320 $this->thread_title = $row['thr_subject'];
321 }

References $ilDB, $result, and $row.

Referenced by read().

+ Here is the caller graph for this function:

◆ setPosAuthorId()

ilObjForumNotificationDataProvider::setPosAuthorId (   $pos_author_id)
Parameters
$pos_author_id

Definition at line 458 of file class.ilObjForumNotificationDataProvider.php.

459 {
460 $this->pos_author_id = $pos_author_id;
461 }

References $pos_author_id.

Field Documentation

◆ $attachments

array ilObjForumNotificationDataProvider::$attachments = array()
protected

Definition at line 56 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getAttachments().

◆ $forum_id

ilObjForumNotificationDataProvider::$forum_id = 0
protected

Definition at line 41 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getForumId().

◆ $forum_title

string ilObjForumNotificationDataProvider::$forum_title = ''
protected

Definition at line 46 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getForumTitle().

◆ $is_anonymized

ilObjForumNotificationDataProvider::$is_anonymized = false
protected

Definition at line 65 of file class.ilObjForumNotificationDataProvider.php.

Referenced by isAnonymized().

◆ $obj_id

int ilObjForumNotificationDataProvider::$obj_id = 0
protected

Definition at line 22 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getObjId().

◆ $objPost

ilObjForumNotificationDataProvider::$objPost

Definition at line 61 of file class.ilObjForumNotificationDataProvider.php.

Referenced by __construct().

◆ $pos_author_id

ilObjForumNotificationDataProvider::$pos_author_id = 0

Definition at line 37 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getPosAuthorId(), and setPosAuthorId().

◆ $post_user_name

string null ilObjForumNotificationDataProvider::$post_user_name = null
protected

Definition at line 27 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getPostUserName().

◆ $ref_id

int ilObjForumNotificationDataProvider::$ref_id = 0
protected

◆ $thread_title

string ilObjForumNotificationDataProvider::$thread_title = ''
protected

Definition at line 51 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getThreadTitle().

◆ $update_user_name

string null ilObjForumNotificationDataProvider::$update_user_name = null
protected

Definition at line 32 of file class.ilObjForumNotificationDataProvider.php.

Referenced by getPostUpdateUserName().


The documentation for this class was generated from the following file: