ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ilADNNotification Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilADNNotification:
+ Collaboration diagram for ilADNNotification:

Public Member Functions

 getConnectorContainerName ()
 @description Return the Name of your Connector Table More...
 
 dismiss (ilObjUser $ilObjUser)
 
 resetForAllUsers ()
 
 getFullTimeFormated ()
 
 isUserAllowedToDismiss (ilObjUser $user)
 
 getActiveType ()
 
 isVisibleForUser (ilObjUser $ilObjUser)
 
 wakeUp ($field_name, $field_value)
 
 create ()
 
 setBody (string $body)
 
 getBody ()
 
 setDisplayEnd (DateTimeImmutable $display_end)
 
 getDisplayEnd ()
 
 setDisplayStart (DateTimeImmutable $display_start)
 
 getDisplayStart ()
 
 setEventEnd (DateTimeImmutable $event_end)
 
 getEventEnd ()
 
 setEventStart (DateTimeImmutable $event_start)
 
 getEventStart ()
 
 setId (int $id)
 
 getId ()
 
 setTitle (string $title)
 
 getTitle ()
 
 setType (int $type)
 
 getType ()
 
 setTypeDuringEvent (int $type_during_event)
 
 getTypeDuringEvent ()
 
 setDismissable (bool $dismissable)
 
 getDismissable ()
 
 setPermanent (bool $permanent)
 
 isPermanent ()
 
 isDuringEvent ()
 
 setCreateDate (DateTimeImmutable $create_date)
 
 getCreateDate ()
 
 setCreatedBy (int $created_by)
 
 getCreatedBy ()
 
 isActive ()
 
 setActive (bool $active)
 
 getLimitedToLanguages ()
 
 setLimitedToLanguages (array $limited_to_languages)
 
 hasLanguageLimitation ()
 
 setHasLanguageLimitation (bool $has_language_limitation)
 
 getLimitedToRoleIds ()
 
 setLimitedToRoleIds (array $limited_to_role_ids)
 
 isLimitToRoles ()
 
 setLimitToRoles (bool $limit_to_roles)
 
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 
 getArFieldList ()
 
 getConnectorContainerName ()
 @description Return the Name of your Connector Table More...
 
 setConnectorContainerName (string $connector_container_name)
 
 getPrimaryFieldValue ()
 
 setPrimaryFieldValue ($value)
 
 __construct (mixed $primary_key=0)
 
 storeObjectToCache ()
 
 asStdClass ()
 
 asArray ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, string $value)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 getArrayForConnector ()
 
 installConnector ()
 
 store ()
 
 save ()
 
 create ()
 
 copy (int $new_id=0)
 
 afterObjectLoad ()
 
 read ()
 
 update ()
 
 delete ()
 
 __call ($name, $arguments)
 

Static Public Member Functions

static returnDbTableName ()
 
- Static Public Member Functions inherited from ActiveRecord
static returnDbTableName ()
 
static installDB ()
 
static renameDBField (string $old_name, string $new_name)
 
static tableExists ()
 
static fieldExists (string $field_name)
 
static removeDBField (string $field_name)
 
static updateDB ()
 
static resetDB ()
 
static truncateDB ()
 
static flushDB ()
 @depracated never use in ILIAS Core, Plugins only More...
 
static preloadObjects ()
 
static additionalParams (array $additional_params)
 
static findOrFail ($primary_key, array $add_constructor_args=[])
 Tries to find the object and throws an Exception if object is not found, instead of returning null. More...
 
static findOrGetInstance ($primary_key, array $add_constructor_args=[])
 
static where ($where, $operator=null)
 
static innerjoinAR (ActiveRecord $activeRecord, $on_this, string $on_external, array $fields=[' *'], string $operator='=', bool $both_external=false)
 
static innerjoin (string $tablename, $on_this, string $on_external, array $fields=[' *'], string $operator='=', bool $both_external=false)
 
static leftjoin (string $tablename, $on_this, string $on_external, array $fields=[' *'], string $operator='=', bool $both_external=false)
 
static orderBy (string $orderBy, string $orderDirection='ASC')
 
static dateFormat (string $date_format='d.m.Y - H:i:s')
 
static limit (int $start, int $end)
 
static affectedRows ()
 
static count ()
 
static get ()
 
static debug ()
 
static first ()
 
static getCollection ()
 
static last ()
 
static getFirstFromLastQuery ()
 
static connector (arConnector $arConnector)
 
static raw (bool $set_raw=true)
 
static getArray (?string $key=null, string|array|null $values=null)
 
static _toCamelCase (string $str, bool $capitalise_first_char=false)
 

Data Fields

const POS_TOP = 1
 
const POS_RIGHT = 2
 
const POST_LEFT = 3
 
