ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAsyncNotifications.php
Go to the documentation of this file.
1 <?php
2 
11 {
12 
16  protected $js_init;
17 
22 
26  protected $js_path;
27 
31  protected $js_config;
32 
33 
34  public function __construct($content_container_id = null)
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  }
40 
41 
45  public function initJs()
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  }
65 
66 
70  public function getHTML()
71  {
72  global $DIC;
73  $tpl = $DIC['tpl'];
74 
75  $this->initJs();
76  }
77 
83  public function getContentContainerId()
84  {
86  }
87 
88 
95  {
96  $this->content_container_id = $content_container_id;
97  }
98 
99 
105  public function getJsPath()
106  {
107  return $this->js_path;
108  }
109 
110 
116  public function setJsPath($js_path)
117  {
118  $this->js_path = $js_path;
119  }
120 
121 
127  public function getJsConfig($key)
128  {
129  return $this->js_config[$key];
130  }
131 
132 
138  public function addJsConfig($key, $value)
139  {
140  $this->js_config[$key] = $value;
141  }
142 }
addJsConfig($key, $value)
Sets Jquery settings for the plugin.
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
Class ilAsyncNotifications Allows to display async notifications on a page.
setContentContainerId($content_container_id)
Sets the target container for the notification.
setJsPath($js_path)
Sets the path for the javascripts.
getJsConfig($key)
Gets a setting of the jquery-plugin config.
getContentContainerId()
Gets the target container for the notification.
getJsPath()
Return the path for the javascripts.
__construct($content_container_id=null)
getHTML()
Returns the component (returns the js tag)
initJs()
Setup the message templates and add the js onload code.
$key
Definition: croninfo.php:18