ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAsyncNotifications Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilAsyncNotifications:

Public Member Functions

 __construct (string $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 (?string $content_container_id)
 Sets the target container for the notification. More...
 
 getJsPath ()
 Return the path for the java scripts. More...
 
 setJsPath (string $js_path)
 Sets the path for the java scripts. More...
 
 getJsConfig ($key)
 Gets a setting of the jquery-plugin config. More...
 
 addJsConfig ($key, $value)
 Sets Jquery settings for the plugin. More...
 

Protected Attributes

bool $js_init
 
string $content_container_id
 
string $js_path
 
array $js_config
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilAsyncNotifications Allows displaying 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 28 of file class.ilAsyncNotifications.php.

Constructor & Destructor Documentation

◆ __construct()

ilAsyncNotifications::__construct ( string  $content_container_id = null)

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

51  {
52  $this->js_init = false;
53  $this->js_path = "./Modules/StudyProgramme/templates/js/";
54  $this->content_container_id = $content_container_id ?? "ilContentContainer";
55  }

Member Function Documentation

◆ addJsConfig()

ilAsyncNotifications::addJsConfig (   $key,
  $value 
)

Sets Jquery settings for the plugin.

Parameters
mixed$key
mixed$value

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

References ILIAS\LTI\ToolProvider\$key.

Referenced by initJs().

144  : void
145  {
146  $this->js_config[$key] = $value;
147  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the caller graph for this function:

◆ getContentContainerId()

ilAsyncNotifications::getContentContainerId ( )

Gets the target container for the notification.

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

References $content_container_id.

99  : ?string
100  {
102  }

◆ getHTML()

ilAsyncNotifications::getHTML ( )

Returns the component (returns the js tag)

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

References initJs().

91  : void
92  {
93  $this->initJs();
94  }
initJs()
Setup the message templates and add the js onload code.
+ Here is the call graph for this function:

◆ getJsConfig()

ilAsyncNotifications::getJsConfig (   $key)

Gets a setting of the jquery-plugin config.

Returns
mixed $key

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

References ILIAS\LTI\ToolProvider\$key.

134  {
135  return $this->js_config[$key];
136  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ getJsPath()

ilAsyncNotifications::getJsPath ( )

Return the path for the java scripts.

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

References $js_path.

Referenced by initJs().

115  : string
116  {
117  return $this->js_path;
118  }
+ Here is the caller graph for this function:

◆ initJs()

ilAsyncNotifications::initJs ( )

Setup the message templates and add the js onload code.

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

References $DIC, $tpl, addJsConfig(), getJsPath(), and ilUtil\getSystemMessageHTML().

Referenced by getHTML().

60  : void
61  {
62  global $DIC;
63  $tpl = $DIC['tpl'];
64 
65  if (!$this->js_init) {
66  $tpl->addJavaScript($this->getJsPath() . 'ilStudyProgramme.js');
67 
68  // TODO: DW -> refactor ilUtil
69  $templates['info'] = ilUtil::getSystemMessageHTML("[MESSAGE]");
70  $templates['success'] = ilUtil::getSystemMessageHTML("[MESSAGE]", 'success');
71  $templates['failure'] = ilUtil::getSystemMessageHTML("[MESSAGE]", 'failure');
72  $templates['question'] = ilUtil::getSystemMessageHTML("[MESSAGE]", 'question');
73 
74  $this->addJsConfig('templates', $templates);
75 
76  $tpl->addOnLoadCode(
77  "$('#" .
78  $this->content_container_id .
79  "').study_programme_notifications(" .
80  json_encode($this->js_config, JSON_THROW_ON_ERROR) .
81  ");"
82  );
83 
84  $this->js_init = true;
85  }
86  }
addJsConfig($key, $value)
Sets Jquery settings for the plugin.
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
global $DIC
Definition: feed.php:28
getJsPath()
Return the path for the java scripts.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContentContainerId()

ilAsyncNotifications::setContentContainerId ( ?string  $content_container_id)

Sets the target container for the notification.

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

References $content_container_id.

107  : void
108  {
109  $this->content_container_id = $content_container_id;
110  }

◆ setJsPath()

ilAsyncNotifications::setJsPath ( string  $js_path)

Sets the path for the java scripts.

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

References $js_path.

123  : void
124  {
125  $this->js_path = $js_path;
126  }

Field Documentation

◆ $content_container_id

string ilAsyncNotifications::$content_container_id
protected

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

Referenced by getContentContainerId(), and setContentContainerId().

◆ $js_config

array ilAsyncNotifications::$js_config
protected

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

◆ $js_init

bool ilAsyncNotifications::$js_init
protected

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

◆ $js_path

string ilAsyncNotifications::$js_path
protected

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

Referenced by getJsPath(), and setJsPath().


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