const POS_BOTTOM = 4
 
const DATE_FORMAT = 'd.m.Y'
 
const TIME_FORMAT = 'H:i'
 
const DATE_TIME_FORMAT = 'd.m.Y H:i'
 
const TYPE_INFO = 1
 
const TYPE_WARNING = 2
 
const TYPE_ERROR = 3
 
const TABLE_NAME = 'il_adn_notifications'
 
const LINK_TYPE_NONE = 0
 
const LINK_TYPE_REF_ID = 1
 
const LINK_TYPE_URL = 2
 

Protected Member Functions

 hasUserDismissed (ilObjUser $ilObjUser)
 
 isVisible ()
 
 isVisibleToUserBasedOnLanguage (ilObjUser $user)
 
 isVisibleRoleUserRoles (ilObjUser $ilObjUser)
 
 hasEventStarted ()
 
 hasDisplayStarted ()
 
 hasEventEnded ()
 
 hasDisplayEnded ()
 
 getTime ()
 
- Protected Member Functions inherited from ActiveRecord
 installDatabase ()
 

Protected Attributes

int $id = null
 @con_is_primary true @con_sequence true @con_is_unique true @con_has_field true @con_fieldtype integer @con_length 8 More...
 
string $title = ''
 @con_has_field true @con_fieldtype text @con_length 256 More...
 
string $body = ''
 @con_has_field true @con_fieldtype clob More...
 
DateTimeImmutable $event_start = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
DateTimeImmutable $event_end = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
DateTimeImmutable $display_start = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
DateTimeImmutable $display_end = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
int $type = self::TYPE_INFO
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
int $type_during_event = self::TYPE_ERROR
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
bool $dismissable = true
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
bool $permanent = true
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
array $allowed_users = [0, 6, 13]
 @con_has_field true @con_fieldtype text @con_length 256 More...
 
int $parent_id = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
DateTimeImmutable $create_date = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
DateTimeImmutable $last_update
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
int $created_by = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
int $last_update_by = null
 @con_has_field true @con_fieldtype integer @con_length 8 More...
 
bool $active = true
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
array $limited_to_languages = []
 @con_has_field true @con_fieldtype text @con_length 256 More...
 
bool $has_language_limitation = false
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
array $limited_to_role_ids = []
 @con_has_field true @con_fieldtype text @con_length 256 More...
 
bool $limit_to_roles = false
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
bool $interruptive = false
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
string $link = ''
 @con_has_field true @con_fieldtype text @con_length 256 More...
 
int $link_type = self::LINK_TYPE_NONE
 @con_has_field true @con_fieldtype integer @con_length 1 More...
 
string $link_target = '_top'
 @con_has_field true @con_fieldtype text @con_length 256 More...
 
- Protected Attributes inherited from ActiveRecord
bool $ar_safe_read = true
 
string $connector_container_name = ''
 
bool $is_new = true
 

Static Protected Attributes

static array $allowed_user_ids = [0, 13, 6]
 

Additional Inherited Members

- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 @description Returns an instance of the instatiated calling active record (needs to be done in static methods) @TODO : This should be cached somehow More...
 
static fromCamelCase (string $str)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilADNNotification

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 24 of file class.ilADNNotification.php.

Member Function Documentation

◆ create()

ilADNNotification::create ( )

Reimplemented from ActiveRecord.

Definition at line 411 of file class.ilADNNotification.php.

411 : void
412 {
413 global $DIC;
414 $this->setCreateDate(new DateTimeImmutable());
415 $this->setCreatedBy($DIC->user()->getId());
416 parent::create();
417 }
setCreateDate(DateTimeImmutable $create_date)
setCreatedBy(int $created_by)
global $DIC
Definition: shib_login.php:26

References $DIC, setCreateDate(), and setCreatedBy().

+ Here is the call graph for this function:

◆ dismiss()

ilADNNotification::dismiss ( ilObjUser  $ilObjUser)

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

56 : void
57 {
58 if ($this->isUserAllowedToDismiss($ilObjUser)) {
59 ilADNDismiss::dismiss($ilObjUser, $this);
60 }
61 }
static dismiss(ilObjUser $ilObjUser, ilADNNotification $ilADNNotification)
isUserAllowedToDismiss(ilObjUser $user)

References ilADNDismiss\dismiss(), and isUserAllowedToDismiss().

+ Here is the call graph for this function:

◆ getActiveType()

ilADNNotification::getActiveType ( )

Definition at line 102 of file class.ilADNNotification.php.

102 : int
103 {
104 if ($this->isPermanent()) {
105 return $this->getType();
106 }
107 if ($this->hasEventStarted() && !$this->hasEventEnded()) {
108 return $this->getTypeDuringEvent();
109 }
110 if ($this->hasDisplayStarted() && !$this->hasDisplayEnded()) {
111 return $this->getType();
112 }
113 return self::TYPE_INFO;
114 }

