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

Class ilForumNotification. More...

+ Collaboration diagram for ilForumNotification:

Public Member Functions

 __construct (private int $ref_id)
 
 setNotificationId (int $a_notification_id)
 
 getNotificationId ()
 
 setUserId (?int $a_user_id)
 
 getUserId ()
 
 setForumId (int $a_forum_id)
 
 getForumId ()
 
 setThreadId (int $a_thread_id)
 
 getThreadId ()
 
 setInterestedEvents (int $interested_events)
 
 getInterestedEvents ()
 
 setAdminForce (bool $a_admin_force)
 
 getAdminForce ()
 
 setUserToggle (bool $a_user_toggle)
 
 getUserToggle ()
 
 setForumRefId (int $a_ref_id)
 
 getForumRefId ()
 
 setUserIdNoti (int $a_user_id_noti)
 
 getUserIdNoti ()
 
 isAdminForceNotification ()
 
 isUserToggleNotification ()
 
 insertAdminForce ()
 
 deleteAdminForce ()
 
 deleteUserToggle ()
 
 updateUserToggle ()
 
 update ()
 
 deleteNotificationAllUsers ()
 
 read ()
 
 existsNotification ()
 
 cloneFromSource (int $sourceRefId)
 
 updateInterestedEvents ()
 
 readInterestedEvents ()
 
 readAllForcedEvents ()
 
 getForcedEventsObjectByUserId (int $user_id)
 
 updateUserNotifications (array $usr_ids, ilForumProperties $object_properties)
 

Static Public Member Functions

static checkForumsExistsInsert (int $ref_id, int $user_id)
 
static checkForumsExistsDelete (int $ref_id, int $user_id)
 
static getCachedNodeData (int $ref_id)
 
static mergeThreadNotifications ($merge_source_thread_id, $merge_target_thread_id)
 

Private Member Functions

 createMissingNotification (int $user_id)
 

Private Attributes

readonly ilDBInterface $db
 
readonly ilObjUser $user
 
int $notification_id
 
int $user_id = null
 
int $forum_id
 
int $thread_id
 
bool $admin_force = false
 
bool $user_toggle = false
 
int $interested_events = 0
 
int $user_id_noti
 

Static Private Attributes

static array $node_data_cache = []
 
static array $forced_events_cache = []
 

Detailed Description

Class ilForumNotification.

Author
Nadia Matuschek nmatu.nosp@m.sche.nosp@m.k@dat.nosp@m.abay.nosp@m..de
Version
$Id:$ \

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

Constructor & Destructor Documentation

◆ __construct()

ilForumNotification::__construct ( private int  $ref_id)

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

48 {
49 global $DIC;
50
51 $this->db = $DIC->database();
52 $this->user = $DIC->user();
53 $this->forum_id = $DIC['ilObjDataCache']->lookupObjId($ref_id);
54 }
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26

References $DIC, $ref_id, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkForumsExistsDelete()

static ilForumNotification::checkForumsExistsDelete ( int  $ref_id,
int  $user_id 
)
static

Definition at line 283 of file class.ilForumNotification.php.

283 : void
284 {
285 global $DIC;
286
287 $ilUser = $DIC->user();
288
289 $node_data = self::getCachedNodeData($ref_id);
290
291 foreach ($node_data as $data) {
292 $frm_noti = new ilForumNotification((int) $data['ref_id']);
293 $objFrmMods = new ilForumModerators((int) $data['ref_id']);
294 $moderator_ids = $objFrmMods->getCurrentModerators();
295
296 if ($user_id !== 0) {
297 $frm_noti->setUserId($user_id);
298 } else {
299 $frm_noti->setUserId($ilUser->getId());
300 }
301
302 $frm_noti->setForumId((int) $data['obj_id']);
303 if (!in_array($frm_noti->getUserId(), $moderator_ids, true)) {
304 $frm_noti->deleteAdminForce();
305 }
306 }
307 }
Class ilForumModerators.
Class ilForumNotification.
static getCachedNodeData(int $ref_id)

