ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 ()
 
 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)
 

Protected Member Functions

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

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

65 {
66 $this->type = $type;
67 }

References $type.

Member Function Documentation

◆ afterSendToListeners()

ilNotificationConfig::afterSendToListeners ( )
protected

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

199 {
200
201 }

Referenced by notifyByListeners().

+ Here is the caller graph for this function:

◆ afterSendToUsers()

ilNotificationConfig::afterSendToUsers ( )
protected

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

191 {
192
193 }

Referenced by notifyByUsers().

+ Here is the caller graph for this function:

◆ beforeSendToListeners()

ilNotificationConfig::beforeSendToListeners ( )
protected

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

195 {
196
197 }

Referenced by notifyByListeners().

+ Here is the caller graph for this function:

◆ beforeSendToUsers()

ilNotificationConfig::beforeSendToUsers ( )
protected

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

187 {
188
189 }

Referenced by notifyByUsers().

+ Here is the caller graph for this function:

◆ getHandlerParams()

ilNotificationConfig::getHandlerParams ( )

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

References $handlerParams.

◆ getIconPath()

ilNotificationConfig::getIconPath ( )

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

References $iconPath.

◆ getLanguageParameters()

ilNotificationConfig::getLanguageParameters ( )

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

163 {
164 return array(
165 'title' => $this->title,
166 'longDescription' => $this->long_description,
167 'shortDescription' => $this->short_description,
168 );
169 }

Referenced by ilNotificationSystem\toUsers().

+ Here is the caller graph for this function:

◆ getLink()

ilNotificationConfig::getLink ( )

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

References $link.

◆ getLinktarget()

ilNotificationConfig::getLinktarget ( )

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

References $linktarget.

◆ getLongDescriptionVar()

ilNotificationConfig::getLongDescriptionVar ( )

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

159 {
160 return $this->long_description->getName();
161 }

◆ getShortDescriptionVar()

ilNotificationConfig::getShortDescriptionVar ( )

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

136 {
137 return $this->short_description->getName();
138 }

◆ getTitleVar()

ilNotificationConfig::getTitleVar ( )

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

113 {
114 return $this->title->getName();
115 }

◆ getType()

ilNotificationConfig::getType ( )

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

69 {
70 return $this->type;
71 }

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

230 {
231 $notificationObject = new ilNotificationObject($this, $user);
232
233 $title = '';
234 $short = '';
235 $long = '';
236
237 if ($languageVars[$this->title->getName()]->lang[$user->getLanguage()]) {
238 $title = $languageVars[$this->title->getName()]->lang[$user->getLanguage()];
239 }
240 else if ($languageVars[$this->title->getName()]->lang[$defaultLanguage]) {
241 $title = $languageVars[$this->title->getName()]->lang[$defaultLanguage];
242 }
243 else {
244 $title = $this->title->getName();
245 }
246
247 if ($languageVars[$this->short_description->getName()]->lang[$user->getLanguage()]) {
248 $short = $languageVars[$this->short_description->getName()]->lang[$user->getLanguage()];
249 }
250 else if ($languageVars[$this->short_description->getName()]->lang[$defaultLanguage]) {
251 $short = $languageVars[$this->short_description->getName()]->lang[$defaultLanguage];
252 }
253 else {
254 $short = $this->short_description->getName();
255 }
256
257 if ($languageVars[$this->long_description->getName()]->lang[$user->getLanguage()]) {
258 $long = $languageVars[$this->long_description->getName()]->lang[$user->getLanguage()];
259 }
260 else if ($languageVars[$this->long_description->getName()]->lang[$defaultLanguage]) {
261 $long = $languageVars[$this->long_description->getName()]->lang[$defaultLanguage];
262 }
263 else {
264 $long = $this->long_description->getName();
265 }
266
267 $notificationObject->title = $title;
268 $notificationObject->shortDescription = $short;
269 $notificationObject->longDescription = $long;
270
271 $notificationObject->iconPath = $this->iconPath;
272
273 return $notificationObject;
274 }
A concrete notification based on the ilNotificationConfiguration and returned by ilNotificationConfig...
getLanguage()
returns a 2char-language-string @access public

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

Referenced by ilNotificationSystem\toUsers().

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

◆ getValidForSeconds()

ilNotificationConfig::getValidForSeconds ( )

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

References $validForSeconds.

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

+ Here is the caller graph for this function:

◆ hasDisableAfterDeliverySet()

ilNotificationConfig::hasDisableAfterDeliverySet ( )

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

References $disableAfterDelivery.

Referenced by ilNotificationSystem\toListeners().

+ Here is the caller graph for this function:

◆ notifyByListeners()

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

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

216 {
217 require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
218 $this->beforeSendToListeners();
220 $this->afterSendToListeners();
221 }
static sendNotificationToListeners(ilNotificationConfig $notification, $ref_id, $processAsync=false)
$ref_id
Definition: sahs_server.php:39

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

+ Here is the call graph for this function:

◆ notifyByRoles()

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

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

223 {
224 require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
225 //$this->beforeSendToListeners();
226 ilNotificationSystem::sendNotificationToRoles($this, $roles, $processAsync);
227 //$this->afterSendToListeners();
228 }
static sendNotificationToRoles(ilNotificationConfig $notification, array $roles, $processAsync=false)

References ilNotificationSystem\sendNotificationToRoles().

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

208 {
209 require_once 'Services/Notifications/classes/class.ilNotificationSystem.php';
210 $this->beforeSendToUsers();
211 ilNotificationSystem::sendNotificationToUsers($this, $recipients, $processAsync);
212 $this->afterSendToUsers();
213 }
static sendNotificationToUsers(ilNotificationConfig $notification, $users, $processAsync=false)

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

+ Here is the call graph for this function:

◆ setAutoDisable()

ilNotificationConfig::setAutoDisable (   $value)

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

73 {
74 $this->disableAfterDelivery = $value;
75 }

◆ setHandlerParam()

ilNotificationConfig::setHandlerParam (   $name,
  $value 
)

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

276 {
277 if (strpos($name, '.')) {
278 $nsParts = explode('.', $name, 2);
279 $ns = $nsParts[0];
280 $field = $nsParts[1];
281 $this->handlerParams[$ns][$field] = $value;
282 }
283 else {
284 $this->handlerParams[''][$name] = $value;
285 }
286 }

◆ setIconPath()

ilNotificationConfig::setIconPath (   $path)

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

89 {
90 $this->iconPath = $path;
91 }
$path
Definition: index.php:22

References $path.

◆ setLink()

ilNotificationConfig::setLink (   $link)

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

81 {
82 $this->link = $link;
83 }

References $link.

◆ setLinktarget()

ilNotificationConfig::setLinktarget (   $linktarget)

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

175 {
176 $this->linktarget = $linktarget;
177 }

References $linktarget.

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

155 {
156 $this->long_description = new ilNotificationParameter($name, $parameters, $language_module);
157 }
description of a localized parameter

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

132 {
133 $this->short_description = new ilNotificationParameter($name, $parameters, $language_module);
134 }

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

109 {
110 $this->title = new ilNotificationParameter($name, $parameters, $language_module);
111 }

◆ setValidForSeconds()

ilNotificationConfig::setValidForSeconds (   $seconds)

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

179 {
180 $this->validForSeconds = $seconds;
181 }

◆ unsetHandlerParam()

ilNotificationConfig::unsetHandlerParam (   $name)

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

292 {
293 unset($this->handlerParams[$name]);
294 }

Field Documentation

◆ $disableAfterDelivery

ilNotificationConfig::$disableAfterDelivery = false
private

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

Referenced by hasDisableAfterDeliverySet().

◆ $handlerParams

ilNotificationConfig::$handlerParams = array()
private

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

Referenced by getHandlerParams().

◆ $iconPath

ilNotificationConfig::$iconPath
private

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

Referenced by getIconPath(), and getUserInstance().

◆ $link

ilNotificationConfig::$link
private

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

Referenced by getLink(), and setLink().

◆ $linktarget

ilNotificationConfig::$linktarget = '_self'
private

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

Referenced by getLinktarget(), and setLinktarget().

◆ $long_description

ilNotificationConfig::$long_description
private

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

◆ $short_description

ilNotificationConfig::$short_description
private

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

◆ $title

ilNotificationConfig::$title
private

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

Referenced by getUserInstance().

◆ $type

ilNotificationConfig::$type
private

Definition at line 12 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().


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