ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilForumCronNotificationDataProvider Class Reference

Class ilForumCronNotificationDataProvider. More...

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

Public Member Functions

 __construct (array $row, int $notification_type, ilForumNotificationCache $notificationCache=null)
 
 addRecipient (int $user_id)
 
 getCronRecipients ()
 
 getRefId ()
 
 getObjId ()
 
 getForumId ()
 
 closestContainer ()
 
 providesClosestContainer ()
 
 getForumTitle ()
 
 getThreadId ()
 
 getThreadTitle ()
 
 getPostId ()
 
 getPostTitle ()
 
 getPostMessage ()
 
 getPostDate ()
 
 getPostUpdate ()
 
 isPostCensored ()
 
 getPostCensoredDate ()
 
 getCensorshipComment ()
 
 getAttachments ()
 
 setNotificationType (int $notification_type)
 
 getPosDisplayUserId ()
 
 getPosUserAlias ()
 
 getPostUpdateUserId ()
 
 setPostUpdateUserId (int $post_update_user_id)
 
 setPosAuthorId (int $pos_author_id)
 
 getPosAuthorId ()
 
 isAnonymized ()
 
 getDeletedBy ()
 
 getImportName ()
 
 getPostUserName (ilLanguage $user_lang)
 
 getPostUpdateUserName (ilLanguage $user_lang)
 
 getPublicUserInformation (ilForumAuthorInformation $authorinfo)
 

Protected Member Functions

 read ()
 

Private Member Functions

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

Private Attributes

int $notification_type = null
 
int $ref_id
 
int $obj_id
 
int $forum_id
 
string $forum_title
 
ilObject $closest_container = null
 
int $thread_id
 
string $thread_title
 
int $post_id
 
string $post_title
 
string $post_message
 
string $post_date = null
 
string $post_update = null
 
bool $post_censored
 
string $post_censored_date = null
 
string $post_censored_comment
 
string $pos_usr_alias
 
int $pos_display_user_id
 
bool $is_anonymized = false
 
string $import_name
 
array $attachments = []
 
array $cron_recipients = []
 
int $post_update_user_id
 
int $pos_author_id
 
string $deleted_by = ''
 
string $post_user_name = null
 
string $update_user_name = null
 
ilForumNotificationCache $notificationCache
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumCronNotificationDataProvider::__construct ( array  $row,
int  $notification_type,
ilForumNotificationCache  $notificationCache = null 
)

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

References $DIC, $notification_type, $notificationCache, ILIAS\Repository\int(), and read().

59  {
60  $this->notification_type = $notification_type;
61  $this->obj_id = (int) $row['obj_id'];
62  $this->ref_id = (int) $row['ref_id'];
63  $this->closest_container = $row['closest_container'];
64  $this->obj_id = (int) $row['obj_id'];
65  $this->ref_id = (int) ($row['ref_id'] ?? 0);
66  $this->thread_id = (int) ($row['thread_id'] ?? 0);
67  $this->thread_title = $row['thr_subject'];
68  $this->forum_id = (int) ($row['pos_top_fk'] ?? 0);
69  $this->forum_title = $row['top_name'];
70  $this->post_id = (int) ($row['pos_pk'] ?? 0);
71  $this->post_title = $row['pos_subject'];
72  $this->post_message = $row['pos_message'];
73  $this->post_date = $row['pos_date'];
74  $this->post_update = $row['pos_update'] ?? null;
75  $this->post_update_user_id = (int) ($row['update_user'] ?? 0);
76  $this->post_censored = (bool) ($row['pos_cens'] ?? false);
77  $this->post_censored_date = $row['pos_cens_date'] ?? null;
78  $this->post_censored_comment = $row['pos_cens_com'] ?? null;
79  $this->pos_usr_alias = $row['pos_usr_alias'] ?? '';
80  $this->pos_display_user_id = (int) ($row['pos_display_user_id'] ?? 0);
81  $this->pos_author_id = (int) ($row['pos_author_id'] ?? 0);
82  $this->import_name = $row['import_name'] ?? '';
83 
84  if ($notificationCache === null) {
85  $notificationCache = new ilForumNotificationCache();
86  }
87  $this->notificationCache = $notificationCache;
88 
89  if (isset($row['deleted_by'])) {
90  //cron context
91  $this->deleted_by = $row['deleted_by'];
92  } else {
93  // fallback
94  global $DIC;
95  $this->deleted_by = $DIC->user()->getLogin();
96  }
97 
98  $this->read();
99  }
global $DIC
Definition: feed.php:28
Class ilForumNotificationCache.
+ Here is the call graph for this function:

