ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 
 closestContainer ()
 
 providesClosestContainer ()
 
 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 ()
 
 closestContainer ()
 
 providesClosestContainer ()
 
 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

 $closest_container = null
 
 $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 146 of file class.ilForumCronNotificationDataProvider.php.

147 {
148 $this->obj_id = $row['obj_id'];
149 $this->ref_id = $row['ref_id'];
150
151 $this->closest_container = $row['closest_container'];
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) {
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 }
Class ilForumNotificationCache.
global $DIC
Definition: goto.php:24

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

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

◆ closestContainer()

ilForumCronNotificationDataProvider::closestContainer ( )
Returns
ilObjCourse|ilObjGroup|null

Implements ilForumNotificationMailData.

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

257 : ?ilObject
258 {
260 }
Class ilObject Basic functions for all objects.

References $closest_container.

◆ 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 504 of file class.ilForumCronNotificationDataProvider.php.

510 {
511 $cacheKey = $this->notificationCache->createKeyByValues(array(
512 $lng->getLangKey(),
513 (int) $authorUsrId,
514 (int) $displayUserId,
515 (string) $usrAlias,
516 (string) $importName
517 ));
518
519 if (false === $this->notificationCache->exists($cacheKey)) {
520 $authorInformation = new ilForumAuthorInformation(
521 $authorUsrId,
522 $displayUserId,
523 $usrAlias,
524 $importName,
525 array(),
526 $lng
527 );
528
529 $this->notificationCache->store($cacheKey, $authorInformation);
530 }
531
532 return $this->notificationCache->fetch($cacheKey);
533 }
$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 252 of file class.ilForumCronNotificationDataProvider.php.

References $forum_id.

◆ getForumTitle()

ilForumCronNotificationDataProvider::getForumTitle ( )
Returns
string frm_data.top_name

Implements ilForumNotificationMailData.

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

References $forum_title.

◆ getImportName()

ilForumCronNotificationDataProvider::getImportName ( )
Returns
string

Definition at line 432 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 408 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 374 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 334 of file class.ilForumCronNotificationDataProvider.php.

References $post_censored.

◆ getPostCensoredDate()

ilForumCronNotificationDataProvider::getPostCensoredDate ( )
Returns
string frm_posts.pos_cens_date

Implements ilForumNotificationMailData.

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

References $post_censored_date.

◆ getPostDate()

ilForumCronNotificationDataProvider::getPostDate ( )
Returns
string frm_posts.pos_date

Implements ilForumNotificationMailData.

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

References $post_date.

◆ getPostId()

ilForumCronNotificationDataProvider::getPostId ( )
Returns
int

Implements ilForumNotificationMailData.

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

References $post_message.

◆ getPostTitle()

ilForumCronNotificationDataProvider::getPostTitle ( )
Returns
string frm_posts.pos_subject

Implements ilForumNotificationMailData.

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

References $post_title.

◆ getPostUpdate()

ilForumCronNotificationDataProvider::getPostUpdate ( )
Returns
string frm_posts.pos_update

Implements ilForumNotificationMailData.

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

References $post_update.

◆ getPostUpdateUserId()

ilForumCronNotificationDataProvider::getPostUpdateUserId ( )
Returns
int

Implements ilForumNotificationMailData.

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

459 {
460 if ($this->update_user_name === null) {
461 $this->update_user_name = $this->getPublicUserInformation(self::getAuthorInformation(
462 $user_lang,
463 (int) $this->getPosAuthorId(),
464 (int) $this->getPostUpdateUserId(),
465 (string) $this->getPosUserAlias(),
466 (string) $this->getImportName()
467 ));
468 }
469
470 // Fix for #25432
471 if ($this->getPosUserAlias() && $this->getPosDisplayUserId() == 0
472 && $this->getPosAuthorId() == $this->getPostUpdateUserId()) {
473 return (string) $this->getPosUserAlias();
474 }
475
476 return (string) $this->update_user_name;
477 }
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 440 of file class.ilForumCronNotificationDataProvider.php.