References getType(), getTypeDuringEvent(), hasDisplayEnded(), hasDisplayStarted(), hasEventEnded(), hasEventStarted(), isPermanent(), and TYPE_INFO.

+ Here is the call graph for this function:

◆ getBody()

ilADNNotification::getBody ( )

Definition at line 424 of file class.ilADNNotification.php.

424 : string
425 {
426 return $this->body;
427 }
string $body
@con_has_field true @con_fieldtype clob

References $body.

◆ getConnectorContainerName()

ilADNNotification::getConnectorContainerName ( )

@description Return the Name of your Connector Table

Reimplemented from ActiveRecord.

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

43 : string
44 {
45 return self::TABLE_NAME;
46 }

References TABLE_NAME.

◆ getCreateDate()

ilADNNotification::getCreateDate ( )

Definition at line 562 of file class.ilADNNotification.php.

562 : DateTimeImmutable
563 {
564 return $this->create_date ?? new DateTimeImmutable();
565 }

◆ getCreatedBy()

ilADNNotification::getCreatedBy ( )

Definition at line 572 of file class.ilADNNotification.php.

572 : int
573 {
574 return (int) $this->created_by;
575 }
int $created_by
@con_has_field true @con_fieldtype integer @con_length 8

References $created_by.

◆ getDismissable()

ilADNNotification::getDismissable ( )

Definition at line 517 of file class.ilADNNotification.php.

517 : bool
518 {
519 return $this->dismissable;
520 }
bool $dismissable
@con_has_field true @con_fieldtype integer @con_length 1

References $dismissable.

Referenced by hasUserDismissed(), and isUserAllowedToDismiss().

+ Here is the caller graph for this function:

◆ getDisplayEnd()

ilADNNotification::getDisplayEnd ( )

Definition at line 434 of file class.ilADNNotification.php.

434 : DateTimeImmutable
435 {
436 return $this->display_end ?? new DateTimeImmutable();
437 }

Referenced by hasDisplayEnded().

+ Here is the caller graph for this function:

◆ getDisplayStart()

ilADNNotification::getDisplayStart ( )

Definition at line 444 of file class.ilADNNotification.php.

444 : DateTimeImmutable
445 {
446 return $this->display_start ?? new DateTimeImmutable();
447 }

Referenced by hasDisplayStarted().

+ Here is the caller graph for this function:

◆ getEventEnd()

ilADNNotification::getEventEnd ( )

Definition at line 454 of file class.ilADNNotification.php.

454 : DateTimeImmutable
455 {
456 return $this->event_end ?? new DateTimeImmutable();
457 }

Referenced by getFullTimeFormated(), and hasEventEnded().

+ Here is the caller graph for this function:

◆ getEventStart()

ilADNNotification::getEventStart ( )

Definition at line 464 of file class.ilADNNotification.php.

464 : DateTimeImmutable
465 {
466 return $this->event_start ?? new DateTimeImmutable();
467 }

Referenced by getFullTimeFormated(), and hasEventStarted().

+ Here is the caller graph for this function:

◆ getFullTimeFormated()

ilADNNotification::getFullTimeFormated ( )

Definition at line 79 of file class.ilADNNotification.php.

79 : string
80 {
81 if ($this->getEventStart() == 0 && $this->getEventEnd() == 0) {
82 return '';
83 }
84 if (date(self::DATE_FORMAT, $this->getEventStart()) === date(self::DATE_FORMAT, $this->getEventEnd())) {
85 return date(self::DATE_FORMAT, $this->getEventEnd()) . ', ' . date(
86 self::TIME_FORMAT,
87 $this->getEventStart()
88 ) . " - "
89 . date(self::TIME_FORMAT, $this->getEventEnd());
90 }
91 return date(self::DATE_TIME_FORMAT, $this->getEventStart()) . ' - ' . date(
92 self::DATE_TIME_FORMAT,
93 $this->getEventEnd()
94 );
95 }

References getEventEnd(), and getEventStart().

+ Here is the call graph for this function:

◆ getId()

ilADNNotification::getId ( )

Definition at line 474 of file class.ilADNNotification.php.

474 : int
475 {
476 return (int) $this->id;
477 }
int $id
@con_is_primary true @con_sequence true @con_is_unique true @con_has_field true @con_fieldtype intege...

References $id.

Referenced by ilADNNotificationGUI\confirmDelete(), ilADNDismiss\dismiss(), ilADNDismiss\hasDimissed(), and resetForAllUsers().

+ Here is the caller graph for this function:

◆ getLimitedToLanguages()

ilADNNotification::getLimitedToLanguages ( )

Definition at line 592 of file class.ilADNNotification.php.

592 : array
593 {
595 }
array $limited_to_languages
@con_has_field true @con_fieldtype text @con_length 256

References $limited_to_languages.

Referenced by isVisibleToUserBasedOnLanguage().

+ Here is the caller graph for this function:

◆ getLimitedToRoleIds()

ilADNNotification::getLimitedToRoleIds ( )

Definition at line 612 of file class.ilADNNotification.php.

612 : array
613 {
615 }
array $limited_to_role_ids
@con_has_field true @con_fieldtype text @con_length 256

References $limited_to_role_ids.

Referenced by isVisibleRoleUserRoles().

+ Here is the caller graph for this function:

◆ getTime()

ilADNNotification::getTime ( )
protected

Definition at line 577 of file class.ilADNNotification.php.

577 : DateTimeImmutable
578 {
579 return new DateTimeImmutable();
580 }

Referenced by hasDisplayEnded(), hasDisplayStarted(), hasEventEnded(), and hasEventStarted().

+ Here is the caller graph for this function:

◆ getTitle()

ilADNNotification::getTitle ( )

Definition at line 484 of file class.ilADNNotification.php.

484 : string
485 {
486 return $this->title;
487 }
string $title
@con_has_field true @con_fieldtype text @con_length 256

References $title.

Referenced by ilADNNotificationGUI\confirmDelete().

+ Here is the caller graph for this function:

◆ getType()

ilADNNotification::getType ( )

Definition at line 494 of file class.ilADNNotification.php.

494 : int
495 {
496 return $this->type;
497 }
int $type
@con_has_field true @con_fieldtype integer @con_length 1

References $type.

Referenced by getActiveType().

+ Here is the caller graph for this function:

◆ getTypeDuringEvent()

ilADNNotification::getTypeDuringEvent ( )

Definition at line 504 of file class.ilADNNotification.php.

504 : int
505 {
506 return in_array(
507 $this->type_during_event,
508 [self::TYPE_WARNING, self::TYPE_ERROR, self::TYPE_INFO]
509 ) ? $this->type_during_event : self::TYPE_INFO;
510 }

References TYPE_INFO.

Referenced by getActiveType().

+ Here is the caller graph for this function:

◆ hasDisplayEnded()

ilADNNotification::hasDisplayEnded ( )
protected

Definition at line 537 of file class.ilADNNotification.php.

537 : bool
538 {
539 return $this->getTime() > $this->getDisplayEnd();
540 }

References getDisplayEnd(), and getTime().

Referenced by getActiveType(), and isVisible().

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

◆ hasDisplayStarted()

ilADNNotification::hasDisplayStarted ( )
protected

Definition at line 527 of file class.ilADNNotification.php.

527 : bool
528 {
529 return $this->getTime() > $this->getDisplayStart();
530 }

References getDisplayStart(), and getTime().

Referenced by getActiveType(), and isVisible().

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

◆ hasEventEnded()

ilADNNotification::hasEventEnded ( )
protected

Definition at line 532 of file class.ilADNNotification.php.

532 : bool
533 {
534 return $this->getTime() > $this->getEventEnd();
535 }

References getEventEnd(), and getTime().

Referenced by getActiveType(), isDuringEvent(), and isVisible().

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

◆ hasEventStarted()

ilADNNotification::hasEventStarted ( )
protected

Definition at line 522 of file class.ilADNNotification.php.

522 : bool
523 {
524 return $this->getTime() > $this->getEventStart();
525 }

References getEventStart(), and getTime().

Referenced by getActiveType(), isDuringEvent(), and isVisible().

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

◆ hasLanguageLimitation()

ilADNNotification::hasLanguageLimitation ( )

Definition at line 602 of file class.ilADNNotification.php.

602 : bool
603 {
605 }
bool $has_language_limitation
@con_has_field true @con_fieldtype integer @con_length 1

References $has_language_limitation.

Referenced by isVisibleToUserBasedOnLanguage().

+ Here is the caller graph for this function:

◆ hasUserDismissed()

ilADNNotification::hasUserDismissed ( ilObjUser  $ilObjUser)
protected

Definition at line 63 of file class.ilADNNotification.php.

63 : bool
64 {
65 if (!$this->getDismissable()) {
66 return false;
67 }
68
69 return ilADNDismiss::hasDimissed($ilObjUser, $this);
70 }
static hasDimissed(ilObjUser $ilObjUser, ilADNNotification $ilADNNotification)

References getDismissable(), and ilADNDismiss\hasDimissed().

Referenced by isVisibleForUser().

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

◆ isActive()

ilADNNotification::isActive ( )

Definition at line 582 of file class.ilADNNotification.php.