Member Function Documentation

◆ addRecipient()

ilForumCronNotificationDataProvider::addRecipient ( int  $user_id)

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

118  : void
119  {
120  $this->cron_recipients[] = $user_id;
121  }

◆ closestContainer()

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

Implements ilForumNotificationMailData.

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

References $closest_container.

◆ getAttachments()

ilForumCronNotificationDataProvider::getAttachments ( )

◆ getAuthorInformation()

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

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

References ilLanguage\getLangKey().

Referenced by getPostUpdateUserName(), and getPostUserName().

324  $cacheKey = $this->notificationCache->createKeyByValues([
325  $this->notification_type,
326  $lng->getLangKey(),
327  $authorUsrId,
328  $displayUserId,
329  $usrAlias,
330  $importName
331  ]);
332 
333  if (false === $this->notificationCache->exists($cacheKey)) {
334  $authorInformation = new ilForumAuthorInformation(
335  $authorUsrId,
336  $displayUserId,
337  $usrAlias,
338  $importName,
339  [],
340  $lng
341  );
342 
343  $this->notificationCache->store($cacheKey, $authorInformation);
344  }
345 
346  return $this->notificationCache->fetch($cacheKey);
347  }
getLangKey()
Return lang key.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCensorshipComment()

ilForumCronNotificationDataProvider::getCensorshipComment ( )

◆ getCronRecipients()

ilForumCronNotificationDataProvider::getCronRecipients ( )
Returns
int[]

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

References $cron_recipients.

◆ getDeletedBy()

ilForumCronNotificationDataProvider::getDeletedBy ( )

Implements ilForumNotificationMailData.

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

References $deleted_by.

256  : string
257  {
258  return $this->deleted_by;
259  }

◆ getForumId()

ilForumCronNotificationDataProvider::getForumId ( )

◆ getForumTitle()

ilForumCronNotificationDataProvider::getForumTitle ( )

Implements ilForumNotificationMailData.

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

References $forum_title.

156  : string
157  {
158  return $this->forum_title;
159  }

◆ getImportName()

ilForumCronNotificationDataProvider::getImportName ( )

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

References $import_name.

Referenced by getPostUpdateUserName(), and getPostUserName().

261  : string
262  {
263  return $this->import_name;
264  }
+ Here is the caller graph for this function:

◆ getObjId()

ilForumCronNotificationDataProvider::getObjId ( )

Implements ilForumNotificationMailData.

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

References $obj_id.

Referenced by readAttachments().

+ Here is the caller graph for this function:

◆ getPosAuthorId()

ilForumCronNotificationDataProvider::getPosAuthorId ( )

Implements ilForumNotificationMailData.

Definition at line 246 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 ( )

Implements ilForumNotificationMailData.

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

References $pos_display_user_id.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getPostCensoredDate()

ilForumCronNotificationDataProvider::getPostCensoredDate ( )

Implements ilForumNotificationMailData.

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

201  : string
202  {
203  return $this->post_censored_date ?? '';
204  }

◆ getPostDate()

ilForumCronNotificationDataProvider::getPostDate ( )

Implements ilForumNotificationMailData.

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

References $post_date.

186  : string
187  {
188  return $this->post_date;
189  }

◆ getPostId()

ilForumCronNotificationDataProvider::getPostId ( )

Implements ilForumNotificationMailData.

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

References $post_id.

Referenced by readAttachments().

+ Here is the caller graph for this function:

◆ getPostMessage()

ilForumCronNotificationDataProvider::getPostMessage ( )

◆ getPostTitle()

ilForumCronNotificationDataProvider::getPostTitle ( )

Implements ilForumNotificationMailData.

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

References $post_title.

176  : string
177  {
178  return $this->post_title;
179  }

