ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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'] = ilUtil::getSystemMessageHTML("[MESSAGE]");
54 $templates['success'] = ilUtil::getSystemMessageHTML("[MESSAGE]", 'success');
55 $templates['failure'] = ilUtil::getSystemMessageHTML("[MESSAGE]", 'failure');
56 $templates['question'] = ilUtil::getSystemMessageHTML("[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}
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)
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$DIC
Definition: xapitoken.php:46