582 : bool
583 {
584 return $this->active;
585 }
bool $active
@con_has_field true @con_fieldtype integer @con_length 1

References $active.

◆ isDuringEvent()

ilADNNotification::isDuringEvent ( )

Definition at line 552 of file class.ilADNNotification.php.

552 : bool
553 {
554 return $this->hasEventStarted() && !$this->hasEventEnded();
555 }

References hasEventEnded(), and hasEventStarted().

+ Here is the call graph for this function:

◆ isLimitToRoles()

ilADNNotification::isLimitToRoles ( )

Definition at line 622 of file class.ilADNNotification.php.

622 : bool
623 {
625 }
bool $limit_to_roles
@con_has_field true @con_fieldtype integer @con_length 1

References $limit_to_roles.

Referenced by isVisibleRoleUserRoles().

+ Here is the caller graph for this function:

◆ isPermanent()

ilADNNotification::isPermanent ( )

Definition at line 547 of file class.ilADNNotification.php.

547 : bool
548 {
549 return $this->permanent;
550 }
bool $permanent
@con_has_field true @con_fieldtype integer @con_length 1

References $permanent.

Referenced by getActiveType(), and isVisible().

+ Here is the caller graph for this function:

◆ isUserAllowedToDismiss()

ilADNNotification::isUserAllowedToDismiss ( ilObjUser  $user)

Definition at line 97 of file class.ilADNNotification.php.

97 : bool
98 {
99 return ($this->getDismissable() && $user->getId() !== 0 && $user->getId() !== ANONYMOUS_USER_ID);
100 }
const ANONYMOUS_USER_ID
Definition: constants.php:27

References ANONYMOUS_USER_ID, getDismissable(), and ilObject\getId().

Referenced by dismiss(), and ilADNDismiss\dismiss().

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

◆ isVisible()

ilADNNotification::isVisible ( )
protected

Definition at line 117 of file class.ilADNNotification.php.

117 : bool
118 {
119 if ($this->isPermanent()) {
120 return true;
121 }
122 $hasEventStarted = $this->hasEventStarted();
123 $hasDisplayStarted = $this->hasDisplayStarted();
124 $hasEventEnded = !$this->hasEventEnded();
125 $hasDisplayEnded = !$this->hasDisplayEnded();
126
127 return ($hasEventStarted || $hasDisplayStarted)
128 && ($hasEventEnded || $hasDisplayEnded);
129 }

References hasDisplayEnded(), hasDisplayStarted(), hasEventEnded(), hasEventStarted(), and isPermanent().

Referenced by isVisibleForUser().

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

◆ isVisibleForUser()

ilADNNotification::isVisibleForUser ( ilObjUser  $ilObjUser)

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

131 : bool
132 {
133 if ($ilObjUser->getId() === 0 && $this->interruptive) {
134 return false;
135 }
136 if (!$this->isVisible()) {
137 return false;
138 }
139 if ($this->hasUserDismissed($ilObjUser)) {
140 return false;
141 }
142 return ($this->isVisibleToUserBasedOnLanguage($ilObjUser) && $this->isVisibleRoleUserRoles($ilObjUser));
143 }
hasUserDismissed(ilObjUser $ilObjUser)
isVisibleToUserBasedOnLanguage(ilObjUser $user)
isVisibleRoleUserRoles(ilObjUser $ilObjUser)

References ilObject\getId(), hasUserDismissed(), isVisible(), isVisibleRoleUserRoles(), and isVisibleToUserBasedOnLanguage().

+ Here is the call graph for this function:

◆ isVisibleRoleUserRoles()

ilADNNotification::isVisibleRoleUserRoles ( ilObjUser  $ilObjUser)
protected

Definition at line 165 of file class.ilADNNotification.php.

165 : bool
166 {
167 if (!$this->isLimitToRoles()) {
168 return true;
169 }
170 global $DIC;
171
172 if ($ilObjUser->getId() === 0 && in_array(0, $this->getLimitedToRoleIds())) {
173 return true;
174 }
175
176 return $DIC->rbac()->review()->isAssignedToAtLeastOneGivenRole(
177 $ilObjUser->getId(),
178 $this->getLimitedToRoleIds()
179 );
180 }

References $DIC, ilObject\getId(), getLimitedToRoleIds(), and isLimitToRoles().

Referenced by isVisibleForUser().

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

◆ isVisibleToUserBasedOnLanguage()

ilADNNotification::isVisibleToUserBasedOnLanguage ( ilObjUser  $user)
protected

Definition at line 145 of file class.ilADNNotification.php.