References $data, $DIC, $ref_id, $user_id, and getCachedNodeData().

Referenced by ilMembershipBlockGUI\confirmedRemove(), and ilDashboardLearningSequenceGUI\confirmedRemove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkForumsExistsInsert()

static ilForumNotification::checkForumsExistsInsert ( int  $ref_id,
int  $user_id 
)
static

Definition at line 250 of file class.ilForumNotification.php.

250 : void
251 {
252 global $DIC;
253
254 $ilUser = $DIC->user();
255
256 $node_data = self::getCachedNodeData($ref_id);
257
258 foreach ($node_data as $data) {
259 //check frm_properties if frm_noti is enabled
260 $frm_noti = new ilForumNotification((int) $data['ref_id']);
261 if ($user_id !== 0) {
262 $frm_noti->setUserId($user_id);
263 } else {
264 $frm_noti->setUserId($ilUser->getId());
265 }
266
267 $properties = ilForumProperties::getInstance((int) $data['obj_id']);
268 if ($properties->isAdminForceNoti() || $properties->isUserToggleNoti()) {
269 if ($properties->isAdminForceNoti()) {
270 $frm_noti->setInterestedEvents($properties->getInterestedEvents());
271 }
272
273 $frm_noti->setAdminForce($properties->isAdminForceNoti());
274 $frm_noti->setUserToggle($properties->isUserToggleNoti());
275 $frm_noti->setForumId($properties->getObjId());
276 if (!$frm_noti->existsNotification()) {
277 $frm_noti->insertAdminForce();
278 }
279 }
280 }
281 }
static getInstance(int $a_obj_id=0)

References $data, $DIC, $ref_id, $user_id, getCachedNodeData(), and ilForumProperties\getInstance().

Referenced by ilCourseRegistrationGUI\add(), ilGroupRegistrationGUI\add(), ilObjCourse\register(), and ilForumNotificationTest\testCheckForumsExistsInsert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneFromSource()

ilForumNotification::cloneFromSource ( int  $sourceRefId)

Definition at line 460 of file class.ilForumNotification.php.

460 : void
461 {
462 $sourceNotificationSettings = new self($sourceRefId);
463 $records = $sourceNotificationSettings->read();
464
465 foreach ($records as $usrId => $row) {
466 $this->setUserId($usrId);
467 $this->setAdminForce((bool) $row['admin_force_noti']);
468 $this->setUserToggle((bool) $row['user_toggle_noti']);
469 $this->setUserIdNoti((int) $row['user_id_noti']);
470 $this->setInterestedEvents((int) $row['interested_events']);
471
472 $this->insertAdminForce();
473 }
474 }
setUserToggle(bool $a_user_toggle)
setInterestedEvents(int $interested_events)
setUserIdNoti(int $a_user_id_noti)
setAdminForce(bool $a_admin_force)

◆ createMissingNotification()

ilForumNotification::createMissingNotification ( int  $user_id)
private

Definition at line 542 of file class.ilForumNotification.php.

542 : self
543 {
544 $new_object = new self($this->ref_id);
545 $new_object->setUserId($user_id);
546 $new_object->setForumId($this->forum_id);
547 $new_object->insertAdminForce();
548
549 return $new_object;
550 }

References $ref_id, and $user_id.

◆ deleteAdminForce()

ilForumNotification::deleteAdminForce ( )

Definition at line 208 of file class.ilForumNotification.php.

208 : void
209 {
210 $this->db->manipulateF(
211 '
212 DELETE FROM frm_notification
213 WHERE user_id = %s
214 AND frm_id = %s
215 AND admin_force_noti = %s
216 AND user_id_noti > %s',
217 ['integer', 'integer', 'integer', 'integer'],
218 [(int) $this->getUserId(), $this->getForumId(), 1, 0]
219 );
220 }

References getForumId(), and getUserId().

