ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilForumCronNotificationDataProvider Class Reference

Class ilForumCronNotificationDataProvider. More...

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

Public Member Functions

 __construct (array $row, private readonly 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 ()
 
 getPosDisplayUserId ()
 
 getPosUserAlias ()
 
 getPostUpdateUserId ()
 
 getPosAuthorId ()
 
 isAnonymized ()
 
 getDeletedBy ()
 
 getImportName ()
 
 getPostUserName (ilLanguage $user_lang)
 
 getPostUpdateUserName (ilLanguage $user_lang)
 
 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)
 
 isPostCensored ()
 
 getPostCensoredDate ()
 
 getCensorshipComment ()
 
 getAttachments ()
 
 getDeletedBy ()
 

Protected Member Functions

 read ()
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

62 {
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) {
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 }
Class ilForumNotificationCache.
global $DIC
Definition: shib_login.php:26

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

+ 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 }

References $user_id.

◆ closestContainer()

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

Implements ilForumNotificationMailData.

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

146 : ?ilObject
147 {
149 }
Class ilObject Basic functions for all objects.

References $closest_container.

◆ getAttachments()

ilForumCronNotificationDataProvider::getAttachments ( )
Returns
list<string>

Implements ilForumNotificationMailData.

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

References $attachments.

◆ getAuthorInformation()

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

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

312 $cacheKey = $this->notificationCache->createKeyByValues([
313 $this->notification_type,
314 $lng->getLangKey(),
315 $authorUsrId,
316 $displayUserId,
317 $usrAlias,
318 $importName
319 ]);
320
321 if (!$this->notificationCache->exists($cacheKey)) {
322 $authorInformation = new ilForumAuthorInformation(
323 $authorUsrId,
324 $displayUserId,
325 $usrAlias,
326 $importName,
327 [],
328 $lng
329 );
330
331 $this->notificationCache->store($cacheKey, $authorInformation);
332 }
333
334 return $this->notificationCache->fetch($cacheKey);
335 }
global $lng
Definition: privfeed.php:31

References $lng.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ 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 ( )

◆ getForumId()

ilForumCronNotificationDataProvider::getForumId ( )

◆ getForumTitle()

ilForumCronNotificationDataProvider::getForumTitle ( )

Implements ilForumNotificationMailData.

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

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

References $forum_title.

◆ getImportName()

ilForumCronNotificationDataProvider::getImportName ( )

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

249 : string
250 {
251 return $this->import_name;
252 }

References $import_name.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ 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 234 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 219 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 ( )

◆ 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 ( )

Implements ilForumNotificationMailData.

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

181 : string
182 {
183 return $this->post_message;
184 }

References $post_message.

◆ getPostTitle()

ilForumCronNotificationDataProvider::getPostTitle ( )

Implements ilForumNotificationMailData.

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

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

References $post_title.

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

269 : string
270 {
271 if ($this->update_user_name === null) {
272 $this->update_user_name = $this->getPublicUserInformation($this->getAuthorInformation(
273 $user_lang,
274 $this->getPosAuthorId(),
275 $this->getPostUpdateUserId(),
276 $this->getPosUserAlias(),
277 $this->getImportName()
278 ));
279 }
280
281 // Fix for #25432
282 if (
283 $this->getPosUserAlias() && $this->getPosDisplayUserId() === 0 &&
284 $this->getPosAuthorId() === $this->getPostUpdateUserId()
285 ) {
286 return $this->getPosUserAlias();
287 }
288
290 }
getPublicUserInformation(ilForumAuthorInformation $authorinfo)
getAuthorInformation(ilLanguage $lng, int $authorUsrId, int $displayUserId, string $usrAlias, string $importName)

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

+ Here is the call graph for this function:

◆ getPostUserName()

ilForumCronNotificationDataProvider::getPostUserName ( ilLanguage  $user_lang)

Implements ilForumNotificationMailData.

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

254 : string
255 {
256 if ($this->post_user_name === null) {
257 $this->post_user_name = $this->getPublicUserInformation($this->getAuthorInformation(
258 $user_lang,
259 $this->getPosAuthorId(),
260 $this->getPosDisplayUserId(),
261 $this->getPosUserAlias(),
262 $this->getImportName()
263 ));
264 }
265
267 }

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

+ Here is the call graph for this function:

◆ getPosUserAlias()

ilForumCronNotificationDataProvider::getPosUserAlias ( )

Implements ilForumNotificationMailData.

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

224 : string
225 {
227 }

References $pos_usr_alias.

Referenced by getPostUpdateUserName(), and getPostUserName().

+ Here is the caller graph for this function:

◆ getPublicUserInformation()

ilForumCronNotificationDataProvider::getPublicUserInformation ( ilForumAuthorInformation  $authorinfo)

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

292 : string
293 {
294 $publicName = $authorinfo->getAuthorShortName();
295
296 if ($authorinfo->hasSuffix()) {
297 $publicName = $authorinfo->getAuthorName();
298 } elseif ($authorinfo->getAuthorName() && !$this->isAnonymized()) {
299 $publicName = $authorinfo->getAuthorName();
300 }
301
302 return $publicName;
303 }
getAuthorName(bool $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 ( )

Implements ilForumNotificationMailData.

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

References $ref_id.

◆ getThreadId()

ilForumCronNotificationDataProvider::getThreadId ( )

◆ getThreadTitle()

ilForumCronNotificationDataProvider::getThreadTitle ( )

Implements ilForumNotificationMailData.

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

166 : string
167 {
168 return $this->thread_title;
169 }

References $thread_title.

◆ isAnonymized()

ilForumCronNotificationDataProvider::isAnonymized ( )

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

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 }

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:

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 32 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

readonly int ilForumCronNotificationDataProvider::$forum_id
private

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

Referenced by getForumId().

◆ $forum_title

readonly string ilForumCronNotificationDataProvider::$forum_title
private

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

Referenced by getForumTitle().

◆ $import_name

readonly string ilForumCronNotificationDataProvider::$import_name
private

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

Referenced by getImportName().

◆ $is_anonymized

bool ilForumCronNotificationDataProvider::$is_anonymized = false
private

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

Referenced by isAnonymized().

◆ $notificationCache

readonly ilForumNotificationCache ilForumCronNotificationDataProvider::$notificationCache
private

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

Referenced by __construct().

◆ $obj_id

readonly int ilForumCronNotificationDataProvider::$obj_id
private

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

Referenced by getObjId().

◆ $pos_author_id

readonly int ilForumCronNotificationDataProvider::$pos_author_id
private

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

Referenced by getPosAuthorId().

◆ $pos_display_user_id

readonly int ilForumCronNotificationDataProvider::$pos_display_user_id
private

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

Referenced by getPosDisplayUserId().

◆ $pos_usr_alias

readonly string ilForumCronNotificationDataProvider::$pos_usr_alias
private

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

Referenced by getPosUserAlias().

◆ $post_censored

readonly bool ilForumCronNotificationDataProvider::$post_censored
private

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

Referenced by isPostCensored().

◆ $post_censored_comment

readonly string ilForumCronNotificationDataProvider::$post_censored_comment
private

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

Referenced by getPostDate().

◆ $post_id

readonly int ilForumCronNotificationDataProvider::$post_id
private

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

Referenced by getPostId().

◆ $post_message

readonly string ilForumCronNotificationDataProvider::$post_message
private

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

Referenced by getPostMessage().

◆ $post_title

readonly string ilForumCronNotificationDataProvider::$post_title
private

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

Referenced by getPostTitle().

◆ $post_update

string ilForumCronNotificationDataProvider::$post_update = null
private

◆ $post_update_user_id

readonly int ilForumCronNotificationDataProvider::$post_update_user_id
private

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

Referenced by getPostUpdateUserId().

◆ $post_user_name

string ilForumCronNotificationDataProvider::$post_user_name = null
private

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

Referenced by getPostUserName().

◆ $ref_id

readonly int ilForumCronNotificationDataProvider::$ref_id
private

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

Referenced by getRefId().

◆ $thread_id

readonly int ilForumCronNotificationDataProvider::$thread_id
private

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

Referenced by getThreadId().

◆ $thread_title

readonly string ilForumCronNotificationDataProvider::$thread_title
private

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