145 : bool
146 {
147 if (!$this->hasLanguageLimitation()) {
148 return true;
149 }
150
151 // Special case for anonymous user
152 if ($user->isAnonymous()) {
153 // current language
154 global $DIC;
155 $current_language = $DIC->http()->request()->getQueryParams()['lang']
156 ?? $DIC->language()->getDefaultLanguage();
157 } else {
158 $current_language = $user->getLanguage();
159 }
160
161 return in_array($current_language, $this->getLimitedToLanguages(), true);
162 }

References $DIC, ilObjUser\getLanguage(), getLimitedToLanguages(), hasLanguageLimitation(), and ilObjUser\isAnonymous().

Referenced by isVisibleForUser().

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

◆ resetForAllUsers()

ilADNNotification::resetForAllUsers ( )

Definition at line 72 of file class.ilADNNotification.php.

72 : void
73 {
74 foreach (ilADNDismiss::where(['notification_id' => $this->getId()])->get() as $not) {
75 $not->delete();
76 }
77 }
static where($where, $operator=null)

References getId(), and ActiveRecord\where().

+ Here is the call graph for this function:

◆ returnDbTableName()

static ilADNNotification::returnDbTableName ( )
static
Deprecated:

Reimplemented from ActiveRecord.

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

51 : string
52 {
53 return self::TABLE_NAME;
54 }

References TABLE_NAME.

◆ setActive()

ilADNNotification::setActive ( bool  $active)

Definition at line 587 of file class.ilADNNotification.php.

587 : void
588 {
589 $this->active = $active;
590 }

References $active.

◆ setBody()

ilADNNotification::setBody ( string  $body)

Definition at line 419 of file class.ilADNNotification.php.

419 : void
420 {
421 $this->body = $body;
422 }

References $body.

◆ setCreateDate()

ilADNNotification::setCreateDate ( DateTimeImmutable  $create_date)

Definition at line 557 of file class.ilADNNotification.php.

557 : void
558 {
559 $this->create_date = $create_date;
560 }
DateTimeImmutable $create_date
@con_has_field true @con_fieldtype integer @con_length 8

References $create_date.

Referenced by create().

+ Here is the caller graph for this function:

◆ setCreatedBy()

ilADNNotification::setCreatedBy ( int  $created_by)

Definition at line 567 of file class.ilADNNotification.php.

567 : void
568 {
569 $this->created_by = $created_by;
570 }

References $created_by.

Referenced by create().

+ Here is the caller graph for this function:

◆ setDismissable()

ilADNNotification::setDismissable ( bool  $dismissable)

Definition at line 512 of file class.ilADNNotification.php.

512 : void
513 {
514 $this->dismissable = $dismissable;
515 }

References $dismissable.

◆ setDisplayEnd()

ilADNNotification::setDisplayEnd ( DateTimeImmutable  $display_end)

Definition at line 429 of file class.ilADNNotification.php.

429 : void
430 {
431 $this->display_end = $display_end;
432 }
DateTimeImmutable $display_end
@con_has_field true @con_fieldtype integer @con_length 8

References $display_end.

◆ setDisplayStart()

ilADNNotification::setDisplayStart ( DateTimeImmutable  $display_start)

Definition at line 439 of file class.ilADNNotification.php.

439 : void
440 {
441 $this->display_start = $display_start;
442 }
DateTimeImmutable $display_start
@con_has_field true @con_fieldtype integer @con_length 8

References $display_start.

◆ setEventEnd()

ilADNNotification::setEventEnd ( DateTimeImmutable  $event_end)

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

449 : void
450 {
451 $this->event_end = $event_end;
452 }
DateTimeImmutable $event_end
@con_has_field true @con_fieldtype integer @con_length 8

References $event_end.

◆ setEventStart()

ilADNNotification::setEventStart ( DateTimeImmutable  $event_start)

Definition at line 459 of file class.ilADNNotification.php.

459 : void
460 {
461 $this->event_start = $event_start;
462 }
DateTimeImmutable $event_start
@con_has_field true @con_fieldtype integer @con_length 8

References $event_start.

◆ setHasLanguageLimitation()

ilADNNotification::setHasLanguageLimitation ( bool  $has_language_limitation)

Definition at line 607 of file class.ilADNNotification.php.

607 : void
608 {
609 $this->has_language_limitation = $has_language_limitation;
610 }

References $has_language_limitation.

◆ setId()

ilADNNotification::setId ( int  $id)

Definition at line 469 of file class.ilADNNotification.php.

469 : void
470 {
471 $this->id = $id;
472 }

References $id.

◆ setLimitedToLanguages()

ilADNNotification::setLimitedToLanguages ( array  $limited_to_languages)

Definition at line 597 of file class.ilADNNotification.php.

597 : void
598 {
599 $this->limited_to_languages = $limited_to_languages;
600 }

References $limited_to_languages.

◆ setLimitedToRoleIds()

ilADNNotification::setLimitedToRoleIds ( array  $limited_to_role_ids)

Definition at line 617 of file class.ilADNNotification.php.

617 : void
618 {
619 $this->limited_to_role_ids = $limited_to_role_ids;
620 }

References $limited_to_role_ids.

◆ setLimitToRoles()

ilADNNotification::setLimitToRoles ( bool  $limit_to_roles)

Definition at line 627 of file class.ilADNNotification.php.

627 : void
628 {
629 $this->limit_to_roles = $limit_to_roles;
630 }

References $limit_to_roles.

◆ setPermanent()

ilADNNotification::setPermanent ( bool  $permanent)

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

542 : void
543 {
544 $this->permanent = $permanent;
545 }

References $permanent.

◆ setTitle()

ilADNNotification::setTitle ( string  $title)

Definition at line 479 of file class.ilADNNotification.php.

479 : void
480 {
481 $this->title = $title;
482 }

References $title.

◆ setType()

ilADNNotification::setType ( int  $type)

Definition at line 489 of file class.ilADNNotification.php.

489 : void
490 {
491 $this->type = $type;
492 }

References $type.

◆ setTypeDuringEvent()

ilADNNotification::setTypeDuringEvent ( int  $type_during_event)

Definition at line 499 of file class.ilADNNotification.php.

499 : void
500 {
501 $this->type_during_event = $type_during_event;
502 }
int $type_during_event
@con_has_field true @con_fieldtype integer @con_length 1

References $type_during_event.

◆ wakeUp()

ilADNNotification::wakeUp (   $field_name,
  $field_value 
)
Parameters
string$field_name
mixed$field_value
Returns
int|mixed

Reimplemented from ActiveRecord.

Definition at line 346 of file class.ilADNNotification.php.

347 {
348 switch ($field_name) {
349 case 'event_start':
350 case 'event_end':
351 case 'display_end':
352 case 'display_start':
353 case 'create_date':
354 case 'last_update':
355 return (new DateTimeImmutable())->setTimestamp((int) $field_value);
356
357 case 'allowed_users':
358 if ($field_value === null) {
359 $array_unique = self::$allowed_user_ids;
360 } else {
361 $json_decode = json_decode((string) $field_value, true);
362 if (!is_array($json_decode)) {
363 $json_decode = self::$allowed_user_ids;
364 }
365 $array_unique = array_unique($json_decode);
366 }
367
368 sort($array_unique);
369
370 return $array_unique;
371 case 'limited_to_languages':
372 case 'limited_to_role_ids':
373 return json_decode((string) $field_value, true);
374 }
375 return null;
376 }

References $allowed_user_ids, and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

+ Here is the call graph for this function:

Field Documentation

◆ $active

bool ilADNNotification::$active = true
protected

@con_has_field true @con_fieldtype integer @con_length 1

Definition at line 291 of file class.ilADNNotification.php.

Referenced by isActive(), and setActive().

◆ $allowed_user_ids

array ilADNNotification::$allowed_user_ids = [0, 13, 6]
staticprotected

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

Referenced by wakeUp().

◆ $allowed_users

array ilADNNotification::$allowed_users = [0, 6, 13]
protected

@con_has_field true @con_fieldtype text @con_length 256

Definition at line 255 of file class.ilADNNotification.php.

◆ $body

string ilADNNotification::$body = ''
protected

@con_has_field true @con_fieldtype clob

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

Referenced by getBody(), and setBody().

◆ $create_date

DateTimeImmutable ilADNNotification::$create_date = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

Definition at line 267 of file class.ilADNNotification.php.

Referenced by setCreateDate().

◆ $created_by

int ilADNNotification::$created_by = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

Definition at line 279 of file class.ilADNNotification.php.

Referenced by getCreatedBy(), and setCreatedBy().

◆ $dismissable

bool ilADNNotification::$dismissable = true
protected

@con_has_field true @con_fieldtype integer @con_length 1

Definition at line 243 of file class.ilADNNotification.php.

Referenced by getDismissable(), and setDismissable().

◆ $display_end

DateTimeImmutable ilADNNotification::$display_end = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

Definition at line 225 of file class.ilADNNotification.php.

Referenced by setDisplayEnd().

◆ $display_start

DateTimeImmutable ilADNNotification::$display_start = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

Definition at line 219 of file class.ilADNNotification.php.

Referenced by setDisplayStart().

◆ $event_end

DateTimeImmutable ilADNNotification::$event_end = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

Definition at line 213 of file class.ilADNNotification.php.

Referenced by setEventEnd().

◆ $event_start

DateTimeImmutable ilADNNotification::$event_start = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

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

Referenced by setEventStart().

◆ $has_language_limitation

bool ilADNNotification::$has_language_limitation = false
protected

