ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilForumCronNotificationDataProvider Class Reference

Class ilForumCronNotificationDataProvider. More...

+ Inheritance diagram for ilForumCronNotificationDataProvider:
+ Collaboration diagram for ilForumCronNotificationDataProvider:

Public Member Functions

 __construct ($row, ilForumNotificationCache $notificationCache=null)
 
 addRecipient ($user_id)
 
 getCronRecipients ()
 
 getRefId ()
 
 getObjId ()
 
 getForumId ()
 
 getForumTitle ()
 
 getThreadId ()
 
 getThreadTitle ()
 
 getPostId ()
 
 getPostTitle ()
 
 getPostMessage ()
 
 getPostDate ()
 
 getPostUpdate ()
 
 getPostCensored ()
 
 getPostCensoredDate ()
 
 getCensorshipComment ()
 
 getAttachments ()
 
 setNotificationType ($notification_type)
 
 getPosDisplayUserId ()
 
 getPosUserAlias ()
 
 getPostUpdateUserId ()
 
 setPostUpdateUserId ($post_update_user_id)
 
 setPosAuthorId ($pos_author_id)
 
 getPosAuthorId ()
 
 isAnonymized ()
 
 getDeletedBy ()
 
 getImportName ()
 
 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)
 

Data Fields

 $notification_type = null
 
 $objPost = null
 
 $post_update_user_id = 0
 
 $pos_author_id = 0
 
 $deleted_by = ''
 

Protected Member Functions

 read ()
 

Protected Attributes

 $ref_id = 0
 
 $obj_id = 0
 
 $forum_id = 0
 
 $forum_title = ''
 
 $thread_id = 0
 
 $thread_title = ''
 
 $post_id = 0
 
 $post_title = ''
 
 $post_message = ''
 
 $post_date = null
 
 $post_update = null
 
 $post_censored = false
 
 $post_censored_date = null
 
 $post_censored_comment = ''
 
 $pos_usr_alias = ''
 
 $pos_display_user_id = 0
 
 $is_anonymized = false
 
 $import_name = ''
 
 $attachments = array()
 
 $cron_recipients = array()
 

Static Protected Attributes

static $authorInformationCache = array()
 

Private Member Functions

 readAttachments ()
 
 getAuthorInformation (\ilLanguage $lng, int $authorUsrId, int $displayUserId, string $usrAlias, string $importName)
 

Private Attributes

 $post_user_name = null
 
 $update_user_name = null
 
 $notificationCache
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumCronNotificationDataProvider::__construct (   $row,
ilForumNotificationCache  $notificationCache = null 
)
Parameters
$row
ilForumNotificationCache | null$notificationCache

Definition at line 148 of file class.ilForumCronNotificationDataProvider.php.

References $DIC, $notificationCache, $row, and read().

149  {
150  $this->obj_id = $row['obj_id'];
151  $this->ref_id = $row['ref_id'];
152 
153  $this->thread_id = $row['thread_id'];
154  $this->thread_title = $row['thr_subject'];
155 
156  $this->forum_id = $row['pos_top_fk'];
157  $this->forum_title = $row['top_name'];
158 
159  $this->post_id = $row['pos_pk'];
160  $this->post_title = $row['pos_subject'];
161  $this->post_message = $row['pos_message'];
162  $this->post_date = $row['pos_date'];
163  $this->post_update = $row['pos_update'];
164  $this->post_update_user_id = $row['update_user'];
165 
166  $this->post_censored = $row['pos_cens'];
167  $this->post_censored_date = $row['pos_cens_date'];
168  $this->post_censored_comment = $row['pos_cens_com'];
169 
170  $this->pos_usr_alias = $row['pos_usr_alias'];
171  $this->pos_display_user_id = $row['pos_display_user_id'];
172  $this->pos_author_id = $row['pos_author_id'];
173 
174  $this->import_name = strlen($row['import_name']) ? $row['import_name'] : '';
175 
176  if ($notificationCache === null) {
177  $notificationCache = new ilForumNotificationCache();
178  }
179  $this->notificationCache = $notificationCache;
180 
181  if (isset($row['deleted_by'])) {
182  //cron context
183  $this->deleted_by = $row['deleted_by'];
184  } else {
185  // fallback
186  global $DIC;
187  $this->deleted_by = $DIC->user()->getLogin();
188  }
189 
190  $this->read();
191  }
global $DIC
Definition: saml.php:7
Class ilForumNotificationCache.
$row
+ Here is the call graph for this function:

Member Function Documentation

◆ addRecipient()

ilForumCronNotificationDataProvider::addRecipient (   $user_id)
Parameters
int$user_id

Definition at line 220 of file class.ilForumCronNotificationDataProvider.php.

221  {
222  $this->cron_recipients[] = (int) $user_id;
223  }

◆ getAttachments()

ilForumCronNotificationDataProvider::getAttachments ( )
Returns
array file names

Implements ilForumNotificationMailData.

Definition at line 348 of file class.ilForumCronNotificationDataProvider.php.

References $attachments.

◆ getAuthorInformation()

ilForumCronNotificationDataProvider::getAuthorInformation ( \ilLanguage  $lng,
int  $authorUsrId,
int  $displayUserId,
string  $usrAlias,
string  $importName 
)
private
Parameters
ilLanguage$lng
$authorUsrId
$displayUserId
$usrAlias
$importName
Returns

Definition at line 496 of file class.ilForumCronNotificationDataProvider.php.

References ilLanguage\getLangKey().

502  {
503  $cacheKey = $this->notificationCache->createKeyByValues(array(
504  $lng->getLangKey(),
505  (int) $authorUsrId,
506  (int) $displayUserId,
507  (string) $usrAlias,
508  (string) $importName
509  ));
510 
511  if (false === $this->notificationCache->exists($cacheKey)) {
512  $authorInformation = new ilForumAuthorInformation(
513  $authorUsrId,
514  $displayUserId,
515  $usrAlias,
516  $importName,
517  array(),
518  $lng
519  );
520 
521  $this->notificationCache->store($cacheKey, $authorInformation);
522  }
523 
524  return $this->notificationCache->fetch($cacheKey);
525  }
$lng
+ Here is the call graph for this function:

◆ getCensorshipComment()

ilForumCronNotificationDataProvider::getCensorshipComment ( )

◆ getCronRecipients()

ilForumCronNotificationDataProvider::getCronRecipients ( )

◆ getDeletedBy()

ilForumCronNotificationDataProvider::getDeletedBy ( )

◆ getForumId()

ilForumCronNotificationDataProvider::getForumId ( )
Returns
int frm_data.top_pk

Implements ilForumNotificationMailData.

Definition at line 252 of file class.ilForumCronNotificationDataProvider.php.

References $forum_id.

◆ getForumTitle()

ilForumCronNotificationDataProvider::getForumTitle ( )
Returns
string frm_data.top_name

Implements ilForumNotificationMailData.

Definition at line 260 of file class.ilForumCronNotificationDataProvider.php.

References $forum_title.

◆ getImportName()

ilForumCronNotificationDataProvider::getImportName ( )
Returns
string

Definition at line 422 of file class.ilForumCronNotificationDataProvider.php.

References $import_name.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getObjId()

ilForumCronNotificationDataProvider::getObjId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 244 of file class.ilForumCronNotificationDataProvider.php.

References $obj_id.

Referenced by readAttachments().

+ Here is the caller graph for this function:

◆ getPosAuthorId()

ilForumCronNotificationDataProvider::getPosAuthorId ( )
Returns
string frm_posts.pos_author_id

Implements ilForumNotificationMailData.

Definition at line 398 of file class.ilForumCronNotificationDataProvider.php.

