ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 231 of file class.ilNotificationConfig.php.

Referenced by notifyByListeners().

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

◆ afterSendToUsers()

ilNotificationConfig::afterSendToUsers ( )
protected

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

Referenced by notifyByUsers().

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

◆ beforeSendToListeners()

ilNotificationConfig::beforeSendToListeners ( )
protected

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

Referenced by notifyByListeners().

228  {
229  }
+ 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  }
+ Here is the caller graph for this function:

◆ getHandlerParams()

ilNotificationConfig::getHandlerParams ( )

Definition at line 316 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.

Referenced by ilNotificationSystem\toUsers().

175  {
176  return array(
177  'title' => $this->title,
178  'longDescription' => $this->long_description,
179  'shortDescription' => $this->short_description,
180  );
181  }
+ 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 263 of file class.ilNotificationConfig.php.

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

Referenced by ilNotificationSystem\toUsers().

264  {
265  $notificationObject = new ilNotificationObject($this, $user);
266 
267  $title = '';
268  $short = '';
269  $long = '';
270 
271  if ($languageVars[$this->title->getName()]->lang[$user->getLanguage()]) {
272  $title = $languageVars[$this->title->getName()]->lang[$user->getLanguage()];
273  } elseif ($languageVars[$this->title->getName()]->lang[$defaultLanguage]) {
274  $title = $languageVars[$this->title->getName()]->lang[$defaultLanguage];
275  } else {
276  $title = $this->title->getName();
277  }
278 
279  if ($languageVars[$this->short_description->getName()]->lang[$user->getLanguage()]) {
280  $short = $languageVars[$this->short_description->getName()]->lang[$user->getLanguage()];
281  } elseif ($languageVars[$this->short_description->getName()]->lang[$defaultLanguage]) {
282  $short = $languageVars[$this->short_description->getName()]->lang[$defaultLanguage];
283  } else {
284  $short = $this->short_description->getName();
285  }
286 
287  if ($languageVars[$this->long_description->getName()]->lang[$user->getLanguage()]) {
288  $long = $languageVars[$this->long_description->getName()]->lang[$user->getLanguage()];
289  } elseif ($languageVars[$this->long_description->getName()]->lang[$defaultLanguage]) {
290  $long = $languageVars[$this->long_description->getName()]->lang[$defaultLanguage];
291  } else {
292  $long = $this->long_description->getName();
293  }
294 
295  $notificationObject->title = $title;
296  $notificationObject->shortDescription = $short;
297  $notificationObject->longDescription = $long;
298 
299  $notificationObject->iconPath = $this->iconPath;
300 
301  return $notificationObject;
302  }
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 247 of file class.ilNotificationConfig.php.

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

248  {
249  require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
250  $this->beforeSendToListeners();
251  ilNotificationSystem::sendNotificationToListeners($this, $ref_id, $processAsync);
252  $this->afterSendToListeners();
253  }
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 255 of file class.ilNotificationConfig.php.

References ilNotificationSystem\sendNotificationToRoles().

256  {
257  require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
258  //$this->beforeSendToListeners();
259  ilNotificationSystem::sendNotificationToRoles($this, $roles, $processAsync);
260  //$this->afterSendToListeners();
261  }
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 239 of file class.ilNotificationConfig.php.

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

240  {
241  require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
242  $this->beforeSendToUsers();
243  ilNotificationSystem::sendNotificationToUsers($this, $recipients, $processAsync);
244  $this->afterSendToUsers();
245  }
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 304 of file class.ilNotificationConfig.php.

References $name.

305  {
306  if (strpos($name, '.')) {
307  $nsParts = explode('.', $name, 2);
308  $ns = $nsParts[0];
309  $field = $nsParts[1];
310  $this->handlerParams[$ns][$field] = $value;
311  } else {
312  $this->handlerParams[''][$name] = $value;
313  }
314  }

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

References $name.

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.

References $name.

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.

References $name.

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 321 of file class.ilNotificationConfig.php.

References $name.

322  {
323  unset($this->handlerParams[$name]);
324  }

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: