ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $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 }
62
63
67 public function getHTML() {
68 global $DIC;
69 $tpl = $DIC['tpl'];
70
71 $this->initJs();
72 }
73
79 public function getContentContainerId() {
81 }
82
83
90 $this->content_container_id = $content_container_id;
91 }
92
93
99 public function getJsPath() {
100 return $this->js_path;
101 }
102
103
109 public function setJsPath($js_path) {
110 $this->js_path = $js_path;
111 }
112
113
119 public function getJsConfig($key) {
120 return $this->js_config[$key];
121 }
122
123
129 public function addJsConfig($key, $value) {
130 $this->js_config[$key] = $value;
131 }
132}
global $tpl
Definition: ilias.php:8
An exception for terminatinating execution or to throw for unit testing.
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)
global $DIC