@con_has_field true @con_fieldtype integer @con_length 1

Definition at line 303 of file class.ilADNNotification.php.

Referenced by hasLanguageLimitation(), and setHasLanguageLimitation().

◆ $id

int ilADNNotification::$id = null
protected

@con_is_primary true @con_sequence true @con_is_unique true @con_has_field true @con_fieldtype integer @con_length 8

Definition at line 190 of file class.ilADNNotification.php.

Referenced by getId(), and setId().

◆ $interruptive

bool ilADNNotification::$interruptive = false
protected

@con_has_field true @con_fieldtype integer @con_length 1

Definition at line 321 of file class.ilADNNotification.php.

◆ $last_update

DateTimeImmutable ilADNNotification::$last_update
protected

@con_has_field true @con_fieldtype integer @con_length 8

Definition at line 273 of file class.ilADNNotification.php.

◆ $last_update_by

int ilADNNotification::$last_update_by = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

Definition at line 285 of file class.ilADNNotification.php.

◆ $limit_to_roles

bool ilADNNotification::$limit_to_roles = false
protected

@con_has_field true @con_fieldtype integer @con_length 1

Definition at line 315 of file class.ilADNNotification.php.

Referenced by isLimitToRoles(), and setLimitToRoles().

◆ $limited_to_languages

array ilADNNotification::$limited_to_languages = []
protected

@con_has_field true @con_fieldtype text @con_length 256

Definition at line 297 of file class.ilADNNotification.php.

Referenced by getLimitedToLanguages(), and setLimitedToLanguages().

◆ $limited_to_role_ids

array ilADNNotification::$limited_to_role_ids = []
protected

@con_has_field true @con_fieldtype text @con_length 256

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

Referenced by getLimitedToRoleIds(), and setLimitedToRoleIds().

◆ $link

string ilADNNotification::$link = ''
protected

@con_has_field true @con_fieldtype text @con_length 256

Definition at line 327 of file class.ilADNNotification.php.

◆ $link_target

string ilADNNotification::$link_target = '_top'
protected

@con_has_field true @con_fieldtype text @con_length 256

Definition at line 339 of file class.ilADNNotification.php.

◆ $link_type

int ilADNNotification::$link_type = self::LINK_TYPE_NONE
protected

@con_has_field true @con_fieldtype integer @con_length 1

Definition at line 333 of file class.ilADNNotification.php.

◆ $parent_id

int ilADNNotification::$parent_id = null
protected

@con_has_field true @con_fieldtype integer @con_length 8

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

◆ $permanent

bool ilADNNotification::$permanent = true
protected

@con_has_field true @con_fieldtype integer @con_length 1

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

Referenced by isPermanent(), and setPermanent().

◆ $title

string ilADNNotification::$title = ''
protected

@con_has_field true @con_fieldtype text @con_length 256

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

Referenced by getTitle(), and setTitle().

◆ $type

int ilADNNotification::$type = self::TYPE_INFO
protected

@con_has_field true @con_fieldtype integer @con_length 1

Definition at line 231 of file class.ilADNNotification.php.

Referenced by getType(), and setType().

◆ $type_during_event

int ilADNNotification::$type_during_event = self::TYPE_ERROR
protected

@con_has_field true @con_fieldtype integer @con_length 1

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

Referenced by setTypeDuringEvent().

◆ DATE_FORMAT

const ilADNNotification::DATE_FORMAT = 'd.m.Y'

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

◆ DATE_TIME_FORMAT

const ilADNNotification::DATE_TIME_FORMAT = 'd.m.Y H:i'

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

◆ LINK_TYPE_NONE

const ilADNNotification::LINK_TYPE_NONE = 0

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

◆ LINK_TYPE_REF_ID

const ilADNNotification::LINK_TYPE_REF_ID = 1

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

◆ LINK_TYPE_URL

const ilADNNotification::LINK_TYPE_URL = 2

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

◆ POS_BOTTOM

const ilADNNotification::POS_BOTTOM = 4

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

◆ POS_RIGHT

const ilADNNotification::POS_RIGHT = 2

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

◆ POS_TOP

const ilADNNotification::POS_TOP = 1

Definition at line 26 of file class.ilADNNotification.php.

◆ POST_LEFT

const ilADNNotification::POST_LEFT = 3

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

◆ TABLE_NAME

const ilADNNotification::TABLE_NAME = 'il_adn_notifications'

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

Referenced by getConnectorContainerName(), and returnDbTableName().

◆ TIME_FORMAT

const ilADNNotification::TIME_FORMAT = 'H:i'

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

◆ TYPE_ERROR

◆ TYPE_INFO

const ilADNNotification::TYPE_INFO = 1

◆ TYPE_WARNING


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