ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Notifications\Model\ilNotificationConfig Class Reference
+ Collaboration diagram for ILIAS\Notifications\Model\ilNotificationConfig:

Public Member Functions

 __construct (private readonly string $provider, private ?NotificationIdentification $identification=null)
 
 getType ()
 
 setAutoDisable (bool $value)
 
 hasDisableAfterDeliverySet ()
 
 setLinks (array $links)
 
 getLinks ()
 
 setIconPath (string $path)
 
 getIconPath ()
 
 setTitleVar (string $name, array $parameters=[], string $language_module='notification')
 
 getTitleVar ()
 
 setShortDescriptionVar (string $name, array $parameters=[], string $language_module='notification')
 
 getShortDescriptionVar ()
 
 setLongDescriptionVar (string $name, array $parameters=[], string $language_module='notification')
 
 getLongDescriptionVar ()
 
 getLanguageParameters ()
 
 setValidForSeconds (int $seconds)
 
 getValidForSeconds ()
 
 getVisibleForSeconds ()
 
 setVisibleForSeconds (int $visibleForSeconds)
 
 notifyByUsers (array $recipients, bool $processAsync=false)
 
 notifyByListeners (int $ref_id, bool $processAsync=false)
 
 notifyByRoles (array $roles, bool $processAsync=false)
 
 getUserInstance (ilObjUser $user, array $languageVars, string $defaultLanguage)
 
 setHandlerParam (string $name, string $value)
 
 getHandlerParams ()
 
 unsetHandlerParam (string $name)
 
 setIdentification (NotificationIdentification $identification)
 
 getIdentification ()
 

Data Fields

final const TTL_LONG = 1800
 
final const TTL_SHORT = 120
 
final const DEFAULT_TTS = 5
 

Protected Member Functions

 beforeSendToUsers ()
 
 afterSendToUsers ()
 
 beforeSendToListeners ()
 
 afterSendToListeners ()
 

Protected Attributes

int $visibleForSeconds = 0
 

Private Attributes

array $links = []
 
ilNotificationParameter $title
 
string $iconPath
 
ilNotificationParameter $short_description
 
ilNotificationParameter $long_description
 
bool $disableAfterDelivery = false
 
int $validForSeconds = 0
 
array $handlerParams = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Notifications\Model\ilNotificationConfig::__construct ( private readonly string  $provider,
private ?NotificationIdentification  $identification = null 
)

Definition at line 49 of file ilNotificationConfig.php.

50 {
51 if ($identification === null) {
52 $identification = new NotificationIdentification($provider, 'default');
53 }
54 $this->identification = $identification;
55 }
$provider
Definition: ltitoken.php:80

References $provider.

Member Function Documentation

◆ afterSendToListeners()

ILIAS\Notifications\Model\ilNotificationConfig::afterSendToListeners ( )
protected

Definition at line 196 of file ilNotificationConfig.php.

196 : void
197 {
198 }

◆ afterSendToUsers()

ILIAS\Notifications\Model\ilNotificationConfig::afterSendToUsers ( )
protected

Definition at line 188 of file ilNotificationConfig.php.

188 : void
189 {
190 }

◆ beforeSendToListeners()

ILIAS\Notifications\Model\ilNotificationConfig::beforeSendToListeners ( )
protected

Definition at line 192 of file ilNotificationConfig.php.

192 : void
193 {
194 }

◆ beforeSendToUsers()

ILIAS\Notifications\Model\ilNotificationConfig::beforeSendToUsers ( )
protected

Definition at line 184 of file ilNotificationConfig.php.

184 : void
185 {
186 }

◆ getHandlerParams()

ILIAS\Notifications\Model\ilNotificationConfig::getHandlerParams ( )
Returns
array<string, array<string, string>>

Definition at line 303 of file ilNotificationConfig.php.

◆ getIconPath()

ILIAS\Notifications\Model\ilNotificationConfig::getIconPath ( )

◆ getIdentification()

ILIAS\Notifications\Model\ilNotificationConfig::getIdentification ( )

Definition at line 318 of file ilNotificationConfig.php.

319 {
320 return $this->identification;
321 }

Referenced by ILIAS\Notifications\ilNotificationSystem\toUsers().

+ Here is the caller graph for this function:

◆ getLanguageParameters()

ILIAS\Notifications\Model\ilNotificationConfig::getLanguageParameters ( )
Returns
array<string, ilNotificationParameter>

Definition at line 146 of file ilNotificationConfig.php.

146 : array
147 {
148 $params = [
149 'title' => $this->title,
150 'longDescription' => $this->long_description,
151 'shortDescription' => $this->short_description,
152 ];
153
154 foreach ($this->links as $id => $link) {
155 $params['link_' . $id] = $link->getTitleParameter();
156 }
157
158 return $params;
159 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31

References $id, and $params.

Referenced by ILIAS\Notifications\ilNotificationSystem\toUsers().

+ Here is the caller graph for this function:

◆ getLinks()

ILIAS\Notifications\Model\ilNotificationConfig::getLinks ( )
Returns
list<ilNotificationLink>

Definition at line 83 of file ilNotificationConfig.php.

References ILIAS\Notifications\Model\ilNotificationConfig\$links.

◆ getLongDescriptionVar()

ILIAS\Notifications\Model\ilNotificationConfig::getLongDescriptionVar ( )

Definition at line 138 of file ilNotificationConfig.php.

138 : string
139 {
140 return $this->long_description->getName();
141 }

◆ getShortDescriptionVar()

ILIAS\Notifications\Model\ilNotificationConfig::getShortDescriptionVar ( )

Definition at line 122 of file ilNotificationConfig.php.

122 : string
123 {
124 return $this->short_description->getName();
125 }

◆ getTitleVar()

ILIAS\Notifications\Model\ilNotificationConfig::getTitleVar ( )

Definition at line 106 of file ilNotificationConfig.php.

106 : string
107 {
108 return $this->title->getName();
109 }

◆ getType()

ILIAS\Notifications\Model\ilNotificationConfig::getType ( )

◆ getUserInstance()

ILIAS\Notifications\Model\ilNotificationConfig::getUserInstance ( ilObjUser  $user,
array  $languageVars,
string  $defaultLanguage 
)
Parameters
array<string,stdClass>$languageVars

Definition at line 228 of file ilNotificationConfig.php.

228 : ilNotificationObject
229 {
230 $notificationObject = new ilNotificationObject($this, $user);
231
232 $title = $this->title->getName();
233 if (isset($languageVars[$this->title->getName()])) {
234 $var = $languageVars[$this->title->getName()]->lang;
235 if (isset($var[$user->getLanguage()])) {
236 $title = $var[$user->getLanguage()];
237 } elseif (isset($var[$defaultLanguage])) {
238 $title = $var[$defaultLanguage];
239 }
240 }
241 $notificationObject->title = $title;
242
243 $short = $this->short_description->getName();
244 if (isset($languageVars[$this->short_description->getName()])) {
245 $var = $languageVars[$this->short_description->getName()]->lang;
246 if (isset($var[$user->getLanguage()])) {
247 $short = $var[$user->getLanguage()];
248 } elseif (isset($var[$defaultLanguage])) {
249 $short = $var[$defaultLanguage];
250 }
251 }
252 $notificationObject->shortDescription = $short;
253
254 $long = $this->long_description->getName();
255 if (isset($languageVars[$this->long_description->getName()])) {
256 $var = $languageVars[$this->long_description->getName()]->lang;
257 if (isset($var[$user->getLanguage()])) {
258 $long = $var[$user->getLanguage()];
259 } elseif (isset($var[$defaultLanguage])) {
260 $long = $var[$defaultLanguage];
261 }
262 }
263 $notificationObject->longDescription = $long;
264
265 $process_links = [];
266 foreach ($this->links as $link) {
267 $link_title = $link->getTitleParameter()->getName();
268 if (isset($languageVars[$link->getTitleParameter()->getName()])) {
269 $var = $languageVars[$link->getTitleParameter()->getName()]->lang;
270 if (isset($var[$user->getLanguage()])) {
271 $link_title = $var[$user->getLanguage()];
272 } elseif (isset($var[$defaultLanguage])) {
273 $link_title = $var[$defaultLanguage];
274 }
275 }
276
277 $process_link = clone $link;
278 $process_link->setTitle($link_title);
279 $process_links[] = $process_link;
280 }
281 $notificationObject->links = $process_links;
282
283 $notificationObject->iconPath = $this->iconPath;
284
285 return $notificationObject;
286 }
$defaultLanguage
Definition: xapiexit.php:23

References $defaultLanguage, ilObjUser\getLanguage(), and ILIAS\Notifications\Model\ilNotificationParameter\getName().

Referenced by ILIAS\Notifications\ilNotificationSystem\toUsers().

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

◆ getValidForSeconds()

ILIAS\Notifications\Model\ilNotificationConfig::getValidForSeconds ( )

◆ getVisibleForSeconds()

ILIAS\Notifications\Model\ilNotificationConfig::getVisibleForSeconds ( )

◆ hasDisableAfterDeliverySet()

ILIAS\Notifications\Model\ilNotificationConfig::hasDisableAfterDeliverySet ( )

◆ notifyByListeners()

ILIAS\Notifications\Model\ilNotificationConfig::notifyByListeners ( int  $ref_id,
bool  $processAsync = false 
)
final

Definition at line 210 of file ilNotificationConfig.php.

210 : void
211 {
212 $this->beforeSendToListeners();
214 $this->afterSendToListeners();
215 }
static sendNotificationToListeners(ilNotificationConfig $notification, int $ref_id, bool $processAsync=false)
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ notifyByRoles()

ILIAS\Notifications\Model\ilNotificationConfig::notifyByRoles ( array  $roles,
bool  $processAsync = false 
)
final
Parameters
list<int>$roles

Definition at line 220 of file ilNotificationConfig.php.

220 : void
221 {
222 ilNotificationSystem::sendNotificationToRoles($this, $roles, $processAsync);
223 }
static sendNotificationToRoles(ilNotificationConfig $notification, array $roles, bool $processAsync=false)

◆ notifyByUsers()

ILIAS\Notifications\Model\ilNotificationConfig::notifyByUsers ( array  $recipients,
bool  $processAsync = false 
)
final
Parameters
list<int>$recipients

Definition at line 203 of file ilNotificationConfig.php.

203 : void
204 {
205 $this->beforeSendToUsers();
206 ilNotificationSystem::sendNotificationToUsers($this, $recipients, $processAsync);
207 $this->afterSendToUsers();
208 }
static sendNotificationToUsers(ilNotificationConfig $notification, array $users, bool $processAsync=false)

◆ setAutoDisable()

ILIAS\Notifications\Model\ilNotificationConfig::setAutoDisable ( bool  $value)

Definition at line 62 of file ilNotificationConfig.php.

62 : void
63 {
64 $this->disableAfterDelivery = $value;
65 }

◆ setHandlerParam()

ILIAS\Notifications\Model\ilNotificationConfig::setHandlerParam ( string  $name,
string  $value 
)

Definition at line 288 of file ilNotificationConfig.php.

288 : void
289 {
290 if (strpos($name, '.')) {
291 $nsParts = explode('.', $name, 2);
292 $ns = $nsParts[0];
293 $field = $nsParts[1];
294 $this->handlerParams[$ns][$field] = $value;
295 } else {
296 $this->handlerParams[''][$name] = $value;
297 }
298 }

◆ setIconPath()

ILIAS\Notifications\Model\ilNotificationConfig::setIconPath ( string  $path)

Definition at line 88 of file ilNotificationConfig.php.

88 : void
89 {
90 $this->iconPath = $path;
91 }
$path
Definition: ltiservices.php:30

References $path.

◆ setIdentification()

ILIAS\Notifications\Model\ilNotificationConfig::setIdentification ( NotificationIdentification  $identification)

Definition at line 313 of file ilNotificationConfig.php.

313 : void
314 {
315 $this->identification = $identification;
316 }

◆ setLinks()

ILIAS\Notifications\Model\ilNotificationConfig::setLinks ( array  $links)
Parameters
list<ilNotificationLink>$links

Definition at line 75 of file ilNotificationConfig.php.

75 : void
76 {
77 $this->links = $links;
78 }

References ILIAS\Notifications\Model\ilNotificationConfig\$links.

◆ setLongDescriptionVar()

ILIAS\Notifications\Model\ilNotificationConfig::setLongDescriptionVar ( string  $name,
array  $parameters = [],
string  $language_module = 'notification' 
)
Parameters
array<string,string>$parameters

Definition at line 130 of file ilNotificationConfig.php.

134 : void {
135 $this->long_description = new ilNotificationParameter($name, $parameters, $language_module);
136 }
description of a localized parameter this information is used locate translations while processing no...

◆ setShortDescriptionVar()

ILIAS\Notifications\Model\ilNotificationConfig::setShortDescriptionVar ( string  $name,
array  $parameters = [],
string  $language_module = 'notification' 
)
Parameters
array<string,string>$parameters

Definition at line 114 of file ilNotificationConfig.php.

118 : void {
119 $this->short_description = new ilNotificationParameter($name, $parameters, $language_module);
120 }

◆ setTitleVar()

ILIAS\Notifications\Model\ilNotificationConfig::setTitleVar ( string  $name,
array  $parameters = [],
string  $language_module = 'notification' 
)
Parameters
array<string,string>$parameters

Definition at line 101 of file ilNotificationConfig.php.

101 : void
102 {
103 $this->title = new ilNotificationParameter($name, $parameters, $language_module);
104 }

◆ setValidForSeconds()

ILIAS\Notifications\Model\ilNotificationConfig::setValidForSeconds ( int  $seconds)

Definition at line 161 of file ilNotificationConfig.php.

161 : void
162 {
163 $this->validForSeconds = $seconds;
164 }

◆ setVisibleForSeconds()

ILIAS\Notifications\Model\ilNotificationConfig::setVisibleForSeconds ( int  $visibleForSeconds)
Deprecated:
since notifications are no longer used for popup presentation. See the GS Scope Toast for more information.

Definition at line 179 of file ilNotificationConfig.php.

179 : void
180 {
181 $this->visibleForSeconds = $visibleForSeconds;
182 }

◆ unsetHandlerParam()

ILIAS\Notifications\Model\ilNotificationConfig::unsetHandlerParam ( string  $name)

Definition at line 308 of file ilNotificationConfig.php.

308 : void
309 {
310 unset($this->handlerParams[$name]);
311 }

Field Documentation

◆ $disableAfterDelivery

bool ILIAS\Notifications\Model\ilNotificationConfig::$disableAfterDelivery = false
private

◆ $handlerParams

array ILIAS\Notifications\Model\ilNotificationConfig::$handlerParams = []
private

Definition at line 47 of file ilNotificationConfig.php.

◆ $iconPath

string ILIAS\Notifications\Model\ilNotificationConfig::$iconPath
private

◆ $links

array ILIAS\Notifications\Model\ilNotificationConfig::$links = []
private

◆ $long_description

ilNotificationParameter ILIAS\Notifications\Model\ilNotificationConfig::$long_description
private

Definition at line 42 of file ilNotificationConfig.php.

◆ $short_description

ilNotificationParameter ILIAS\Notifications\Model\ilNotificationConfig::$short_description
private

Definition at line 41 of file ilNotificationConfig.php.

◆ $title

ilNotificationParameter ILIAS\Notifications\Model\ilNotificationConfig::$title
private

Definition at line 39 of file ilNotificationConfig.php.

◆ $validForSeconds

int ILIAS\Notifications\Model\ilNotificationConfig::$validForSeconds = 0
private

Definition at line 44 of file ilNotificationConfig.php.

◆ $visibleForSeconds

int ILIAS\Notifications\Model\ilNotificationConfig::$visibleForSeconds = 0
protected

Definition at line 45 of file ilNotificationConfig.php.

◆ DEFAULT_TTS

final const ILIAS\Notifications\Model\ilNotificationConfig::DEFAULT_TTS = 5

Definition at line 35 of file ilNotificationConfig.php.

◆ TTL_LONG

final const ILIAS\Notifications\Model\ilNotificationConfig::TTL_LONG = 1800

Definition at line 33 of file ilNotificationConfig.php.

◆ TTL_SHORT

final const ILIAS\Notifications\Model\ilNotificationConfig::TTL_SHORT = 120

Definition at line 34 of file ilNotificationConfig.php.


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