+ Here is the call graph for this function:

◆ deleteNotificationAllUsers()

ilForumNotification::deleteNotificationAllUsers ( )

Definition at line 378 of file class.ilForumNotification.php.

378 : void
379 {
380 $this->db->manipulateF(
381 'DELETE FROM frm_notification WHERE frm_id = %s AND user_id_noti > %s',
382 ['integer', 'integer'],
383 [$this->getForumId(), 0]
384 );
385 }

◆ deleteUserToggle()

ilForumNotification::deleteUserToggle ( )

Definition at line 222 of file class.ilForumNotification.php.

222 : void
223 {
224 $this->db->manipulateF(
225 '
226 DELETE FROM frm_notification
227 WHERE user_id = %s
228 AND frm_id = %s
229 AND admin_force_noti = %s
230 AND user_toggle_noti = %s
231 AND user_id_noti > %s',
232 ['integer', 'integer', 'integer', 'integer', 'integer'],
233 [(int) $this->getUserId(), $this->getForumId(), 1, 1, 0]
234 );
235 }

References getForumId(), and getUserId().

+ Here is the call graph for this function:

◆ existsNotification()

ilForumNotification::existsNotification ( )

Definition at line 449 of file class.ilForumNotification.php.

449 : bool
450 {
451 $res = $this->db->queryF(
452 'SELECT user_id FROM frm_notification WHERE user_id = %s AND frm_id = %s AND admin_force_noti = %s',
453 ['integer', 'integer', 'integer'],
454 [(int) $this->getUserId(), $this->getForumId(), (int) $this->getAdminForce()]
455 );
456
457 return $this->db->numRows($res) > 0;
458 }
$res
Definition: ltiservices.php:69

References $res.

◆ getAdminForce()

ilForumNotification::getAdminForce ( )

Definition at line 111 of file class.ilForumNotification.php.

111 : bool
112 {
113 return $this->admin_force;
114 }

References $admin_force.

Referenced by insertAdminForce().

+ Here is the caller graph for this function:

◆ getCachedNodeData()

static ilForumNotification::getCachedNodeData ( int  $ref_id)
static

Definition at line 309 of file class.ilForumNotification.php.

309 : array
310 {
311 global $DIC;
312
313 if (!array_key_exists($ref_id, self::$node_data_cache)) {
314 $container_node = $DIC->repositoryTree()->getNodeData($ref_id);
315 if (!isset($container_node['child'])) {
316 return [];
317 }
318
319 $node_data = $DIC->repositoryTree()->getSubTree(
320 $container_node,
321 true,
322 ['frm']
323 );
324 $node_data = array_filter($node_data, static function (array $forum_node) use ($DIC, $ref_id): bool {
325 // filter out forum if a grp lies in the path (#0027702)
326 foreach ($DIC->repositoryTree()->getNodePath((int) $forum_node['child'], $ref_id) as $path_node) {
327 $notRootNode = (int) $path_node['child'] !== $ref_id;
328 $isGroup = $path_node['type'] === 'grp';
329 if ($notRootNode && $isGroup) {
330 return false;
331 }
332 }
333
334 return true;
335 });
336 self::$node_data_cache[$ref_id] = $node_data;
337 }
338
339 return self::$node_data_cache[$ref_id];
340 }

References $DIC, and $ref_id.

Referenced by checkForumsExistsDelete(), and checkForumsExistsInsert().

+ Here is the caller graph for this function:

◆ getForcedEventsObjectByUserId()

ilForumNotification::getForcedEventsObjectByUserId ( int  $user_id)

Definition at line 529 of file class.ilForumNotification.php.

529 : self
530 {
531 if (!isset(self::$forced_events_cache[$user_id])) {
532 $this->readAllForcedEvents();
533 }
534
535 if (!isset(self::$forced_events_cache[$user_id])) {
536 self::$forced_events_cache[$user_id] = $this->createMissingNotification($user_id);
537 }
538
539 return self::$forced_events_cache[$user_id];
540 }