References $pos_author_id.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getPosDisplayUserId()

ilForumCronNotificationDataProvider::getPosDisplayUserId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 364 of file class.ilForumCronNotificationDataProvider.php.

References $pos_display_user_id.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getPostCensored()

ilForumCronNotificationDataProvider::getPostCensored ( )
Returns
string frm_posts.pos_cens

Implements ilForumNotificationMailData.

Definition at line 324 of file class.ilForumCronNotificationDataProvider.php.

References $post_censored.

◆ getPostCensoredDate()

ilForumCronNotificationDataProvider::getPostCensoredDate ( )
Returns
string frm_posts.pos_cens_date

Implements ilForumNotificationMailData.

Definition at line 332 of file class.ilForumCronNotificationDataProvider.php.

References $post_censored_date.

◆ getPostDate()

ilForumCronNotificationDataProvider::getPostDate ( )
Returns
string frm_posts.pos_date

Implements ilForumNotificationMailData.

Definition at line 308 of file class.ilForumCronNotificationDataProvider.php.

References $post_date.

◆ getPostId()

ilForumCronNotificationDataProvider::getPostId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 284 of file class.ilForumCronNotificationDataProvider.php.

References $post_id.

Referenced by readAttachments().

+ Here is the caller graph for this function:

◆ getPostMessage()

ilForumCronNotificationDataProvider::getPostMessage ( )
Returns
string frm_posts.pos_message

Implements ilForumNotificationMailData.

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

References $post_message.

◆ getPostTitle()

ilForumCronNotificationDataProvider::getPostTitle ( )
Returns
string frm_posts.pos_subject

Implements ilForumNotificationMailData.

Definition at line 292 of file class.ilForumCronNotificationDataProvider.php.

References $post_title.

◆ getPostUpdate()

ilForumCronNotificationDataProvider::getPostUpdate ( )
Returns
string frm_posts.pos_update

Implements ilForumNotificationMailData.

Definition at line 316 of file class.ilForumCronNotificationDataProvider.php.

References $post_update.

◆ getPostUpdateUserId()

ilForumCronNotificationDataProvider::getPostUpdateUserId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 381 of file class.ilForumCronNotificationDataProvider.php.

References $post_update_user_id.

Referenced by getPostUpdateUserName().

+ Here is the caller graph for this function:

◆ getPostUpdateUserName()

ilForumCronNotificationDataProvider::getPostUpdateUserName ( \ilLanguage  $user_lang)

Parameters
\ilLanguage$user_lang
Returns
string

Implements ilForumNotificationMailData.

Definition at line 448 of file class.ilForumCronNotificationDataProvider.php.

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

449  {
450  if ($this->update_user_name === null) {
451  $this->update_user_name = $this->getPublicUserInformation(self::getAuthorInformation(
452  $user_lang,
453  (int) $this->getPosAuthorId(),
454  (int) $this->getPostUpdateUserId(),
455  (string) $this->getPosUserAlias(),
456  (string) $this->getImportName()
457  ));
458  }
459 
460  // Possible Fix for #25432
461  if (
462  $this->getPosUserAlias() && $this->getPosDisplayUserId() == 0 &&
463  $this->getPosAuthorId() == $this->getPostUpdateUserId()
464  ) {
465  return (string) $this->getPosUserAlias();
466  }
467 
468  return (string) $this->update_user_name;
469  }
getPublicUserInformation(ilForumAuthorInformation $authorinfo)
+ Here is the call graph for this function:

◆ getPostUserName()

ilForumCronNotificationDataProvider::getPostUserName ( \ilLanguage  $user_lang)

Parameters
\ilLanguage$user_lang
Returns
string

Implements ilForumNotificationMailData.

Definition at line 430 of file class.ilForumCronNotificationDataProvider.php.

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

