ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 33 of file class.ilAsyncNotifications.php.

References $content_container_id.

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

Member Function Documentation

◆ addJsConfig()

ilAsyncNotifications::addJsConfig (   $key,
  $value 
)

Sets Jquery settings for the plugin.

Parameters
mixed$js_config

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

Referenced by initJs().

129  {
130  $this->js_config[$key] = $value;
131  }
+ Here is the caller graph for this function:

◆ getContentContainerId()

ilAsyncNotifications::getContentContainerId ( )

Gets the target container for the notification.

Returns
null|string

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

References $content_container_id.

◆ getHTML()

ilAsyncNotifications::getHTML ( )

Returns the component (returns the js tag)

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

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

67  {
68  global $DIC;
69  $tpl = $DIC['tpl'];
70 
71  $this->initJs();
72  }
global $tpl
Definition: ilias.php:8
initJs()
Setup the message templates and add the js onload code.
global $DIC
+ 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 119 of file class.ilAsyncNotifications.php.

119  {
120  return $this->js_config[$key];
121  }

◆ getJsPath()

ilAsyncNotifications::getJsPath ( )

Return the path for the javascripts.

Returns
string

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

References $js_path.

Referenced by initJs().

99  {
100  return $this->js_path;
101  }
+ Here is the caller graph for this function:

◆ initJs()

ilAsyncNotifications::initJs ( )

Setup the message templates and add the js onload code.

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

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

Referenced by getHTML().

43  {
44  global $DIC;
45  $tpl = $DIC['tpl'];
46 
47  if(!$this->js_init) {
48  $tpl->addJavaScript($this->getJsPath().'ilStudyProgramme.js');
49 
50  $templates['info'] = $tpl->getMessageHTML("[MESSAGE]");
51  $templates['success'] = $tpl->getMessageHTML("[MESSAGE]", 'success');
52  $templates['failure'] = $tpl->getMessageHTML("[MESSAGE]", 'failure');
53  $templates['question'] = $tpl->getMessageHTML("[MESSAGE]", 'question');
54 
55  $this->addJsConfig('templates', $templates);
56 
57  $tpl->addOnLoadCode("$('#".$this->content_container_id."').study_programme_notifications(".json_encode($this->js_config).");");
58 
59  $this->js_init = true;
60  }
61  }
addJsConfig($key, $value)
Sets Jquery settings for the plugin.
global $tpl
Definition: ilias.php:8
getJsPath()
Return the path for the javascripts.
global $DIC
+ 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 89 of file class.ilAsyncNotifications.php.

References $content_container_id.

89  {
90  $this->content_container_id = $content_container_id;
91  }

◆ setJsPath()

ilAsyncNotifications::setJsPath (   $js_path)

Sets the path for the javascripts.

Parameters
string$js_path

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

References $js_path.

109  {
110  $this->js_path = $js_path;
111  }

Field Documentation

◆ $content_container_id

ilAsyncNotifications::$content_container_id
protected

◆ $js_config

ilAsyncNotifications::$js_config
protected

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

◆ $js_init

ilAsyncNotifications::$js_init
protected

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

◆ $js_path

ilAsyncNotifications::$js_path
protected

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

Referenced by getJsPath(), and setJsPath().


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