ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilRepositorySelectorExplorerGUI Class Reference

Explorer for selecting repository items. More...

+ Inheritance diagram for ilRepositorySelectorExplorerGUI:
+ Collaboration diagram for ilRepositorySelectorExplorerGUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd, $a_selection_gui=null, $a_selection_cmd="selectObject", $a_selection_par="sel_ref_id")
 Constructor. More...
 
 getNodeContent ($a_node)
 Get node content. More...
 
 getNodeIcon ($a_node)
 Get node icon. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt text. More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 isNodeVisible ($a_node)
 Is node visible. More...
 
 sortChilds ($a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 setHighlightedNode ($a_value)
 set an alternate highlighted node if $_GET["ref_id"] is not set or wrong More...
 
 getHighlightedNode ()
 get an alternate highlighted node if $_GET["ref_id"] is not set or wrong Returns null if not set More...
 
 setClickableTypes ($a_types)
 set Whitelist for clickable items More...
 
 getClickableTypes ()
 get whitelist for clickable items More...
 
- Public Member Functions inherited from ilTreeExplorerGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
 Constructor. More...
 
 getTree ()
 Get tree. More...
 
 setOrderField ($a_val, $a_numeric=false)
 Set order field. More...
 
 getOrderField ()
 Get order field. More...
 
 setTypeWhiteList ($a_val)
 Set type white list. More...
 
 getTypeWhiteList ()
 Get type white list. More...
 
 setTypeBlackList ($a_val)
 Set type black list. More...
 
 getTypeBlackList ()
 Get type black list. More...
 
 setPreloadChilds ($a_val)
 Set preload childs. More...
 
 getPreloadChilds ()
 Get preload childs. More...
 
 getSuccessorNode ($a_node_id, $a_type="")
 Get successor node (currently only(!) based on lft/rgt tree values) More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeId ($a_node)
 Get id for node. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getRootNode ()
 Get root node. More...
 
 setPathOpen ($a_id)
 Set node path to be opened. More...
 
 getHTML ()
 Get HTML. More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor. More...
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeId ($a_node)
 Get id of a node. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 nodeHasVisibleChilds ($a_node)
 Node has childs? More...
 
 sortChilds ($a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeTarget ($a_node)
 Get node target (frame) attribute. More...
 
 getNodeOnClick ($a_node)
 Get node onclick attribute. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 getId ()
 Get id of explorer element. More...
 
 setSkipRootNode ($a_val)
 Set skip root node. More...
 
 getSkipRootNode ()
 Get skip root node. More...
 
 setAjax ($a_val)
 Set ajax. More...
 
 getAjax ()
 Get ajax. More...
 
 setSecondaryHighlightedNodes ($a_val)
 Set secondary (background) highlighted nodes. More...
 
 getSecondaryHighlightedNodes ()
 Get secondary (background) highlighted nodes. More...
 
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setSelectMode ($a_postvar, $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar) More...
 
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setOfflineMode ($a_val)
 Set offline mode. More...
 
 getOfflineMode ()
 Get offline mode. More...
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 Get container id. More...
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 Get HTML. More...
 
 renderNode ($a_node, $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId ($a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart ($tpl, $a_node)
 List item start. More...
 
 listItemEnd ($tpl)
 List item end. More...
 
 listStart ($tpl)
 List start. More...
 
 listEnd ($tpl)
 List end. More...
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled ($nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd ($enable_dnd)
 Enable Drag & Drop functionality. More...
 

Protected Attributes

 $type_grps = array()
 
 $session_materials = array()
 
 $highlighted_node = null
 
 $clickable_types = array()
 
- Protected Attributes inherited from ilTreeExplorerGUI
 $tree = null
 
 $order_field = ""
 
 $order_field_numeric = false
 
 $type_white_list = array()
 
 $type_black_list = array()
 
 $childs = array()
 
 $preloaded = false
 
 $preload_childs = false
 
 $root_node_data = null
 
 $all_childs = array()
 
- Protected Attributes inherited from ilExplorerBaseGUI
 $skip_root_node = false
 
 $ajax = false
 
 $custom_open_nodes = array()
 
 $selected_nodes = array()
 
 $select_postvar = ""
 
 $offline_mode = false
 
 $sec_highl_nodes = array()
 
 $enable_dnd = false
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 Get local path of explorer js. More...
 
static getLocalJsTreeJsPath ()
 Get local path of jsTree js. More...
 
static createHTMLExportDirs ($a_target_dir)
 Create html export directories. More...
 
static init ()
 Init JS. More...
 
- Protected Member Functions inherited from ilTreeExplorerGUI
 preloadChilds ()
 Preload childs. More...
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 isNodeSelectable ($a_node)
 Is node selectable? More...
 
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
 getJSTreePlugins ()
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./Services/UIComponent/Explorer2/lib/jstree-v.pre1.0/jquery.jstree.js"
 
static $js_expl_path = "./Services/UIComponent/Explorer2/js/Explorer2.js"
 

Detailed Description

Explorer for selecting repository items.

The implementation starts as a replacement for the often (ab)used ilSearchRootSelector class. Clicking items triggers a "selection" command. However ajax/checkbox/radio and use in an inputgui class should be implemented in the future, too.

The class has some things in commong with ilRepositoryExplorerGUI. Maybe a common parent class would be a good idea in the future.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 21 of file class.ilRepositorySelectorExplorerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilRepositorySelectorExplorerGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
  $a_selection_gui = null,
  $a_selection_cmd = "selectObject",
  $a_selection_par = "sel_ref_id" 
)

Constructor.

Parameters
object$a_parent_objparent gui object
string$a_parent_cmdparent cmd that renders the explorer
object/string$a_selection_gui gui class that should be called for the selection command
string$a_selection_cmdselection command
string$a_selection_parselection parameter

Reimplemented in ilConditionSelector, and ilForumMoveTopicsExplorer.

Definition at line 37 of file class.ilRepositorySelectorExplorerGUI.php.

39 {
40 global $tree, $objDefinition;
41
42 if (is_null($a_selection_gui))
43 {
44 $a_selection_gui = $a_parent_obj;
45 }
46
47 $this->selection_gui = is_object($a_selection_gui)
48 ? strtolower(get_class($a_selection_gui))
49 : strtolower($a_selection_gui);
50 $this->selection_cmd = $a_selection_cmd;
51 $this->selection_par = $a_selection_par;
52
53 parent::__construct("rep_exp_sel", $a_parent_obj, $a_parent_cmd, $tree);
54
55 $this->setSkipRootNode(false);
56 $this->setAjax(true);
57 $this->setOrderField("title");
58
59 // per default: all object types, except item groups
60 $white = array();
61 foreach ($objDefinition->getSubObjectsRecursively("root") as $rtype)
62 {
63 if ($rtype["name"] != "itgr" && !$objDefinition->isSideBlock($rtype["name"]))
64 {
65 $white[] = $rtype["name"];
66 }
67 }
69
70 // always open the path to the current ref id
71 if ((int) $_GET["ref_id"] > 0)
72 {
73 $this->setPathOpen((int) $_GET["ref_id"]);
74 }
75 }
$_GET["client_id"]
setSkipRootNode($a_val)
Set skip root node.
setTypeWhiteList($a_val)
Set type white list.
setPathOpen($a_id)
Set node path to be opened.
setOrderField($a_val, $a_numeric=false)
Set order field.
$white
Definition: example_030.php:84

References $_GET, ilTreeExplorerGUI\$tree, $white, ilExplorerBaseGUI\setAjax(), ilTreeExplorerGUI\setOrderField(), ilTreeExplorerGUI\setPathOpen(), ilExplorerBaseGUI\setSkipRootNode(), and ilTreeExplorerGUI\setTypeWhiteList().

+ Here is the call graph for this function:

Member Function Documentation

◆ getChildsOfNode()

ilRepositorySelectorExplorerGUI::getChildsOfNode (   $a_parent_node_id)

Get childs of node.

Parameters
int$a_parent_node_idnode id
Returns
array childs array

Reimplemented from ilTreeExplorerGUI.

Definition at line 275 of file class.ilRepositorySelectorExplorerGUI.php.

276 {
277 global $ilAccess;
278
279 if (!$ilAccess->checkAccess("read", "", $a_parent_node_id))
280 {
281 return array();
282 }
283
284 return parent::getChildsOfNode($a_parent_node_id);
285 }

Referenced by ilPoolSelectorGUI\isNodeVisible().

+ Here is the caller graph for this function:

◆ getClickableTypes()

ilRepositorySelectorExplorerGUI::getClickableTypes ( )

get whitelist for clickable items

Returns
array types

Definition at line 355 of file class.ilRepositorySelectorExplorerGUI.php.

References $clickable_types.

Referenced by isNodeClickable().

+ Here is the caller graph for this function:

◆ getHighlightedNode()

ilRepositorySelectorExplorerGUI::getHighlightedNode ( )

get an alternate highlighted node if $_GET["ref_id"] is not set or wrong Returns null if not set

Returns
mixed ref_id

Definition at line 331 of file class.ilRepositorySelectorExplorerGUI.php.

References $highlighted_node.

Referenced by isNodeHighlighted().

+ Here is the caller graph for this function:

◆ getNodeContent()

ilRepositorySelectorExplorerGUI::getNodeContent (   $a_node)

Get node content.

Parameters
array$a_nodenode data
Returns
string content

Reimplemented from ilExplorerBaseGUI.

Definition at line 83 of file class.ilRepositorySelectorExplorerGUI.php.

84 {
85 global $lng;
86
87 $title = $a_node["title"];
88 if ($a_node["child"] == $this->getNodeId($this->getRootNode()))
89 {
90 if ($title == "ILIAS")
91 {
92 $title = $lng->txt("repository");
93 }
94 }
95
96 return $title;
97 }
getNodeId($a_node)
Get id for node.
global $lng
Definition: privfeed.php:40

References $lng, ilTreeExplorerGUI\getNodeId(), and ilTreeExplorerGUI\getRootNode().

+ Here is the call graph for this function:

◆ getNodeHref()

ilRepositorySelectorExplorerGUI::getNodeHref (   $a_node)

Get href for node.

Parameters
mixed$a_nodenode object/array
Returns
string href attribute

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilPoolSelectorGUI, and ilIntLinkRepItemExplorerGUI.

Definition at line 166 of file class.ilRepositorySelectorExplorerGUI.php.

167 {
168 global $ilCtrl;
169
170 $ilCtrl->setParameterByClass($this->selection_gui, $this->selection_par, $a_node["child"]);
171 $link = $ilCtrl->getLinkTargetByClass($this->selection_gui, $this->selection_cmd);
172 $ilCtrl->setParameterByClass($this->selection_gui, $this->selection_par, "");
173
174 return $link;
175 }
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl.

◆ getNodeIcon()

ilRepositorySelectorExplorerGUI::getNodeIcon (   $a_node)

Get node icon.

Parameters
array$a_nodenode data
Returns
string icon path

Reimplemented from ilExplorerBaseGUI.

Definition at line 105 of file class.ilRepositorySelectorExplorerGUI.php.

106 {
107 $obj_id = ilObject::_lookupObjId($a_node["child"]);
108 return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
109 }
static _lookupObjId($a_id)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.

References ilObject\_getIcon(), and ilObject\_lookupObjId().

+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilRepositorySelectorExplorerGUI::getNodeIconAlt (   $a_node)

Get node icon alt text.

Parameters
array$a_nodenode data
Returns
string alt text

Reimplemented from ilTreeExplorerGUI.

Definition at line 117 of file class.ilRepositorySelectorExplorerGUI.php.

118 {
119 global $lng;
120
121 if ($a_node["child"] == $this->getNodeId($this->getRootNode()))
122 {
123 $title = $a_node["title"];
124 if ($title == "ILIAS")
125 {
126 $title = $lng->txt("repository");
127 }
128 return $lng->txt("icon")." ".$title;
129 }
130
131
132 return parent::getNodeIconAlt($a_node);
133 }

References $lng, ilTreeExplorerGUI\getNodeId(), and ilTreeExplorerGUI\getRootNode().

+ Here is the call graph for this function:

◆ isNodeClickable()

ilRepositorySelectorExplorerGUI::isNodeClickable (   $a_node)

Is node clickable?

Parameters
array$a_nodenode data
Returns
boolean node clickable true/false

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilConditionSelector, and ilLinkTargetObjectExplorerGUI.

Definition at line 293 of file class.ilRepositorySelectorExplorerGUI.php.

294 {
295 global $ilAccess;
296
297 if ($this->select_postvar != "")
298 {
299 // return false; #14354
300 }
301
302 if (!$ilAccess->checkAccess("read", "", $a_node["child"]))
303 {
304 return false;
305 }
306
307 if(is_array($this->getClickableTypes()) && count($this->getClickableTypes())>0)
308 {
309 return in_array($a_node["type"], $this->getClickableTypes());
310 }
311
312 return true;
313 }
getClickableTypes()
get whitelist for clickable items

References getClickableTypes().

Referenced by ilPoolSelectorGUI\isNodeVisible().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNodeHighlighted()

ilRepositorySelectorExplorerGUI::isNodeHighlighted (   $a_node)

Is node highlighted?

Parameters
mixed$a_nodenode object/array
Returns
boolean node visible true/false

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilConditionSelector.

Definition at line 141 of file class.ilRepositorySelectorExplorerGUI.php.

142 {
143 if($this->getHighlightedNode())
144 {
145 if($this->getHighlightedNode() == $a_node["child"])
146 {
147 return true;
148 }
149 return false;
150 }
151
152 if ($a_node["child"] == $_GET["ref_id"] ||
153 ($_GET["ref_id"] == "" && $a_node["child"] == $this->getNodeId($this->getRootNode())))
154 {
155 return true;
156 }
157 return false;
158 }
getHighlightedNode()
get an alternate highlighted node if $_GET["ref_id"] is not set or wrong Returns null if not set

References $_GET, getHighlightedNode(), ilTreeExplorerGUI\getNodeId(), and ilTreeExplorerGUI\getRootNode().

+ Here is the call graph for this function:

◆ isNodeVisible()

ilRepositorySelectorExplorerGUI::isNodeVisible (   $a_node)

Is node visible.

Parameters
array$a_nodenode data
Returns
bool visible true/false

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilForumMoveTopicsExplorer, ilConditionSelector, and ilPoolSelectorGUI.

Definition at line 183 of file class.ilRepositorySelectorExplorerGUI.php.

184 {
185 global $ilAccess,$tree,$ilSetting;
186
187 if (!$ilAccess->checkAccess('visible', '', $a_node["child"]))
188 {
189 return false;
190 }
191
192 return true;
193 }
global $ilSetting
Definition: privfeed.php:40

References $ilSetting, and ilTreeExplorerGUI\$tree.

◆ setClickableTypes()

ilRepositorySelectorExplorerGUI::setClickableTypes (   $a_types)

set Whitelist for clickable items

Parameters
array/string$a_types array type

Definition at line 341 of file class.ilRepositorySelectorExplorerGUI.php.

342 {
343 if(!is_array($a_types))
344 {
345 $a_types = array($a_types);
346 }
347 $this->clickable_types = $a_types;
348 }

◆ setHighlightedNode()

ilRepositorySelectorExplorerGUI::setHighlightedNode (   $a_value)

set an alternate highlighted node if $_GET["ref_id"] is not set or wrong

Parameters
int$a_valueref_id

Definition at line 320 of file class.ilRepositorySelectorExplorerGUI.php.

321 {
322 $this->highlighted_node = $a_value;
323 }

◆ sortChilds()

ilRepositorySelectorExplorerGUI::sortChilds (   $a_childs,
  $a_parent_node_id 
)

Sort childs.

Parameters
array$a_childsarray of child nodes
int$a_parent_node_idparent node id
Returns
array array of childs nodes

Reimplemented from ilExplorerBaseGUI.

Definition at line 202 of file class.ilRepositorySelectorExplorerGUI.php.

203 {
204 global $objDefinition;
205
206 $parent_obj_id = ilObject::_lookupObjId($a_parent_node_id);
207
208 if ($parent_obj_id > 0)
209 {
210 $parent_type = ilObject::_lookupType($parent_obj_id);
211 }
212 else
213 {
214 $parent_type = "dummy";
215 $this->type_grps["dummy"] = array("root" => "dummy");
216 }
217
218 if (empty($this->type_grps[$parent_type]))
219 {
220 $this->type_grps[$parent_type] =
221 $objDefinition->getGroupedRepositoryObjectTypes($parent_type);
222 }
223 $group = array();
224
225 foreach ($a_childs as $child)
226 {
227 $g = $objDefinition->getGroupOfObj($child["type"]);
228 if ($g == "")
229 {
230 $g = $child["type"];
231 }
232 $group[$g][] = $child;
233 }
234
235 // #14587 - $objDefinition->getGroupedRepositoryObjectTypes does NOT include side blocks!
236 $wl = $this->getTypeWhiteList();
237 if(is_array($wl) && in_array("poll", $wl))
238 {
239 $this->type_grps[$parent_type]["poll"] = array();
240 }
241
242 $childs = array();
243 foreach ($this->type_grps[$parent_type] as $t => $g)
244 {
245 if (is_array($group[$t]))
246 {
247 // do we have to sort this group??
248 include_once("./Services/Container/classes/class.ilContainer.php");
249 include_once("./Services/Container/classes/class.ilContainerSorting.php");
250 $sort = ilContainerSorting::_getInstance($parent_obj_id);
251 $group = $sort->sortItems($group);
252
253 // need extra session sorting here
254 if ($t == "sess")
255 {
256
257 }
258
259 foreach ($group[$t] as $k => $item)
260 {
261 $childs[] = $item;
262 }
263 }
264 }
265
266 return $childs;
267 }
static _getInstance($a_obj_id)
get instance by obj_id
static _lookupType($a_id, $a_reference=false)
lookup object type
getTypeWhiteList()
Get type white list.

References ilTreeExplorerGUI\$childs, $t, ilContainerSorting\_getInstance(), ilObject\_lookupObjId(), ilObject\_lookupType(), and ilTreeExplorerGUI\getTypeWhiteList().

+ Here is the call graph for this function:

Field Documentation

◆ $clickable_types

ilRepositorySelectorExplorerGUI::$clickable_types = array()
protected

Definition at line 26 of file class.ilRepositorySelectorExplorerGUI.php.

Referenced by getClickableTypes().

◆ $highlighted_node

ilRepositorySelectorExplorerGUI::$highlighted_node = null
protected

Definition at line 25 of file class.ilRepositorySelectorExplorerGUI.php.

Referenced by getHighlightedNode().

◆ $session_materials

ilRepositorySelectorExplorerGUI::$session_materials = array()
protected

Definition at line 24 of file class.ilRepositorySelectorExplorerGUI.php.

◆ $type_grps

ilRepositorySelectorExplorerGUI::$type_grps = array()
protected

Definition at line 23 of file class.ilRepositorySelectorExplorerGUI.php.


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