◆ getPostUpdate()

ilForumCronNotificationDataProvider::getPostUpdate ( )

Implements ilForumNotificationMailData.

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

191  : string
192  {
193  return $this->post_update ?? '';
194  }

◆ getPostUpdateUserId()

ilForumCronNotificationDataProvider::getPostUpdateUserId ( )

Implements ilForumNotificationMailData.

Definition at line 231 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)

Implements ilForumNotificationMailData.

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

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

281  : string
282  {
283  if ($this->update_user_name === null) {
284  $this->update_user_name = $this->getPublicUserInformation($this->getAuthorInformation(
285  $user_lang,
286  $this->getPosAuthorId(),
287  $this->getPostUpdateUserId(),
288  $this->getPosUserAlias(),
289  $this->getImportName()
290  ));
291  }
292 
293  // Fix for #25432
294  if (
295  $this->getPosUserAlias() && $this->getPosDisplayUserId() === 0 &&
296  $this->getPosAuthorId() === $this->getPostUpdateUserId()
297  ) {
298  return $this->getPosUserAlias();
299  }
300 
301  return (string) $this->update_user_name;
302  }
getPublicUserInformation(ilForumAuthorInformation $authorinfo)
getAuthorInformation(ilLanguage $lng, int $authorUsrId, int $displayUserId, string $usrAlias, string $importName)
+ Here is the call graph for this function:

◆ getPostUserName()

ilForumCronNotificationDataProvider::getPostUserName ( ilLanguage  $user_lang)

Implements ilForumNotificationMailData.

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

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

266  : string
267  {
268  if ($this->post_user_name === null) {
269  $this->post_user_name = $this->getPublicUserInformation($this->getAuthorInformation(
270  $user_lang,
271  $this->getPosAuthorId(),
272  $this->getPosDisplayUserId(),
273  $this->getPosUserAlias(),
274  $this->getImportName()
275  ));
276  }
277 
278  return (string) $this->post_user_name;
279  }
getPublicUserInformation(ilForumAuthorInformation $authorinfo)
getAuthorInformation(ilLanguage $lng, int $authorUsrId, int $displayUserId, string $usrAlias, string $importName)
+ Here is the call graph for this function:

◆ getPosUserAlias()

ilForumCronNotificationDataProvider::getPosUserAlias ( )

Implements ilForumNotificationMailData.

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

References $pos_usr_alias.

Referenced by getPostUpdateUserName(), and getPostUserName().

226  : string
227  {
228  return $this->pos_usr_alias;
229  }
+ Here is the caller graph for this function:

◆ getPublicUserInformation()

ilForumCronNotificationDataProvider::getPublicUserInformation ( ilForumAuthorInformation  $authorinfo)

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

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

Referenced by getPostUpdateUserName(), and getPostUserName().

304  : string
305  {
306  $publicName = $authorinfo->getAuthorShortName();
307 
308  if ($authorinfo->hasSuffix()) {
309  $publicName = $authorinfo->getAuthorName();
310  } elseif ($authorinfo->getAuthorName() && !$this->isAnonymized()) {
311  $publicName = $authorinfo->getAuthorName();
312  }
313 
314  return $publicName;
315  }
getAuthorName(bool $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 ( )

◆ isAnonymized()

ilForumCronNotificationDataProvider::isAnonymized ( )

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

References $is_anonymized.

Referenced by getPublicUserInformation().

+ Here is the caller graph for this function:

◆ isPostCensored()

ilForumCronNotificationDataProvider::isPostCensored ( )

◆ providesClosestContainer()

ilForumCronNotificationDataProvider::providesClosestContainer ( )

Implements ilForumNotificationMailData.

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

151  : bool
152  {
153  return $this->closest_container !== null;
154  }

◆ read()

ilForumCronNotificationDataProvider::read ( )
protected

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

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

Referenced by read().

106  : void
107  {
109  $fileDataForum = new ilFileDataForum($this->getObjId(), $this->getPostId());
110  $filesOfPost = $fileDataForum->getFilesOfPost();
111 
112  foreach ($filesOfPost as $attachment) {
113  $this->attachments[] = $attachment['name'];
114  }
115  }
116  }
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 ( int  $notification_type)

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

