ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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)
 

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.

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

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
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.

References $user_id.

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 ( )
Returns
list<string>

Implements ilForumNotificationMailData.

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

References $attachments.

214  : array
215  {
216  return $this->attachments;
217  }

◆ getAuthorInformation()

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

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

References ilLanguage\getLangKey().

Referenced by getPostUpdateUserName(), and getPostUserName().

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

References $deleted_by.

244  : string
245  {
246  return $this->deleted_by;
247  }

◆ getForumId()

ilForumCronNotificationDataProvider::getForumId ( )

Implements ilForumNotificationMailData.

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

References $forum_id.

141  : int
142  {
143  return $this->forum_id;
144  }

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

References $import_name.

Referenced by getPostUpdateUserName(), and getPostUserName().

249  : string
250  {
251  return $this->import_name;
252  }
+ 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().

136  : int
137  {
138  return $this->obj_id;
139  }
+ 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().

234  : int
235  {
236  return $this->pos_author_id;
237  }
+ 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().

219  : int
220  {
222  }
+ 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().

171  : int
172  {
173  return $this->post_id;
174  }
+ Here is the caller graph for this function:

◆ getPostMessage()

ilForumCronNotificationDataProvider::getPostMessage ( )

Implements ilForumNotificationMailData.

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

References $post_message.

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

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

References $post_update_user_id.

Referenced by getPostUpdateUserName().

229  : int
230  {
232  }
+ 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.

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

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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 254 of file class.ilForumCronNotificationDataProvider.php.

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

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 
266  return $this->post_user_name;
267  }
getPublicUserInformation(ilForumAuthorInformation $authorinfo)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 224 of file class.ilForumCronNotificationDataProvider.php.

References $pos_usr_alias.

Referenced by getPostUpdateUserName(), and getPostUserName().

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

◆ getPublicUserInformation()

ilForumCronNotificationDataProvider::getPublicUserInformation ( ilForumAuthorInformation  $authorinfo)

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

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

Referenced by getPostUpdateUserName(), and getPostUserName().

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

131  : int
132  {
133  return $this->ref_id;
134  }

◆ getThreadId()

ilForumCronNotificationDataProvider::getThreadId ( )

Implements ilForumNotificationMailData.

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

References $thread_id.

161  : int
162  {
163  return $this->thread_id;
164  }

◆ getThreadTitle()

ilForumCronNotificationDataProvider::getThreadTitle ( )

Implements ilForumNotificationMailData.

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

References $thread_title.

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

◆ isAnonymized()

ilForumCronNotificationDataProvider::isAnonymized ( )

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

References $is_anonymized.

Referenced by getPublicUserInformation().

+ Here is the caller graph for this function:

◆ isPostCensored()

ilForumCronNotificationDataProvider::isPostCensored ( )

Implements ilForumNotificationMailData.

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

References $post_censored.

196  : bool
197  {
198  return $this->post_censored;
199  }

◆ providesClosestContainer()

ilForumCronNotificationDataProvider::providesClosestContainer ( )

Implements ilForumNotificationMailData.

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

References null.

151  : bool
152  {
153  return $this->closest_container !== null;
154  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

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