ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAsyncNotifications Class Reference

Class ilAsyncNotifications Allows to display async notifications on a page. More...

+ Collaboration diagram for ilAsyncNotifications:

Public Member Functions

 __construct ($content_container_id=null)
 
 initJs ()
 Setup the message templates and add the js onload code. More...
 
 getHTML ()
 Returns the component (returns the js tag) More...
 
 getContentContainerId ()
 Gets the target container for the notification. More...
 
 setContentContainerId ($content_container_id)
 Sets the target container for the notification. More...
 
 getJsPath ()
 Return the path for the javascripts. More...
 
 setJsPath ($js_path)
 Sets the path for the javascripts. More...
 
 getJsConfig ($key)
 Gets a setting of the jquery-plugin config. More...
 
 addJsConfig ($key, $value)
 Sets Jquery settings for the plugin. More...
 

Protected Attributes

 $js_init
 
 $content_container_id
 
 $js_path
 
 $js_config
 

Detailed Description

Class ilAsyncNotifications Allows to display async notifications on a page.

Author
Michael Herren mh@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 10 of file class.ilAsyncNotifications.php.

Constructor & Destructor Documentation

◆ __construct()

ilAsyncNotifications::__construct (   $content_container_id = null)

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

References $content_container_id.

35  {
36  $this->js_init = false;
37  $this->js_path = "./Modules/StudyProgramme/templates/js/";
38  $this->content_container_id = ($content_container_id != null)? $content_container_id : "ilContentContainer";
39  }

Member Function Documentation

◆ addJsConfig()

ilAsyncNotifications::addJsConfig (   $key,
  $value 
)

Sets Jquery settings for the plugin.

Parameters
mixed$js_config

Definition at line 138 of file class.ilAsyncNotifications.php.

References $key.

Referenced by initJs().

139  {
140  $this->js_config[$key] = $value;
141  }
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ getContentContainerId()

ilAsyncNotifications::getContentContainerId ( )

Gets the target container for the notification.

Returns
null|string

Definition at line 83 of file class.ilAsyncNotifications.php.

References $content_container_id.

◆ getHTML()

ilAsyncNotifications::getHTML ( )

Returns the component (returns the js tag)

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

References $DIC, $tpl, and initJs().

71  {
72  global $DIC;
73  $tpl = $DIC['tpl'];
74 
75  $this->initJs();
76  }
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
initJs()
Setup the message templates and add the js onload code.
+ Here is the call graph for this function:

◆ getJsConfig()

ilAsyncNotifications::getJsConfig (   $key)

Gets a setting of the jquery-plugin config.

Returns
mixed

Definition at line 127 of file class.ilAsyncNotifications.php.

References $key.

128  {
129  return $this->js_config[$key];
130  }
$key
Definition: croninfo.php:18

◆ getJsPath()

ilAsyncNotifications::getJsPath ( )

Return the path for the javascripts.

Returns
string

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

References $js_path.

Referenced by initJs().

106  {
107  return $this->js_path;
108  }
+ Here is the caller graph for this function:

◆ initJs()

ilAsyncNotifications::initJs ( )

Setup the message templates and add the js onload code.

Definition at line 45 of file class.ilAsyncNotifications.php.

References $DIC, $tpl, addJsConfig(), and getJsPath().

Referenced by getHTML().

46  {
47  global $DIC;
48  $tpl = $DIC['tpl'];
49 
50  if (!$this->js_init) {
51  $tpl->addJavaScript($this->getJsPath() . 'ilStudyProgramme.js');
52 
53  $templates['info'] = $tpl->getMessageHTML("[MESSAGE]");
54  $templates['success'] = $tpl->getMessageHTML("[MESSAGE]", 'success');
55  $templates['failure'] = $tpl->getMessageHTML("[MESSAGE]", 'failure');
56  $templates['question'] = $tpl->getMessageHTML("[MESSAGE]", 'question');
57 
58  $this->addJsConfig('templates', $templates);
59 
60  $tpl->addOnLoadCode("$('#" . $this->content_container_id . "').study_programme_notifications(" . json_encode($this->js_config) . ");");
61 
62  $this->js_init = true;
63  }
64  }
addJsConfig($key, $value)
Sets Jquery settings for the plugin.
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
getJsPath()
Return the path for the javascripts.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContentContainerId()

ilAsyncNotifications::setContentContainerId (   $content_container_id)

Sets the target container for the notification.

Parameters
null | string$content_container_id

Definition at line 94 of file class.ilAsyncNotifications.php.

References $content_container_id.

95  {
96  $this->content_container_id = $content_container_id;
97  }

◆ setJsPath()

ilAsyncNotifications::setJsPath (   $js_path)

Sets the path for the javascripts.

Parameters
string$js_path

Definition at line 116 of file class.ilAsyncNotifications.php.

References $js_path.

117  {
118  $this->js_path = $js_path;
119  }

Field Documentation

◆ $content_container_id

ilAsyncNotifications::$content_container_id
protected

◆ $js_config

ilAsyncNotifications::$js_config
protected

Definition at line 31 of file class.ilAsyncNotifications.php.

◆ $js_init

ilAsyncNotifications::$js_init
protected

Definition at line 16 of file class.ilAsyncNotifications.php.

◆ $js_path

ilAsyncNotifications::$js_path
protected

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

Referenced by getJsPath(), and setJsPath().


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