ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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)
 
 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 ()
 
 getDeletedBy ()
 

Data Fields

 $notification_type = 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 143 of file class.ilForumCronNotificationDataProvider.php.

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addRecipient()

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

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

216 {
217 $this->cron_recipients[] = (int) $user_id;
218 }

◆ getAttachments()

ilForumCronNotificationDataProvider::getAttachments ( )

◆ getAuthorInformation()

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

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

495 {
496 $cacheKey = $this->notificationCache->createKeyByValues(array(
497 $lng->getLangKey(),
498 (int) $authorUsrId,
499 (int) $displayUserId,
500 (string) $usrAlias,
501 (string) $importName
502 ));
503
504 if (false === $this->notificationCache->exists($cacheKey)) {
505 $authorInformation = new ilForumAuthorInformation(
506 $authorUsrId,
507 $displayUserId,
508 $usrAlias,
509 $importName,
510 array(),
511 $lng
512 );
513
514 $this->notificationCache->store($cacheKey, $authorInformation);
515 }
516
517 return $this->notificationCache->fetch($cacheKey);
518 }
$lng

References $lng.

◆ getCensorshipComment()

ilForumCronNotificationDataProvider::getCensorshipComment ( )

◆ getCronRecipients()

ilForumCronNotificationDataProvider::getCronRecipients ( )

◆ getDeletedBy()

ilForumCronNotificationDataProvider::getDeletedBy ( )

◆ getForumId()

ilForumCronNotificationDataProvider::getForumId ( )
Returns
int frm_data.top_pk

Implements ilForumNotificationMailData.

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

References $forum_id.

◆ getForumTitle()

ilForumCronNotificationDataProvider::getForumTitle ( )
Returns
string frm_data.top_name

Implements ilForumNotificationMailData.

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

References $forum_title.

◆ getImportName()

ilForumCronNotificationDataProvider::getImportName ( )
Returns
string

Definition at line 417 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 239 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 393 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 359 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 319 of file class.ilForumCronNotificationDataProvider.php.

References $post_censored.

◆ getPostCensoredDate()

ilForumCronNotificationDataProvider::getPostCensoredDate ( )
Returns
string frm_posts.pos_cens_date

Implements ilForumNotificationMailData.

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

References $post_censored_date.

◆ getPostDate()

ilForumCronNotificationDataProvider::getPostDate ( )
Returns
string frm_posts.pos_date

Implements ilForumNotificationMailData.

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

References $post_date.

◆ getPostId()

ilForumCronNotificationDataProvider::getPostId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 279 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 295 of file class.ilForumCronNotificationDataProvider.php.

References $post_message.

◆ getPostTitle()

ilForumCronNotificationDataProvider::getPostTitle ( )
Returns
string frm_posts.pos_subject

Implements ilForumNotificationMailData.

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

References $post_title.

◆ getPostUpdate()

ilForumCronNotificationDataProvider::getPostUpdate ( )
Returns
string frm_posts.pos_update

Implements ilForumNotificationMailData.

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

References $post_update.

◆ getPostUpdateUserId()

ilForumCronNotificationDataProvider::getPostUpdateUserId ( )
Returns
int

Implements ilForumNotificationMailData.

Definition at line 376 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 443 of file class.ilForumCronNotificationDataProvider.php.

444 {
445 if ($this->update_user_name === null) {
446 $this->update_user_name = $this->getPublicUserInformation(self::getAuthorInformation(
447 $user_lang,
448 (int) $this->getPosAuthorId(),
449 (int) $this->getPostUpdateUserId(),
450 (string) $this->getPosUserAlias(),
451 (string) $this->getImportName()
452 ));
453 }
454
455 // Fix for #25432
456 if ($this->getPosUserAlias() && $this->getPosDisplayUserId() == 0
457 && $this->getPosAuthorId() == $this->getPostUpdateUserId()) {
458 return (string) $this->getPosUserAlias();
459 }
460
461 return (string) $this->update_user_name;
462 }
getPublicUserInformation(ilForumAuthorInformation $authorinfo)

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

+ 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 425 of file class.ilForumCronNotificationDataProvider.php.

426 {
427 if ($this->post_user_name === null) {
428 $this->post_user_name = $this->getPublicUserInformation(self::getAuthorInformation(
429 $user_lang,
430 (int) $this->getPosAuthorId(),
431 (int) $this->getPosDisplayUserId(),
432 (string) $this->getPosUserAlias(),
433 (string) $this->getImportName()
434 ));
435 }
436
438 }

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

+ Here is the call graph for this function:

◆ getPosUserAlias()

ilForumCronNotificationDataProvider::getPosUserAlias ( )
Returns
string frm_posts.pos_usr_alias

Implements ilForumNotificationMailData.

Definition at line 368 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 468 of file class.ilForumCronNotificationDataProvider.php.

469 {
470 $publicName = $authorinfo->getAuthorShortName();
471
472 if ($authorinfo->hasSuffix()) {
473 $publicName = $authorinfo->getAuthorName();
474 } elseif ($authorinfo->getAuthorName() && !$this->isAnonymized()) {
475 $publicName = $authorinfo->getAuthorName();
476 }
477
478 return $publicName;
479 }
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()

ilForumCronNotificationDataProvider::getRefId ( )

◆ getThreadId()

ilForumCronNotificationDataProvider::getThreadId ( )

◆ getThreadTitle()

ilForumCronNotificationDataProvider::getThreadTitle ( )
Returns
string frm_threads.thr_subject

Implements ilForumNotificationMailData.

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

References $thread_title.

◆ isAnonymized()

ilForumCronNotificationDataProvider::isAnonymized ( )

◆ read()

ilForumCronNotificationDataProvider::read ( )
protected

Definition at line 191 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 199 of file class.ilForumCronNotificationDataProvider.php.

200 {
202 // get attachments
203 $fileDataForum = new ilFileDataForum($this->getObjId(), $this->getPostId());
204 $filesOfPost = $fileDataForum->getFilesOfPost();
205
206 foreach ($filesOfPost as $attachment) {
207 $this->attachments[] = $attachment['name'];
208 }
209 }
210 }
This class handles all operations on files for the forum object.

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

Referenced by read().

+ 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 351 of file class.ilForumCronNotificationDataProvider.php.

References $notification_type.

◆ setPosAuthorId()

ilForumCronNotificationDataProvider::setPosAuthorId (   $pos_author_id)

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

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

References $pos_author_id.

◆ setPostUpdateUserId()

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

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

385 {
386 $this->post_update_user_id = $post_update_user_id;
387 }

References $post_update_user_id.

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 122 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 137 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().

◆ $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

string null ilForumCronNotificationDataProvider::$post_user_name = null
private

Definition at line 131 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: