ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilNotificationConfig Class Reference

Describes a notification and provides methods for publishing this notification. More...

+ Collaboration diagram for ilNotificationConfig:

Public Member Functions

 __construct ($type)
 
 getType ()
 
 setAutoDisable ($value)
 
 hasDisableAfterDeliverySet ()
 
 setLink ($link)
 
 getLink ()
 
 setIconPath ($path)
 
 getIconPath ()
 
 setTitleVar ($name, $parameters=array(), $language_module='notification')
 Sets the name of the language variable to use as title. More...
 
 getTitleVar ()
 
 setShortDescriptionVar ($name, $parameters=array(), $language_module='notification')
 Sets the name of the language variable to use as short description text. More...
 
 getShortDescriptionVar ()
 
 setLongDescriptionVar ($name, $parameters=array(), $language_module='notification')
 Sets the name of the language variable to use as long description text. More...
 
 getLongDescriptionVar ()
 
 getLanguageParameters ()
 
 getLinktarget ()
 
 setLinktarget ($linktarget)
 
 setValidForSeconds ($seconds)
 
 getValidForSeconds ()
 
 getVisibleForSeconds ()
 
 setVisibleForSeconds ($visibleForSeconds)
 
 notifyByUsers (array $recipients, $processAsync=false)
 sends this notification to a list of users More...
 
 notifyByListeners ($ref_id, $processAsync=false)
 
 notifyByRoles (array $roles, $processAsync=false)
 
 getUserInstance (ilObjUser $user, $languageVars, $defaultLanguage)
 
 setHandlerParam ($name, $value)
 
 getHandlerParams ()
 
 unsetHandlerParam ($name)
 

Data Fields

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

Protected Member Functions

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

Protected Attributes

 $visibleForSeconds = 0
 

Private Attributes

 $type
 
 $link
 
 $linktarget = '_self'
 
 $title
 
 $iconPath
 
 $short_description
 
 $long_description
 
 $disableAfterDelivery = false
 
 $validForSeconds = 0
 
 $handlerParams = array()
 

Detailed Description

Describes a notification and provides methods for publishing this notification.

Definition at line 6 of file class.ilNotificationConfig.php.

Constructor & Destructor Documentation

◆ __construct()

ilNotificationConfig::__construct (   $type)

Definition at line 70 of file class.ilNotificationConfig.php.

References $type.

71  {
72  $this->type = $type;
73  }

Member Function Documentation

◆ afterSendToListeners()

ilNotificationConfig::afterSendToListeners ( )
protected

Definition at line 234 of file class.ilNotificationConfig.php.

Referenced by notifyByListeners().

235  {
236 
237  }
+ Here is the caller graph for this function:

◆ afterSendToUsers()

ilNotificationConfig::afterSendToUsers ( )
protected

Definition at line 224 of file class.ilNotificationConfig.php.

Referenced by notifyByUsers().

225  {
226 
227  }
+ Here is the caller graph for this function:

◆ beforeSendToListeners()

ilNotificationConfig::beforeSendToListeners ( )
protected

Definition at line 229 of file class.ilNotificationConfig.php.

Referenced by notifyByListeners().

230  {
231 
232  }
+ Here is the caller graph for this function:

◆ beforeSendToUsers()

ilNotificationConfig::beforeSendToUsers ( )
protected

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

Referenced by notifyByUsers().

220  {
221 
222  }
+ Here is the caller graph for this function:

◆ getHandlerParams()

ilNotificationConfig::getHandlerParams ( )

Definition at line 338 of file class.ilNotificationConfig.php.

References $handlerParams.

◆ getIconPath()

ilNotificationConfig::getIconPath ( )

Definition at line 105 of file class.ilNotificationConfig.php.

References $iconPath.

106  {
107  return $this->iconPath;
108  }

◆ getLanguageParameters()

ilNotificationConfig::getLanguageParameters ( )

Definition at line 174 of file class.ilNotificationConfig.php.

References array.

Referenced by ilNotificationSystem\toUsers().

175  {
176  return array(
177  'title' => $this->title,
178  'longDescription' => $this->long_description,
179  'shortDescription' => $this->short_description,
180  );
181  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getLink()

ilNotificationConfig::getLink ( )

Definition at line 95 of file class.ilNotificationConfig.php.

References $link.

◆ getLinktarget()

ilNotificationConfig::getLinktarget ( )

Definition at line 183 of file class.ilNotificationConfig.php.

References $linktarget.

184  {
185  return $this->linktarget;
186  }

◆ getLongDescriptionVar()

ilNotificationConfig::getLongDescriptionVar ( )

Definition at line 169 of file class.ilNotificationConfig.php.

170  {
171  return $this->long_description->getName();
172  }

◆ getShortDescriptionVar()

ilNotificationConfig::getShortDescriptionVar ( )

Definition at line 147 of file class.ilNotificationConfig.php.

148  {
149  return $this->short_description->getName();
150  }

◆ getTitleVar()

ilNotificationConfig::getTitleVar ( )

Definition at line 125 of file class.ilNotificationConfig.php.

126  {
127  return $this->title->getName();
128  }

◆ getType()

ilNotificationConfig::getType ( )

Definition at line 75 of file class.ilNotificationConfig.php.

References $type.

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

+ Here is the caller graph for this function:

◆ getUserInstance()

ilNotificationConfig::getUserInstance ( ilObjUser  $user,
  $languageVars,
  $defaultLanguage 
)

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

References $iconPath, $title, and ilObjUser\getLanguage().

Referenced by ilNotificationSystem\toUsers().

268  {
269  $notificationObject = new ilNotificationObject($this, $user);
270 
271  $title = '';
272  $short = '';
273  $long = '';
274 
275  if($languageVars[$this->title->getName()]->lang[$user->getLanguage()])
276  {
277  $title = $languageVars[$this->title->getName()]->lang[$user->getLanguage()];
278  }
279  else if($languageVars[$this->title->getName()]->lang[$defaultLanguage])
280  {
281  $title = $languageVars[$this->title->getName()]->lang[$defaultLanguage];
282  }
283  else
284  {
285  $title = $this->title->getName();
286  }
287 
288  if($languageVars[$this->short_description->getName()]->lang[$user->getLanguage()])
289  {
290  $short = $languageVars[$this->short_description->getName()]->lang[$user->getLanguage()];
291  }
292  else if($languageVars[$this->short_description->getName()]->lang[$defaultLanguage])
293  {
294  $short = $languageVars[$this->short_description->getName()]->lang[$defaultLanguage];
295  }
296  else
297  {
298  $short = $this->short_description->getName();
299  }
300 
301  if($languageVars[$this->long_description->getName()]->lang[$user->getLanguage()])
302  {
303  $long = $languageVars[$this->long_description->getName()]->lang[$user->getLanguage()];
304  }
305  else if($languageVars[$this->long_description->getName()]->lang[$defaultLanguage])
306  {
307  $long = $languageVars[$this->long_description->getName()]->lang[$defaultLanguage];
308  }
309  else
310  {
311  $long = $this->long_description->getName();
312  }
313 
314  $notificationObject->title = $title;
315  $notificationObject->shortDescription = $short;
316  $notificationObject->longDescription = $long;
317 
318  $notificationObject->iconPath = $this->iconPath;
319 
320  return $notificationObject;
321  }
A concrete notification based on the ilNotificationConfiguration and returned by ilNotificationConfig...
getLanguage()
returns a 2char-language-string public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidForSeconds()

ilNotificationConfig::getValidForSeconds ( )

Definition at line 198 of file class.ilNotificationConfig.php.

References $validForSeconds.

Referenced by ilNotificationDatabaseHandler\enqueueByListener(), and ilNotificationDatabaseHandler\enqueueByUsers().

+ Here is the caller graph for this function:

◆ getVisibleForSeconds()

ilNotificationConfig::getVisibleForSeconds ( )
Returns
int

Definition at line 206 of file class.ilNotificationConfig.php.

References $visibleForSeconds.

Referenced by ilNotificationDatabaseHandler\enqueueByListener(), and ilNotificationDatabaseHandler\enqueueByUsers().

+ Here is the caller graph for this function:

◆ hasDisableAfterDeliverySet()

ilNotificationConfig::hasDisableAfterDeliverySet ( )

Definition at line 85 of file class.ilNotificationConfig.php.

References $disableAfterDelivery.

Referenced by ilNotificationSystem\toListeners().

86  {
87  return (bool)$this->disableAfterDelivery;
88  }
+ Here is the caller graph for this function:

◆ notifyByListeners()

ilNotificationConfig::notifyByListeners (   $ref_id,
  $processAsync = false 
)
final

Definition at line 251 of file class.ilNotificationConfig.php.

References $ref_id, afterSendToListeners(), beforeSendToListeners(), and ilNotificationSystem\sendNotificationToListeners().

252  {
253  require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
254  $this->beforeSendToListeners();
256  $this->afterSendToListeners();
257  }
$ref_id
Definition: sahs_server.php:39
static sendNotificationToListeners(ilNotificationConfig $notification, $ref_id, $processAsync=false)
+ Here is the call graph for this function:

◆ notifyByRoles()

ilNotificationConfig::notifyByRoles ( array  $roles,
  $processAsync = false 
)
final

Definition at line 259 of file class.ilNotificationConfig.php.

References ilNotificationSystem\sendNotificationToRoles().

260  {
261  require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
262  //$this->beforeSendToListeners();
263  ilNotificationSystem::sendNotificationToRoles($this, $roles, $processAsync);
264  //$this->afterSendToListeners();
265  }
static sendNotificationToRoles(ilNotificationConfig $notification, array $roles, $processAsync=false)
+ Here is the call graph for this function:

◆ notifyByUsers()

ilNotificationConfig::notifyByUsers ( array  $recipients,
  $processAsync = false 
)
final

sends this notification to a list of users

Parameters
array$recipients

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

References afterSendToUsers(), beforeSendToUsers(), and ilNotificationSystem\sendNotificationToUsers().

244  {
245  require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
246  $this->beforeSendToUsers();
247  ilNotificationSystem::sendNotificationToUsers($this, $recipients, $processAsync);
248  $this->afterSendToUsers();
249  }
static sendNotificationToUsers(ilNotificationConfig $notification, $users, $processAsync=false)
+ Here is the call graph for this function:

◆ setAutoDisable()

ilNotificationConfig::setAutoDisable (   $value)

Definition at line 80 of file class.ilNotificationConfig.php.

81  {
82  $this->disableAfterDelivery = $value;
83  }

◆ setHandlerParam()

ilNotificationConfig::setHandlerParam (   $name,
  $value 
)

Definition at line 323 of file class.ilNotificationConfig.php.

324  {
325  if(strpos($name, '.'))
326  {
327  $nsParts = explode('.', $name, 2);
328  $ns = $nsParts[0];
329  $field = $nsParts[1];
330  $this->handlerParams[$ns][$field] = $value;
331  }
332  else
333  {
334  $this->handlerParams[''][$name] = $value;
335  }
336  }

◆ setIconPath()

ilNotificationConfig::setIconPath (   $path)

Definition at line 100 of file class.ilNotificationConfig.php.

References $path.

101  {
102  $this->iconPath = $path;
103  }
$path
Definition: aliased.php:25

◆ setLink()

ilNotificationConfig::setLink (   $link)

Definition at line 90 of file class.ilNotificationConfig.php.

References $link.

91  {
92  $this->link = $link;
93  }

◆ setLinktarget()

ilNotificationConfig::setLinktarget (   $linktarget)

Definition at line 188 of file class.ilNotificationConfig.php.

References $linktarget.

189  {
190  $this->linktarget = $linktarget;
191  }

◆ setLongDescriptionVar()

ilNotificationConfig::setLongDescriptionVar (   $name,
  $parameters = array(),
  $language_module = 'notification' 
)

Sets the name of the language variable to use as long description text.

The translation may include [name] parts wich will be replaced by the matching parameter found in $parameters. The language var is loaded from the language module given as third parameter. The channel itself decided if the short description or the long description should be used Placeholders of type ##name## are deprecated

Parameters
string$name
array$parameters
string$language_module

Definition at line 164 of file class.ilNotificationConfig.php.

165  {
166  $this->long_description = new ilNotificationParameter($name, $parameters, $language_module);
167  }
description of a localized parameter this information is used locate translations while processing no...

◆ setShortDescriptionVar()

ilNotificationConfig::setShortDescriptionVar (   $name,
  $parameters = array(),
  $language_module = 'notification' 
)

Sets the name of the language variable to use as short description text.

The translation may include [NAME] parts wich will be replaced by the matching parameter found in $parameters. The language var is loaded from the language module given as third parameter. Placeholders of type ##name## are deprecated The channel itself decided if the short description or the long description should be used

Parameters
string$name
array$parameters
string$language_module

Definition at line 142 of file class.ilNotificationConfig.php.

143  {
144  $this->short_description = new ilNotificationParameter($name, $parameters, $language_module);
145  }
description of a localized parameter this information is used locate translations while processing no...

◆ setTitleVar()

ilNotificationConfig::setTitleVar (   $name,
  $parameters = array(),
  $language_module = 'notification' 
)

Sets the name of the language variable to use as title.

The translation may include [NAME] parts wich will be replaced by the matching parameter found in $parameters. The language var is loaded from the language module given as third parameter. Placeholders of type ##name## are deprecated

Parameters
type$name
type$parameters
type$language_module

Definition at line 120 of file class.ilNotificationConfig.php.

121  {
122  $this->title = new ilNotificationParameter($name, $parameters, $language_module);
123  }
description of a localized parameter this information is used locate translations while processing no...

◆ setValidForSeconds()

ilNotificationConfig::setValidForSeconds (   $seconds)

Definition at line 193 of file class.ilNotificationConfig.php.

194  {
195  $this->validForSeconds = $seconds;
196  }

◆ setVisibleForSeconds()

ilNotificationConfig::setVisibleForSeconds (   $visibleForSeconds)
Parameters
int$visibleForSeconds

Definition at line 214 of file class.ilNotificationConfig.php.

References $visibleForSeconds.

215  {
216  $this->visibleForSeconds = $visibleForSeconds;
217  }

◆ unsetHandlerParam()

ilNotificationConfig::unsetHandlerParam (   $name)

Definition at line 343 of file class.ilNotificationConfig.php.

344  {
345  unset($this->handlerParams[$name]);
346  }

Field Documentation

◆ $disableAfterDelivery

ilNotificationConfig::$disableAfterDelivery = false
private

Definition at line 50 of file class.ilNotificationConfig.php.

Referenced by hasDisableAfterDeliverySet().

◆ $handlerParams

ilNotificationConfig::$handlerParams = array()
private

Definition at line 68 of file class.ilNotificationConfig.php.

Referenced by getHandlerParams().

◆ $iconPath

ilNotificationConfig::$iconPath
private

Definition at line 35 of file class.ilNotificationConfig.php.

Referenced by getIconPath(), and getUserInstance().

◆ $link

ilNotificationConfig::$link
private

Definition at line 25 of file class.ilNotificationConfig.php.

Referenced by getLink(), and setLink().

◆ $linktarget

ilNotificationConfig::$linktarget = '_self'
private

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

Referenced by getLinktarget(), and setLinktarget().

◆ $long_description

ilNotificationConfig::$long_description
private

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

◆ $short_description

ilNotificationConfig::$short_description
private

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

◆ $title

ilNotificationConfig::$title
private

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

Referenced by getUserInstance().

◆ $type

ilNotificationConfig::$type
private

Definition at line 17 of file class.ilNotificationConfig.php.

Referenced by __construct(), and getType().

◆ $validForSeconds

ilNotificationConfig::$validForSeconds = 0
private

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

Referenced by getValidForSeconds().

◆ $visibleForSeconds

ilNotificationConfig::$visibleForSeconds = 0
protected

Definition at line 62 of file class.ilNotificationConfig.php.

Referenced by getVisibleForSeconds(), and setVisibleForSeconds().

◆ DEFAULT_TTS

◆ TTL_LONG

const ilNotificationConfig::TTL_LONG = 1800

◆ TTL_SHORT

const ilNotificationConfig::TTL_SHORT = 120

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