References $user_id.

◆ getForumId()

ilForumNotification::getForumId ( )

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

81 : int
82 {
83 return $this->forum_id;
84 }

References $forum_id.

Referenced by deleteAdminForce(), deleteUserToggle(), insertAdminForce(), isAdminForceNotification(), isUserToggleNotification(), and updateUserToggle().

+ Here is the caller graph for this function:

◆ getForumRefId()

ilForumNotification::getForumRefId ( )

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

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

References $ref_id.

◆ getInterestedEvents()

ilForumNotification::getInterestedEvents ( )

Definition at line 101 of file class.ilForumNotification.php.

101 : int
102 {
104 }

References $interested_events.

Referenced by insertAdminForce().

+ Here is the caller graph for this function:

◆ getNotificationId()

ilForumNotification::getNotificationId ( )

Definition at line 61 of file class.ilForumNotification.php.

61 : int
62 {
64 }

References $notification_id.

◆ getThreadId()

ilForumNotification::getThreadId ( )

Definition at line 91 of file class.ilForumNotification.php.

91 : int
92 {
93 return $this->thread_id;
94 }

References $thread_id.

◆ getUserId()

ilForumNotification::getUserId ( )

Definition at line 71 of file class.ilForumNotification.php.

71 : ?int
72 {
73 return $this->user_id;
74 }

References $user_id.

Referenced by deleteAdminForce(), deleteUserToggle(), insertAdminForce(), isAdminForceNotification(), isUserToggleNotification(), and updateUserToggle().

+ Here is the caller graph for this function:

◆ getUserIdNoti()

ilForumNotification::getUserIdNoti ( )

Definition at line 143 of file class.ilForumNotification.php.

143 : int
144 {
145 return $this->user_id_noti;
146 }

References $user_id_noti.

◆ getUserToggle()

ilForumNotification::getUserToggle ( )

Definition at line 121 of file class.ilForumNotification.php.

121 : bool
122 {
123 return $this->user_toggle;
124 }

References $user_toggle.

Referenced by insertAdminForce(), and updateUserToggle().

+ Here is the caller graph for this function:

◆ insertAdminForce()

ilForumNotification::insertAdminForce ( )

Definition at line 185 of file class.ilForumNotification.php.

185 : void
186 {
187 $next_id = $this->db->nextId('frm_notification');
188 $this->setNotificationId($next_id);
189
190 $this->db->manipulateF(
191 '
192 INSERT INTO frm_notification
193 (notification_id, user_id, frm_id, admin_force_noti, user_toggle_noti, interested_events, user_id_noti)
194 VALUES(%s, %s, %s, %s, %s, %s, %s)',
195 ['integer', 'integer', 'integer', 'integer', 'integer', 'integer', 'integer'],
196 [
197 $next_id,
198 (int) $this->getUserId(),
199 $this->getForumId(),
200 $this->getAdminForce(),
201 $this->getUserToggle(),
202 $this->getInterestedEvents(),
203 $this->user->getId()
204 ]
205 );
206 }
setNotificationId(int $a_notification_id)

References getAdminForce(), getForumId(), getInterestedEvents(), getUserId(), getUserToggle(), setNotificationId(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ isAdminForceNotification()

ilForumNotification::isAdminForceNotification ( )

Definition at line 148 of file class.ilForumNotification.php.

148 : bool
149 {
150 $res = $this->db->queryF(
151 '
152 SELECT admin_force_noti FROM frm_notification
153 WHERE user_id = %s
154 AND frm_id = %s
155 AND user_id_noti > %s ',
156 ['integer', 'integer', 'integer'],
157 [(int) $this->getUserId(), $this->getForumId(), 0]
158 );
159
160 if ($row = $this->db->fetchAssoc($res)) {
161 return (bool) $row['admin_force_noti'];
162 }
163
164 return false;
165 }

References $res, getForumId(), and getUserId().

+ Here is the call graph for this function:

◆ isUserToggleNotification()

ilForumNotification::isUserToggleNotification ( )

Definition at line 167 of file class.ilForumNotification.php.

167 : bool
168 {
169 $res = $this->db->queryF(
170 '
171 SELECT user_toggle_noti FROM frm_notification
172 WHERE user_id = %s
173 AND frm_id = %s
174 AND user_id_noti > %s',
175 ['integer', 'integer', 'integer'],
176 [(int) $this->getUserId(), $this->getForumId(), 0]
177 );
178
179 if ($row = $this->db->fetchAssoc($res)) {
180 return (bool) $row['user_toggle_noti'];
181 }
182 return false;
183 }

References $res, getForumId(), and getUserId().

+ Here is the call graph for this function:

◆ mergeThreadNotifications()

static ilForumNotification::mergeThreadNotifications (   $merge_source_thread_id,
  $merge_target_thread_id 
)
static

Definition at line 409 of file class.ilForumNotification.php.

409 : void
410 {
411 global $DIC;
412
413 $ilDB = $DIC->database();
414
415 $res = $ilDB->queryF(
416 'SELECT notification_id, user_id FROM frm_notification WHERE frm_id = %s AND thread_id = %s ORDER BY user_id ASC',
417 ['integer', 'integer'],
418 [0, $merge_source_thread_id]
419 );
420
421 $res_2 = $ilDB->queryF(
422 'SELECT DISTINCT user_id FROM frm_notification WHERE frm_id = %s AND thread_id = %s ORDER BY user_id ASC',
423 ['integer', 'integer'],
424 [0, $merge_target_thread_id]
425 );
426
427 $users_already_notified = [];
428 while ($users_row = $ilDB->fetchAssoc($res_2)) {
429 $users_already_notified[(int) $users_row['user_id']] = (int) $users_row['user_id'];
430 }
431
432 while ($row = $ilDB->fetchAssoc($res)) {
433 if (isset($users_already_notified[(int) $row['user_id']])) {
434 $ilDB->manipulateF(
435 'DELETE FROM frm_notification WHERE notification_id = %s',
436 ['integer'],
437 [$row['notification_id']]
438 );
439 } else {
440 $ilDB->update(
441 'frm_notification',
442 ['thread_id' => ['integer', $merge_target_thread_id]],
443 ['thread_id' => ['integer', $merge_source_thread_id]]
444 );
445 }
446 }
447 }

References $DIC, $ilDB, $res, and ILIAS\Repository\int().

Referenced by ilForum\mergeThreads(), and ilForumNotificationTest\testMergeThreadNotifications().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilForumNotification::read ( )
Returns
array<int, array<string, mixed>>

Definition at line 390 of file class.ilForumNotification.php.

390 : array
391 {
392 $result = [];
393
394 $res = $this->db->queryF('SELECT * FROM frm_notification WHERE frm_id = %s', ['integer'], [$this->getForumId()]);
395 while ($row = $this->db->fetchAssoc($res)) {
396 $result[(int) $row['user_id']]['notification_id'] = (int) $row['notification_id'];
397 $result[(int) $row['user_id']]['user_id'] = (int) $row['user_id'];
398 $result[(int) $row['user_id']]['frm_id'] = (int) $row['frm_id'];
399 $result[(int) $row['user_id']]['thread_id'] = (int) $row['thread_id'];
400 $result[(int) $row['user_id']]['admin_force_noti'] = (int) $row['admin_force_noti'];
401 $result[(int) $row['user_id']]['user_toggle_noti'] = (int) $row['user_toggle_noti'];
402 $result[(int) $row['user_id']]['interested_events'] = (int) $row['interested_events'];
403 $result[(int) $row['user_id']]['user_id_noti'] = (int) $row['user_id_noti'];
404 }
405
406 return $result;
407 }

References $res, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ readAllForcedEvents()

ilForumNotification::readAllForcedEvents ( )
Returns
array<int, ilForumNotification>

Definition at line 506 of file class.ilForumNotification.php.

506 : array
507 {
508 $res = $this->db->queryF(
509 'SELECT * FROM frm_notification WHERE admin_force_noti = %s AND frm_id = %s',
510 ['integer', 'integer'],
511 [1, $this->forum_id]
512 );
513
514 while ($row = $this->db->fetchAssoc($res)) {
515 $notificationConfig = new self($this->ref_id);
516 $notificationConfig->setNotificationId((int) $row['notification_id']);
517 $notificationConfig->setUserId((int) $row['user_id']);
518 $notificationConfig->setForumId((int) $row['frm_id']);
519 $notificationConfig->setAdminForce((bool) $row['admin_force_noti']);
520 $notificationConfig->setUserToggle((bool) $row['user_toggle_noti']);
521 $notificationConfig->setInterestedEvents((int) $row['interested_events']);
522
523 self::$forced_events_cache[(int) $row['user_id']] = $notificationConfig;
524 }
525
527 }

References $ref_id, $res, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ readInterestedEvents()

ilForumNotification::readInterestedEvents ( )

Definition at line 485 of file class.ilForumNotification.php.

485 : int
486 {
488
489 $this->db->setLimit(1);
490 $res = $this->db->queryF(
491 'SELECT interested_events FROM frm_notification WHERE user_id = %s AND frm_id = %s',
492 ['integer', 'integer'],
493 [(int) $this->getUserId(), $this->getForumId()]
494 );
495
496 while ($row = $this->db->fetchAssoc($res)) {
497 $interested_events = (int) $row['interested_events'];
498 }
499
500 return $interested_events;
501 }

References $res, ilForumNotificationEvents\DEACTIVATED, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ setAdminForce()

ilForumNotification::setAdminForce ( bool  $a_admin_force)

Definition at line 106 of file class.ilForumNotification.php.

106 : void
107 {
108 $this->admin_force = $a_admin_force;
109 }

◆ setForumId()

ilForumNotification::setForumId ( int  $a_forum_id)

Definition at line 76 of file class.ilForumNotification.php.

76 : void
77 {
78 $this->forum_id = $a_forum_id;
79 }

◆ setForumRefId()

ilForumNotification::setForumRefId ( int  $a_ref_id)

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

126 : void
127 {
128 $this->ref_id = $a_ref_id;
129 }

◆ setInterestedEvents()

ilForumNotification::setInterestedEvents ( int  $interested_events)

Definition at line 96 of file class.ilForumNotification.php.

96 : void
97 {
98 $this->interested_events = $interested_events;
99 }

References $interested_events.

◆ setNotificationId()

ilForumNotification::setNotificationId ( int  $a_notification_id)

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

56 : void
57 {
58 $this->notification_id = $a_notification_id;
59 }

Referenced by insertAdminForce().

+ Here is the caller graph for this function:

◆ setThreadId()

ilForumNotification::setThreadId ( int  $a_thread_id)

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

86 : void
87 {
88 $this->thread_id = $a_thread_id;
89 }

◆ setUserId()

ilForumNotification::setUserId ( ?int  $a_user_id)

Definition at line 66 of file class.ilForumNotification.php.

66 : void
67 {
68 $this->user_id = $a_user_id;
69 }

◆ setUserIdNoti()

ilForumNotification::setUserIdNoti ( int  $a_user_id_noti)

Definition at line 137 of file class.ilForumNotification.php.

137 : void
138 {
139 $this->user_id_noti = $a_user_id_noti;
140 }

◆ setUserToggle()

ilForumNotification::setUserToggle ( bool  $a_user_toggle)

Definition at line 116 of file class.ilForumNotification.php.

116 : void
117 {
118 $this->user_toggle = $a_user_toggle;
119 }

◆ update()

ilForumNotification::update ( )

Definition at line 362 of file class.ilForumNotification.php.

362 : void
363 {
364 $this->db->manipulateF(
365 'UPDATE frm_notification SET admin_force_noti = %s, user_toggle_noti = %s, ' .
366 'interested_events = %s WHERE user_id = %s AND frm_id = %s',
367 ['integer', 'integer', 'integer', 'integer', 'integer'],
368 [
369 (int) $this->getAdminForce(),
370 (int) $this->getUserToggle(),
371 $this->getInterestedEvents(),
372 (int) $this->getUserId(),
373 $this->getForumId()
374 ]
375 );
376 }

◆ updateInterestedEvents()

ilForumNotification::updateInterestedEvents ( )

Definition at line 476 of file class.ilForumNotification.php.

476 : void
477 {
478 $this->db->manipulateF(
479 'UPDATE frm_notification SET interested_events = %s WHERE user_id = %s AND frm_id = %s',
480 ['integer', 'integer', 'integer'],
481 [$this->getInterestedEvents(), (int) $this->getUserId(), $this->getForumId()]
482 );
483 }

◆ updateUserNotifications()

ilForumNotification::updateUserNotifications ( array  $usr_ids,
ilForumProperties  $object_properties 
)
Parameters
list<int>$usr_ids

Definition at line 555 of file class.ilForumNotification.php.

555 : void
556 {
557 $notification_settings_by_usr_id = $this->read();
558 foreach ($usr_ids as $usr_id) {
559 $this->setUserId($usr_id);
560 $this->setAdminForce(true);
561 $this->setUserToggle($object_properties->isUserToggleNoti());
562 $this->setInterestedEvents($object_properties->getInterestedEvents());
563
564 if (array_key_exists($usr_id, $notification_settings_by_usr_id) &&
565 $object_properties->getNotificationType() === NotificationType::ALL_USERS) {
566 $this->update();
567 } elseif (!$this->existsNotification()) {
568 $this->insertAdminForce();
569 }
570 }
571 }

References ilForumProperties\getInterestedEvents(), ilForumProperties\getNotificationType(), and ilForumProperties\isUserToggleNoti().

+ Here is the call graph for this function:

◆ updateUserToggle()

ilForumNotification::updateUserToggle ( )

Definition at line 237 of file class.ilForumNotification.php.

237 : void
238 {
239 $this->db->manipulateF(
240 'UPDATE frm_notification SET user_toggle_noti = %s WHERE user_id = %s AND frm_id = %s AND admin_force_noti = %s',
241 ['integer', 'integer', 'integer', 'integer'],
242 [$this->getUserToggle(), (int) $this->getUserId(), $this->getForumId(), 1]
243 );
244 }

References getForumId(), getUserId(), and getUserToggle().

+ Here is the call graph for this function:

Field Documentation

◆ $admin_force

bool ilForumNotification::$admin_force = false
private

Definition at line 42 of file class.ilForumNotification.php.

Referenced by getAdminForce().

◆ $db

readonly ilDBInterface ilForumNotification::$db
private

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

◆ $forced_events_cache

array ilForumNotification::$forced_events_cache = []
staticprivate

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

◆ $forum_id

int ilForumNotification::$forum_id
private

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

Referenced by getForumId().

◆ $interested_events

int ilForumNotification::$interested_events = 0
private

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

Referenced by getInterestedEvents(), and setInterestedEvents().

◆ $node_data_cache

array ilForumNotification::$node_data_cache = []
staticprivate

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

◆ $notification_id

int ilForumNotification::$notification_id
private

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

Referenced by getNotificationId().

◆ $thread_id

int ilForumNotification::$thread_id
private

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

Referenced by getThreadId().

◆ $user

readonly ilObjUser ilForumNotification::$user
private

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

◆ $user_id

int ilForumNotification::$user_id = null
private

◆ $user_id_noti

int ilForumNotification::$user_id_noti
private

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

Referenced by getUserIdNoti().

◆ $user_toggle

bool ilForumNotification::$user_toggle = false
private

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

Referenced by getUserToggle().


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