References $notification_type.

216  : void
217  {
218  $this->notification_type = $notification_type;
219  }

◆ setPosAuthorId()

ilForumCronNotificationDataProvider::setPosAuthorId ( int  $pos_author_id)

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

References $pos_author_id.

241  : void
242  {
243  $this->pos_author_id = $pos_author_id;
244  }

◆ setPostUpdateUserId()

ilForumCronNotificationDataProvider::setPostUpdateUserId ( int  $post_update_user_id)

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

References $post_update_user_id.

236  : void
237  {
238  $this->post_update_user_id = $post_update_user_id;
239  }

Field Documentation

◆ $attachments

array ilForumCronNotificationDataProvider::$attachments = []
private

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

Referenced by getAttachments().

◆ $closest_container

ilObject ilForumCronNotificationDataProvider::$closest_container = null
private

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

Referenced by closestContainer().

◆ $cron_recipients

array ilForumCronNotificationDataProvider::$cron_recipients = []
private

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

Referenced by getCronRecipients().

◆ $deleted_by

string ilForumCronNotificationDataProvider::$deleted_by = ''
private

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

Referenced by getDeletedBy().

◆ $forum_id

int ilForumCronNotificationDataProvider::$forum_id
private

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

Referenced by getForumId().

◆ $forum_title

string ilForumCronNotificationDataProvider::$forum_title
private

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

Referenced by getForumTitle().

◆ $import_name

string ilForumCronNotificationDataProvider::$import_name
private

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

Referenced by getImportName().

◆ $is_anonymized

bool ilForumCronNotificationDataProvider::$is_anonymized = false
private

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

Referenced by isAnonymized().

◆ $notification_type

int ilForumCronNotificationDataProvider::$notification_type = null
private

◆ $notificationCache

ilForumNotificationCache ilForumCronNotificationDataProvider::$notificationCache
private

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

Referenced by __construct().

◆ $obj_id

int ilForumCronNotificationDataProvider::$obj_id
private

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

Referenced by getObjId().

◆ $pos_author_id

int ilForumCronNotificationDataProvider::$pos_author_id
private

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

Referenced by getPosAuthorId(), and setPosAuthorId().

◆ $pos_display_user_id

int ilForumCronNotificationDataProvider::$pos_display_user_id
private

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

Referenced by getPosDisplayUserId().

◆ $pos_usr_alias

string ilForumCronNotificationDataProvider::$pos_usr_alias
private

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

Referenced by getPosUserAlias().

◆ $post_censored

bool ilForumCronNotificationDataProvider::$post_censored
private

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

Referenced by isPostCensored().

◆ $post_censored_comment

string ilForumCronNotificationDataProvider::$post_censored_comment
private

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

Referenced by getCensorshipComment().

◆ $post_censored_date

string ilForumCronNotificationDataProvider::$post_censored_date = null
private

◆ $post_date

string ilForumCronNotificationDataProvider::$post_date = null
private

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

Referenced by getPostDate().

◆ $post_id

int ilForumCronNotificationDataProvider::$post_id
private

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

Referenced by getPostId().

◆ $post_message

string ilForumCronNotificationDataProvider::$post_message
private

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

Referenced by getPostMessage().

◆ $post_title

string ilForumCronNotificationDataProvider::$post_title
private

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

Referenced by getPostTitle().

◆ $post_update

string ilForumCronNotificationDataProvider::$post_update = null
private

◆ $post_update_user_id

int ilForumCronNotificationDataProvider::$post_update_user_id
private

◆ $post_user_name

string ilForumCronNotificationDataProvider::$post_user_name = null
private

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

Referenced by getPostUserName().

◆ $ref_id

int ilForumCronNotificationDataProvider::$ref_id
private

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

Referenced by getRefId().

◆ $thread_id

int ilForumCronNotificationDataProvider::$thread_id
private

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

Referenced by getThreadId().

◆ $thread_title

string ilForumCronNotificationDataProvider::$thread_title
private

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

Referenced by getThreadTitle().

◆ $update_user_name

string ilForumCronNotificationDataProvider::$update_user_name = null
private

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

Referenced by getPostUpdateUserName().


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