ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 $tpl;
36 $this->tpl = $tpl;
37
38 $this->addJsConf('save_explorer_url', $a_target);
39 }
40
41
45 public static function addJavascript() {
46 global $tpl;
47
48 $tpl->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
49 }
50
51
61 public function buildOnClick($a_node_id, $a_type, $a_title)
62 {
63 $ref_id = (int) $_GET['ref_id'];
64 if($ref_id) {
65 return "$('body').trigger('async_explorer-add_reference', {target_id: '".$a_node_id."', type: '".$a_type."', parent_id: '".$ref_id."'});";
66 }
67 }
68
69
78 public function buildLinkTarget($a_node_id, $a_type)
79 {
80 return "javascript:void(0);";
81 }
82
83
89 public function getOutput() {
91
92 return parent::getOutput();
93 }
94
95 /*
96 * Initializes the js
97 * Adds the on load code for the async explorer
98 */
99 public function initJs() {
100 self::addOnLoadCode('explorer', '$("#'.$this->getId().'").study_programme_async_explorer('.json_encode($this->js_conf).');');
101 }
102
109 protected function addOnLoadCode($id, $content) {
110 global $tpl;
111
112 if(!isset(self::$js_on_load_added[$id])) {
113 $tpl->addOnLoadCode($content);
114 self::$js_on_load_added[$id] = $content;
115 }
116 }
117
123 public function addJsConf($key, $value) {
124 $this->js_conf[$key] = $value;
125 }
126
132 public function getJsConf($key) {
133 return $this->js_conf[$key];
134 }
135}
$_GET["client_id"]
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