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

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

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:65
global $DIC
Definition: shib_login.php:26
+ 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 284 of file class.ilForumNotification.php.

References $data, and $DIC.

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

284  : void
285  {
286  global $DIC;
287 
288  $ilUser = $DIC->user();
289 
290  $node_data = self::getCachedNodeData($ref_id);
291 
292  foreach ($node_data as $data) {
293  $frm_noti = new ilForumNotification((int) $data['ref_id']);
294  $objFrmMods = new ilForumModerators((int) $data['ref_id']);
295  $moderator_ids = $objFrmMods->getCurrentModerators();
296 
297  if ($user_id !== 0) {
298  $frm_noti->setUserId($user_id);
299  } else {
300  $frm_noti->setUserId($ilUser->getId());
301  }
302 
303  $frm_noti->setForumId((int) $data['obj_id']);
304  if (!in_array($frm_noti->getUserId(), $moderator_ids, true)) {
305  $frm_noti->deleteAdminForce();
306  }
307  }
308  }
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ checkForumsExistsInsert()

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

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

References $data, $DIC, ilForumProperties\_isAdminForceNoti(), and ilForumProperties\_isUserToggleNoti().

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

249  : void
250  {
251  global $DIC;
252 
253  $ilUser = $DIC->user();
254 
255  $node_data = self::getCachedNodeData($ref_id);
256 
257  foreach ($node_data as $data) {
258  //check frm_properties if frm_noti is enabled
259  $frm_noti = new ilForumNotification((int) $data['ref_id']);
260  if ($user_id !== 0) {
261  $frm_noti->setUserId($user_id);
262  } else {
263  $frm_noti->setUserId($ilUser->getId());
264  }
265 
266  $admin_force = ilForumProperties::_isAdminForceNoti((int) $data['obj_id']);
267  $frm_noti->setAdminForce($admin_force);
268 
269  $user_toggle = ilForumProperties::_isUserToggleNoti((int) $data['obj_id']);
270  if ($user_toggle) {
271  $frm_noti->setAdminForce(true);
272  }
273 
274  if ($admin_force || $user_toggle) {
275  $frm_noti->setUserToggle($user_toggle);
276  $frm_noti->setForumId((int) $data['obj_id']);
277  if (!$frm_noti->existsNotification()) {
278  $frm_noti->insertAdminForce();
279  }
280  }
281  }
282  }
static _isAdminForceNoti(int $a_obj_id)
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
static _isUserToggleNoti(int $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneFromSource()

ilForumNotification::cloneFromSource ( int  $sourceRefId)

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

References insertAdminForce(), setAdminForce(), setInterestedEvents(), setUserId(), setUserIdNoti(), and setUserToggle().

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

◆ createMissingNotification()

ilForumNotification::createMissingNotification ( int  $user_id)
private

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

References $ref_id.

Referenced by getForcedEventsObjectByUserId().

543  : self
544  {
545  $new_object = new self($this->ref_id);
546  $new_object->setUserId($user_id);
547  $new_object->setForumId($this->forum_id);
548  $new_object->insertAdminForce();
549 
550  return $new_object;
551  }
$ref_id
Definition: ltiauth.php:65
+ Here is the caller graph for this function:

◆ deleteAdminForce()

ilForumNotification::deleteAdminForce ( )

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

References getForumId(), and getUserId().

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

◆ deleteNotificationAllUsers()

ilForumNotification::deleteNotificationAllUsers ( )

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

References getForumId().

379  : void
380  {
381  $this->db->manipulateF(
382  'DELETE FROM frm_notification WHERE frm_id = %s AND user_id_noti > %s',
383  ['integer', 'integer'],
384  [$this->getForumId(), 0]
385  );
386  }
+ Here is the call graph for this function:

◆ deleteUserToggle()

ilForumNotification::deleteUserToggle ( )

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

References getForumId(), and getUserId().

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

◆ existsNotification()

ilForumNotification::existsNotification ( )

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

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

Referenced by updateUserNotifications().

450  : bool
451  {
452  $res = $this->db->queryF(
453  'SELECT user_id FROM frm_notification WHERE user_id = %s AND frm_id = %s AND admin_force_noti = %s',
454  ['integer', 'integer', 'integer'],
455  [(int) $this->getUserId(), $this->getForumId(), (int) $this->getAdminForce()]
456  );
457 
458  return $this->db->numRows($res) > 0;
459  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdminForce()

ilForumNotification::getAdminForce ( )

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

References $admin_force.

Referenced by existsNotification(), insertAdminForce(), and update().

111  : bool
112  {
113  return $this->admin_force;
114  }
+ Here is the caller graph for this function:

◆ getCachedNodeData()

static ilForumNotification::getCachedNodeData ( int  $ref_id)
static

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

References $DIC, $ilDB, $ref_id, ilObjectFactory\getInstanceByRefId(), and ILIAS\Repository\int().

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

◆ getForcedEventsObjectByUserId()

ilForumNotification::getForcedEventsObjectByUserId ( int  $user_id)

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

References $user_id, createMissingNotification(), and readAllForcedEvents().

530  : self
531  {
532  if (!isset(self::$forced_events_cache[$user_id])) {
533  $this->readAllForcedEvents();
534  }
535 
536  if (!isset(self::$forced_events_cache[$user_id])) {
537  self::$forced_events_cache[$user_id] = $this->createMissingNotification($user_id);
538  }
539 
540  return self::$forced_events_cache[$user_id];
541  }
+ Here is the call graph for this function:

◆ getForumId()

◆ getForumRefId()

ilForumNotification::getForumRefId ( )

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

References $ref_id.

131  : int
132  {
133  return $this->ref_id;
134  }
$ref_id
Definition: ltiauth.php:65

◆ getInterestedEvents()

ilForumNotification::getInterestedEvents ( )

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

References $interested_events.

Referenced by update(), and updateInterestedEvents().

101  : int
102  {
104  }
+ Here is the caller graph for this function:

◆ getNotificationId()

ilForumNotification::getNotificationId ( )

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

References $notification_id.

61  : int
62  {
64  }

◆ getThreadId()

ilForumNotification::getThreadId ( )

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

References $thread_id.

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

◆ getUserId()

ilForumNotification::getUserId ( )

◆ getUserIdNoti()

ilForumNotification::getUserIdNoti ( )

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

References $user_id_noti.

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

◆ getUserToggle()

ilForumNotification::getUserToggle ( )

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

References $user_toggle.

Referenced by insertAdminForce(), update(), and updateUserToggle().

121  : bool
122  {
123  return $this->user_toggle;
124  }
+ Here is the caller graph for this function:

◆ insertAdminForce()

ilForumNotification::insertAdminForce ( )

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

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

Referenced by cloneFromSource(), and updateUserNotifications().

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, user_id_noti)
194  VALUES(%s, %s, %s, %s, %s, %s)',
195  ['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->user->getId()
203  ]
204  );
205  }
setNotificationId(int $a_notification_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAdminForceNotification()

ilForumNotification::isAdminForceNotification ( )

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

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

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  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ isUserToggleNotification()

ilForumNotification::isUserToggleNotification ( )

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

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

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  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ mergeThreadNotifications()

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

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

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

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

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

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

Referenced by updateUserNotifications().

391  : array
392  {
393  $result = [];
394 
395  $res = $this->db->queryF('SELECT * FROM frm_notification WHERE frm_id = %s', ['integer'], [$this->getForumId()]);
396  while ($row = $this->db->fetchAssoc($res)) {
397  $result[(int) $row['user_id']]['notification_id'] = (int) $row['notification_id'];
398  $result[(int) $row['user_id']]['user_id'] = (int) $row['user_id'];
399  $result[(int) $row['user_id']]['frm_id'] = (int) $row['frm_id'];
400  $result[(int) $row['user_id']]['thread_id'] = (int) $row['thread_id'];
401  $result[(int) $row['user_id']]['admin_force_noti'] = (int) $row['admin_force_noti'];
402  $result[(int) $row['user_id']]['user_toggle_noti'] = (int) $row['user_toggle_noti'];
403  $result[(int) $row['user_id']]['interested_events'] = (int) $row['interested_events'];
404  $result[(int) $row['user_id']]['user_id_noti'] = (int) $row['user_id_noti'];
405  }
406 
407  return $result;
408  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAllForcedEvents()

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

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

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

Referenced by getForcedEventsObjectByUserId().

507  : array
508  {
509  $res = $this->db->queryF(
510  'SELECT * FROM frm_notification WHERE admin_force_noti = %s AND frm_id = %s',
511  ['integer', 'integer'],
512  [1, $this->forum_id]
513  );
514 
515  while ($row = $this->db->fetchAssoc($res)) {
516  $notificationConfig = new self($this->ref_id);
517  $notificationConfig->setNotificationId((int) $row['notification_id']);
518  $notificationConfig->setUserId((int) $row['user_id']);
519  $notificationConfig->setForumId((int) $row['frm_id']);
520  $notificationConfig->setAdminForce((bool) $row['admin_force_noti']);
521  $notificationConfig->setUserToggle((bool) $row['user_toggle_noti']);
522  $notificationConfig->setInterestedEvents((int) $row['interested_events']);
523 
524  self::$forced_events_cache[(int) $row['user_id']] = $notificationConfig;
525  }
526 
527  return self::$forced_events_cache;
528  }
$res
Definition: ltiservices.php:66
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readInterestedEvents()

ilForumNotification::readInterestedEvents ( )

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

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

486  : int
487  {
489 
490  $this->db->setLimit(1);
491  $res = $this->db->queryF(
492  'SELECT interested_events FROM frm_notification WHERE user_id = %s AND frm_id = %s',
493  ['integer', 'integer'],
494  [(int) $this->getUserId(), $this->getForumId()]
495  );
496 
497  while ($row = $this->db->fetchAssoc($res)) {
498  $interested_events = (int) $row['interested_events'];
499  }
500 
501  return $interested_events;
502  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ setAdminForce()

ilForumNotification::setAdminForce ( bool  $a_admin_force)

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

Referenced by cloneFromSource(), and updateUserNotifications().

106  : void
107  {
108  $this->admin_force = $a_admin_force;
109  }
+ Here is the caller graph for this function:

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

References $interested_events.

Referenced by cloneFromSource(), and updateUserNotifications().

96  : void
97  {
98  $this->interested_events = $interested_events;
99  }
+ Here is the caller graph for this function:

◆ setNotificationId()

ilForumNotification::setNotificationId ( int  $a_notification_id)

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

Referenced by insertAdminForce().

56  : void
57  {
58  $this->notification_id = $a_notification_id;
59  }
+ 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.

Referenced by cloneFromSource(), and updateUserNotifications().

66  : void
67  {
68  $this->user_id = $a_user_id;
69  }
+ Here is the caller graph for this function:

◆ setUserIdNoti()

ilForumNotification::setUserIdNoti ( int  $a_user_id_noti)

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

Referenced by cloneFromSource().

137  : void
138  {
139  $this->user_id_noti = $a_user_id_noti;
140  }
+ Here is the caller graph for this function:

◆ setUserToggle()

ilForumNotification::setUserToggle ( bool  $a_user_toggle)

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

Referenced by cloneFromSource(), and updateUserNotifications().

116  : void
117  {
118  $this->user_toggle = $a_user_toggle;
119  }
+ Here is the caller graph for this function:

◆ update()

ilForumNotification::update ( )

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

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

Referenced by updateUserNotifications().

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

◆ updateInterestedEvents()

ilForumNotification::updateInterestedEvents ( )

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

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

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

◆ updateUserNotifications()

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

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

References existsNotification(), ilForumProperties\getInterestedEvents(), ilForumProperties\getNotificationType(), insertAdminForce(), ilForumProperties\isUserToggleNoti(), read(), setAdminForce(), setInterestedEvents(), setUserId(), setUserToggle(), and update().

556  : void
557  {
558  $notification_settings_by_usr_id = $this->read();
559  foreach ($usr_ids as $usr_id) {
560  $this->setUserId($usr_id);
561  $this->setAdminForce(true);
562  $this->setUserToggle($object_properties->isUserToggleNoti());
563  $this->setInterestedEvents($object_properties->getInterestedEvents());
564 
565  if (array_key_exists($usr_id, $notification_settings_by_usr_id) &&
566  $object_properties->getNotificationType() === NotificationType::ALL_USERS) {
567  $this->update();
568  } elseif (!$this->existsNotification()) {
569  $this->insertAdminForce();
570  }
571  }
572  }
setUserToggle(bool $a_user_toggle)
setAdminForce(bool $a_admin_force)
setInterestedEvents(int $interested_events)
+ Here is the call graph for this function:

◆ updateUserToggle()

ilForumNotification::updateUserToggle ( )

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

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

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

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

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

Referenced by getForcedEventsObjectByUserId(), and getUserId().

◆ $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: