ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAsyncNotifications.php
Go to the documentation of this file.
1<?php
2
11
15 protected $js_init;
16
21
25 protected $js_path;
26
30 protected $js_config;
31
32
33 public function __construct($content_container_id = null) {
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 }
38
39
43 public function initJs() {
44 global $tpl;
45
46 if(!$this->js_init) {
47 $tpl->addJavaScript($this->getJsPath().'ilStudyProgramme.js');
48
49 $templates['info'] = $tpl->getMessageHTML("[MESSAGE]");
50 $templates['success'] = $tpl->getMessageHTML("[MESSAGE]", 'success');
51 $templates['failure'] = $tpl->getMessageHTML("[MESSAGE]", 'failure');
52 $templates['question'] = $tpl->getMessageHTML("[MESSAGE]", 'question');
53
54 $this->addJsConfig('templates', $templates);
55
56 $tpl->addOnLoadCode("$('#".$this->content_container_id."').study_programme_notifications(".json_encode($this->js_config).");");
57
58 $this->js_init = true;
59 }
60 }
61
62
66 public function getHTML() {
67 global $tpl;
68
69 $this->initJs();
70 }
71
77 public function getContentContainerId() {
79 }
80
81
88 $this->content_container_id = $content_container_id;
89 }
90
91
97 public function getJsPath() {
98 return $this->js_path;
99 }
100
101
107 public function setJsPath($js_path) {
108 $this->js_path = $js_path;
109 }
110
111
117 public function getJsConfig($key) {
118 return $this->js_config[$key];
119 }
120
121
127 public function addJsConfig($key, $value) {
128 $this->js_config[$key] = $value;
129 }
130}
global $tpl
Definition: ilias.php:8
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.
getContentContainerId()
Gets the target container for the notification.
getHTML()
Returns the component (returns the js tag)
getJsConfig($key)
Gets a setting of the jquery-plugin config.
initJs()
Setup the message templates and add the js onload code.
addJsConfig($key, $value)
Sets Jquery settings for the plugin.
getJsPath()
Return the path for the javascripts.
__construct($content_container_id=null)