ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAsyncContainerSelectionExplorer.php
Go to the documentation of this file.
1<?php
2require_once("./Services/ContainerReference/classes/class.ilContainerSelectionExplorer.php");
3
12
16 protected $tpl;
17
21 protected static $js_conf;
22
26 protected static $js_on_load_added = array();
27
28
32 public function __construct($a_target) {
33 parent::__construct($a_target);
34
35 global $DIC;
36 $tpl = $DIC['tpl'];
37 $this->tpl = $tpl;
38
39 $this->addJsConf('save_explorer_url', $a_target);
40 }
41
42
46 public static function addJavascript() {
47 global $DIC;
48 $tpl = $DIC['tpl'];
49
50 $tpl->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
51 }
52
53
63 public function buildOnClick($a_node_id, $a_type, $a_title)
64 {
65 $ref_id = (int) $_GET['ref_id'];
66 if($ref_id) {
67 return "$('body').trigger('async_explorer-add_reference', {target_id: '".$a_node_id."', type: '".$a_type."', parent_id: '".$ref_id."'});";
68 }
69 }
70
71
80 public function buildLinkTarget($a_node_id, $a_type)
81 {
82 return "javascript:void(0);";
83 }
84
85
91 public function getOutput() {
93
94 return parent::getOutput();
95 }
96
97 /*
98 * Initializes the js
99 * Adds the on load code for the async explorer
100 */
101 public function initJs() {
102 self::addOnLoadCode('explorer', '$("#'.$this->getId().'").study_programme_async_explorer('.json_encode($this->js_conf).');');
103 }
104
111 protected function addOnLoadCode($id, $content) {
112 global $DIC;
113 $tpl = $DIC['tpl'];
114
115 if(!isset(self::$js_on_load_added[$id])) {
116 $tpl->addOnLoadCode($content);
117 self::$js_on_load_added[$id] = $content;
118 }
119 }
120
126 public function addJsConf($key, $value) {
127 $this->js_conf[$key] = $value;
128 }
129
135 public function getJsConf($key) {
136 return $this->js_conf[$key];
137 }
138}
$_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.
$ref_id
Definition: sahs_server.php:39
global $DIC
$a_type
Definition: workflow.php:93