ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAsyncContainerSelectionExplorer.php
Go to the documentation of this file.
1<?php
2require_once("./Services/ContainerReference/classes/class.ilContainerSelectionExplorer.php");
3
12{
13
17 protected $tpl;
18
22 protected static $js_conf;
23
27 protected static $js_on_load_added = array();
28
29
33 public function __construct($a_target)
34 {
35 parent::__construct($a_target);
36
37 global $DIC;
38 $tpl = $DIC['tpl'];
39 $this->tpl = $tpl;
40
41 $this->addJsConf('save_explorer_url', $a_target);
42 }
43
44
48 public static function addJavascript()
49 {
50 global $DIC;
51 $tpl = $DIC['tpl'];
52
53 $tpl->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
54 }
55
56
66 public function buildOnClick($a_node_id, $a_type, $a_title)
67 {
68 $ref_id = (int) $_GET['ref_id'];
69 if ($ref_id) {
70 return "$('body').trigger('async_explorer-add_reference', {target_id: '" . $a_node_id . "', type: '" . $a_type . "', parent_id: '" . $ref_id . "'});";
71 }
72 }
73
74
83 public function buildLinkTarget($a_node_id, $a_type)
84 {
85 return "javascript:void(0);";
86 }
87
88
94 public function getOutput()
95 {
97
98 return parent::getOutput();
99 }
100
101 /*
102 * Initializes the js
103 * Adds the on load code for the async explorer
104 */
105 public function initJs()
106 {
107 self::addOnLoadCode('explorer', '$("#' . $this->getId() . '").study_programme_async_explorer(' . json_encode($this->js_conf) . ');');
108 }
109
116 protected function addOnLoadCode($id, $content)
117 {
118 global $DIC;
119 $tpl = $DIC['tpl'];
120
121 if (!isset(self::$js_on_load_added[$id])) {
122 $tpl->addOnLoadCode($content);
123 self::$js_on_load_added[$id] = $content;
124 }
125 }
126
132 public function addJsConf($key, $value)
133 {
134 $this->js_conf[$key] = $value;
135 }
136
142 public function getJsConf($key)
143 {
144 return $this->js_conf[$key];
145 }
146}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class ilAsyncContainerSelectionExplorer A class for a async ilContainerSelectionExplorer which trigge...
getJsConf($key)
Returns a certain setting of the additional configuration.
static addJavascript()
Adds the javascript to template.
addJsConf($key, $value)
Adds additional js to the onload code of the async explorer.
getOutput()
Returns the explorer html and adds the javascripts to the template.
buildLinkTarget($a_node_id, $a_type)
Sets the href-value to a void js call.
addOnLoadCode($id, $content)
Adds onload code to the template.
buildOnClick($a_node_id, $a_type, $a_title)
Creates the onclick function call.
$key
Definition: croninfo.php:18
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92