ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References null.

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

Member Function Documentation

◆ afterSendToListeners()

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

Definition at line 196 of file ilNotificationConfig.php.

Referenced by ILIAS\Notifications\Model\ilNotificationConfig\notifyByListeners().

196  : void
197  {
198  }
+ Here is the caller graph for this function:

◆ afterSendToUsers()

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

Definition at line 188 of file ilNotificationConfig.php.

Referenced by ILIAS\Notifications\Model\ilNotificationConfig\notifyByUsers().

188  : void
189  {
190  }
+ Here is the caller graph for this function:

◆ beforeSendToListeners()

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

Definition at line 192 of file ilNotificationConfig.php.

Referenced by ILIAS\Notifications\Model\ilNotificationConfig\notifyByListeners().

192  : void
193  {
194  }
+ Here is the caller graph for this function:

◆ beforeSendToUsers()

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

Definition at line 184 of file ilNotificationConfig.php.

Referenced by ILIAS\Notifications\Model\ilNotificationConfig\notifyByUsers().

184  : void
185  {
186  }
+ Here is the caller graph for this function:

◆ getHandlerParams()

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

Definition at line 303 of file ilNotificationConfig.php.

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

303  : array
304  {
305  return $this->handlerParams;
306  }

◆ getIconPath()

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

◆ getIdentification()

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

Definition at line 318 of file ilNotificationConfig.php.

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

318  : NotificationIdentification
319  {
320  return $this->identification;
321  }
+ 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.

References $id, ILIAS\Notifications\Model\ilNotificationConfig\$long_description, $params, ILIAS\Notifications\Model\ilNotificationConfig\$short_description, and ILIAS\Notifications\Model\ilNotificationConfig\$title.

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

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  }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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.

83  : array
84  {
85  return $this->links;
86  }

◆ 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 ( )

Definition at line 57 of file ilNotificationConfig.php.

References $provider.

Referenced by ILIAS\Notifications\ilNotificationDatabaseHandler\enqueueByListener(), ILIAS\Notifications\ilNotificationSystem\toListeners(), and ILIAS\Notifications\ilNotificationSystem\toUsers().

57  : string
58  {
59  return $this->provider;
60  }
$provider
Definition: ltitoken.php:80
+ Here is the caller graph for this function:

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

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

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

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

Definition at line 67 of file ilNotificationConfig.php.

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

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

+ Here is the caller graph for this function:

◆ notifyByListeners()

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

◆ notifyByRoles()

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

Definition at line 220 of file ilNotificationConfig.php.

References ILIAS\Notifications\ilNotificationSystem\sendNotificationToRoles().

220  : void
221  {
222  ilNotificationSystem::sendNotificationToRoles($this, $roles, $processAsync);
223  }
static sendNotificationToRoles(ilNotificationConfig $notification, array $roles, bool $processAsync=false)
+ Here is the call graph for this function:

◆ notifyByUsers()

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

Definition at line 203 of file ilNotificationConfig.php.

References ILIAS\Notifications\Model\ilNotificationConfig\afterSendToUsers(), ILIAS\Notifications\Model\ilNotificationConfig\beforeSendToUsers(), and ILIAS\Notifications\ilNotificationSystem\sendNotificationToUsers().

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)
+ Here is the call graph for this function:

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

References $path.

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

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

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

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

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

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

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

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

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

◆ $short_description

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

◆ $title

◆ $validForSeconds

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

◆ $visibleForSeconds

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

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