441 {
442 if ($this->post_user_name === null) {
443 $this->post_user_name = $this->getPublicUserInformation(self::getAuthorInformation(
444 $user_lang,
445 (int) $this->getPosAuthorId(),
446 (int) $this->getPosDisplayUserId(),
447 (string) $this->getPosUserAlias(),
448 (string) $this->getImportName()
449 ));
450 }
451
453 }

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 383 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 483 of file class.ilForumCronNotificationDataProvider.php.

484 {
485 $publicName = $authorinfo->getAuthorShortName();
486
487 if ($authorinfo->hasSuffix()) {
488 $publicName = $authorinfo->getAuthorName();
489 } elseif ($authorinfo->getAuthorName() && !$this->isAnonymized()) {
490 $publicName = $authorinfo->getAuthorName();
491 }
492
493 return $publicName;
494 }
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 286 of file class.ilForumCronNotificationDataProvider.php.

References $thread_title.

◆ isAnonymized()

ilForumCronNotificationDataProvider::isAnonymized ( )

◆ providesClosestContainer()

ilForumCronNotificationDataProvider::providesClosestContainer ( )

Implements ilForumNotificationMailData.

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

262 : bool
263 {
264 return $this->closest_container !== null;
265 }

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

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.

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

References $notification_type.

◆ setPosAuthorId()

ilForumCronNotificationDataProvider::setPosAuthorId (   $pos_author_id)

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

405 {
406 $this->pos_author_id = $pos_author_id;
407 }

References $pos_author_id.

◆ setPostUpdateUserId()

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

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

400 {
401 $this->post_update_user_id = $post_update_user_id;
402 }

References $post_update_user_id.

Field Documentation

◆ $attachments

array ilForumCronNotificationDataProvider::$attachments = array()
protected

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

Referenced by getAttachments().

◆ $authorInformationCache

ilForumCronNotificationDataProvider::$authorInformationCache = array()
staticprotected

◆ $closest_container

ilForumCronNotificationDataProvider::$closest_container = null
private

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

Referenced by closestContainer().

◆ $cron_recipients

ilForumCronNotificationDataProvider::$cron_recipients = array()
protected

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

Referenced by getCronRecipients().

◆ $deleted_by

ilForumCronNotificationDataProvider::$deleted_by = ''

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

Referenced by getForumTitle().

◆ $import_name

ilForumCronNotificationDataProvider::$import_name = ''
protected

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

Referenced by getImportName().

◆ $is_anonymized

ilForumCronNotificationDataProvider::$is_anonymized = false
protected

Definition at line 95 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 140 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 90 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getPosDisplayUserId().

◆ $pos_usr_alias

ilForumCronNotificationDataProvider::$pos_usr_alias = ''
protected

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

Referenced by getPosUserAlias().

◆ $post_censored

ilForumCronNotificationDataProvider::$post_censored = false
protected

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

Referenced by getPostCensored().

◆ $post_censored_comment

ilForumCronNotificationDataProvider::$post_censored_comment = ''
protected

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

Referenced by getCensorshipComment().

◆ $post_censored_date

ilForumCronNotificationDataProvider::$post_censored_date = null
protected

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

Referenced by getPostCensoredDate().

◆ $post_date

ilForumCronNotificationDataProvider::$post_date = null
protected

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

Referenced by getPostDate().

◆ $post_id

ilForumCronNotificationDataProvider::$post_id = 0
protected

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

Referenced by getPostId().

◆ $post_message

ilForumCronNotificationDataProvider::$post_message = ''
protected

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

Referenced by getPostMessage().

◆ $post_title

ilForumCronNotificationDataProvider::$post_title = ''
protected

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

Referenced by getPostTitle().

◆ $post_update

ilForumCronNotificationDataProvider::$post_update = null
protected

Definition at line 68 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 134 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 42 of file class.ilForumCronNotificationDataProvider.php.

Referenced by getThreadId().

◆ $thread_title

string ilForumCronNotificationDataProvider::$thread_title = ''
protected

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