431  {
432  if ($this->post_user_name === null) {
433  $this->post_user_name = $this->getPublicUserInformation(self::getAuthorInformation(
434  $user_lang,
435  (int) $this->getPosAuthorId(),
436  (int) $this->getPosDisplayUserId(),
437  (string) $this->getPosUserAlias(),
438  (string) $this->getImportName()
439  ));
440  }
441 
442  return $this->post_user_name;
443  }
getPublicUserInformation(ilForumAuthorInformation $authorinfo)
+ Here is the call graph for this function:

◆ getPosUserAlias()

ilForumCronNotificationDataProvider::getPosUserAlias ( )
Returns
string frm_posts.pos_usr_alias

Implements ilForumNotificationMailData.

Definition at line 373 of file class.ilForumCronNotificationDataProvider.php.

References $pos_usr_alias.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getPublicUserInformation()

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

Definition at line 475 of file class.ilForumCronNotificationDataProvider.php.

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

Referenced by getPostUpdateUserName(), and getPostUserName().

476  {
477  $publicName = $authorinfo->getAuthorShortName();
478 
479  if ($authorinfo->hasSuffix()) {
480  $publicName = $authorinfo->getAuthorName();
481  } elseif ($authorinfo->getAuthorName() && !$this->isAnonymized()) {
482  $publicName = $authorinfo->getAuthorName();
483  }
484 
485  return $publicName;
486  }
getAuthorName($without_short_name=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefId()

ilForumCronNotificationDataProvider::getRefId ( )

◆ getThreadId()

ilForumCronNotificationDataProvider::getThreadId ( )

◆ getThreadTitle()

ilForumCronNotificationDataProvider::getThreadTitle ( )
Returns
string frm_threads.thr_subject

Implements ilForumNotificationMailData.

Definition at line 276 of file class.ilForumCronNotificationDataProvider.php.

References $thread_title.

◆ isAnonymized()

ilForumCronNotificationDataProvider::isAnonymized ( )
Returns
bool

Definition at line 406 of file class.ilForumCronNotificationDataProvider.php.

References $is_anonymized.

Referenced by getPublicUserInformation().

+ Here is the caller graph for this function:

◆ read()

ilForumCronNotificationDataProvider::read ( )
protected

Definition at line 196 of file class.ilForumCronNotificationDataProvider.php.

References readAttachments().

Referenced by __construct().

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

◆ readAttachments()

ilForumCronNotificationDataProvider::readAttachments ( )
private

Definition at line 204 of file class.ilForumCronNotificationDataProvider.php.

References getObjId(), getPostId(), and ilForumProperties\isSendAttachmentsByMailEnabled().

Referenced by read().

205  {
207  // get attachments
208  $fileDataForum = new ilFileDataForum($this->getObjId(), $this->getPostId());
209  $filesOfPost = $fileDataForum->getFilesOfPost();
210 
211  foreach ($filesOfPost as $attachment) {
212  $this->attachments[] = $attachment['name'];
213  }
214  }
215  }
This class handles all operations on files for the forum object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNotificationType()

ilForumCronNotificationDataProvider::setNotificationType (   $notification_type)
Parameters
null$notification_type

Definition at line 356 of file class.ilForumCronNotificationDataProvider.php.

References $notification_type.

357  {
358  $this->notification_type = $notification_type;
359  }

◆ setPosAuthorId()

ilForumCronNotificationDataProvider::setPosAuthorId (   $pos_author_id)

Definition at line 394 of file class.ilForumCronNotificationDataProvider.php.

References $pos_author_id.

◆ setPostUpdateUserId()

ilForumCronNotificationDataProvider::setPostUpdateUserId (   $post_update_user_id)
Parameters
int$post_update_user_id

Definition at line 389 of file class.ilForumCronNotificationDataProvider.php.

References $post_update_user_id.

390  {
391  $this->post_update_user_id = $post_update_user_id;
392  }

Field Documentation

◆ $attachments

array ilForumCronNotificationDataProvider::$attachments = array()
protected

Definition at line 102 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getAttachments().

◆ $authorInformationCache

ilForumCronNotificationDataProvider::$authorInformationCache = array()
staticprotected

◆ $cron_recipients

ilForumCronNotificationDataProvider::$cron_recipients = array()
protected

Definition at line 107 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getCronRecipients().

◆ $deleted_by

ilForumCronNotificationDataProvider::$deleted_by = ''

Definition at line 127 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getDeletedBy().

◆ $forum_id

ilForumCronNotificationDataProvider::$forum_id = 0
protected

Definition at line 29 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getForumId().

◆ $forum_title

string ilForumCronNotificationDataProvider::$forum_title = ''
protected

Definition at line 34 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getForumTitle().

◆ $import_name

ilForumCronNotificationDataProvider::$import_name = ''
protected

Definition at line 97 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getImportName().

◆ $is_anonymized

ilForumCronNotificationDataProvider::$is_anonymized = false
protected

Definition at line 92 of file class.ilForumCronNotificationDataProvider.php.

Referenced by isAnonymized().

◆ $notification_type

ilForumCronNotificationDataProvider::$notification_type = null

Definition at line 14 of file class.ilForumCronNotificationDataProvider.php.

Referenced by setNotificationType().

◆ $notificationCache

ilForumCronNotificationDataProvider::$notificationCache
private

Definition at line 142 of file class.ilForumCronNotificationDataProvider.php.

Referenced by __construct().

◆ $obj_id

int ilForumCronNotificationDataProvider::$obj_id = 0
protected

Definition at line 24 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getObjId().

◆ $objPost

ilForumCronNotificationDataProvider::$objPost = null

◆ $pos_author_id

ilForumCronNotificationDataProvider::$pos_author_id = 0

◆ $pos_display_user_id

ilForumCronNotificationDataProvider::$pos_display_user_id = 0
protected

Definition at line 87 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPosDisplayUserId().

◆ $pos_usr_alias

ilForumCronNotificationDataProvider::$pos_usr_alias = ''
protected

Definition at line 83 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPosUserAlias().

◆ $post_censored

ilForumCronNotificationDataProvider::$post_censored = false
protected

Definition at line 70 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPostCensored().

◆ $post_censored_comment

ilForumCronNotificationDataProvider::$post_censored_comment = ''
protected

Definition at line 78 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getCensorshipComment().

◆ $post_censored_date

ilForumCronNotificationDataProvider::$post_censored_date = null
protected

Definition at line 74 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPostCensoredDate().

◆ $post_date

ilForumCronNotificationDataProvider::$post_date = null
protected

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

Referenced by getPostDate().

◆ $post_id

ilForumCronNotificationDataProvider::$post_id = 0
protected

Definition at line 49 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPostId().

◆ $post_message

ilForumCronNotificationDataProvider::$post_message = ''
protected

Definition at line 57 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPostMessage().

◆ $post_title

ilForumCronNotificationDataProvider::$post_title = ''
protected

Definition at line 53 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPostTitle().

◆ $post_update

ilForumCronNotificationDataProvider::$post_update = null
protected

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

Referenced by getPostUpdate().

◆ $post_update_user_id

ilForumCronNotificationDataProvider::$post_update_user_id = 0

◆ $post_user_name

ilForumCronNotificationDataProvider::$post_user_name = null
private

Definition at line 136 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPostUserName().

◆ $ref_id

int ilForumCronNotificationDataProvider::$ref_id = 0
protected

Definition at line 19 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getRefId().

◆ $thread_id

ilForumCronNotificationDataProvider::$thread_id = 0
protected

Definition at line 39 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getThreadId().

◆ $thread_title

string ilForumCronNotificationDataProvider::$thread_title = ''
protected

Definition at line 44 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getThreadTitle().

◆ $update_user_name

ilForumCronNotificationDataProvider::$update_user_name = null
private

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