ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 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...
 
 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...
 

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
 

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...
 
- Protected Member Functions inherited from ilTreeExplorerGUI
 preloadChilds ()
 Preload childs. More...
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
- 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

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

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

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  }
68  $this->setTypeWhiteList($white);
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.
setPathOpen($a_id)
Set node path to be opened.
setTypeWhiteList($a_val)
Set type white list.
setOrderField($a_val, $a_numeric=false)
Set order field.
+ 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

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

269  {
270  global $ilAccess;
271 
272  if (!$ilAccess->checkAccess("read", "", $a_parent_node_id))
273  {
274  return array();
275  }
276 
277  return parent::getChildsOfNode($a_parent_node_id);
278  }

◆ getClickableTypes()

ilRepositorySelectorExplorerGUI::getClickableTypes ( )

get whitelist for clickable items

Returns
array types

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

References $clickable_types.

Referenced by isNodeClickable(), and ilForumMoveTopicsExplorer\renderNode().

+ 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 324 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

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

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

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.
getRootNode()
Get root node.
global $lng
Definition: privfeed.php:40
+ 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

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

References $ilCtrl.

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

◆ getNodeIcon()

ilRepositorySelectorExplorerGUI::getNodeIcon (   $a_node)

Get node icon.

Parameters
array$a_nodenode data
Returns
string icon path

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

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

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

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

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

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  }
getNodeId($a_node)
Get id for node.
getRootNode()
Get root node.
global $lng
Definition: privfeed.php:40
+ 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

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

References getClickableTypes().

Referenced by ilForumMoveTopicsExplorer\renderNode().

287  {
288  global $ilAccess;
289 
290  if ($this->select_postvar != "")
291  {
292  return false;
293  }
294 
295  if (!$ilAccess->checkAccess("read", "", $a_node["child"]))
296  {
297  return false;
298  }
299 
300  if(is_array($this->getClickableTypes()) && count($this->getClickableTypes())>0)
301  {
302  return in_array($a_node["type"], $this->getClickableTypes());
303  }
304 
305  return true;
306  }
getClickableTypes()
get whitelist for clickable items
+ 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

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

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

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  }
$_GET["client_id"]
getHighlightedNode()
get an alternate highlighted node if $_GET["ref_id"] is not set or wrong Returns null if not set ...
getNodeId($a_node)
Get id for node.
getRootNode()
Get root node.
+ 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

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

References $ilSetting, and ilTreeExplorerGUI\$tree.

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

◆ setClickableTypes()

ilRepositorySelectorExplorerGUI::setClickableTypes (   $a_types)

set Whitelist for clickable items

Parameters
array/string$a_types array type

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

335  {
336  if(!is_array($a_types))
337  {
338  $a_types = array($a_types);
339  }
340  $this->clickable_types = $a_types;
341  }

◆ 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 313 of file class.ilRepositorySelectorExplorerGUI.php.

314  {
315  $this->highlighted_node = $a_value;
316  }

◆ 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

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

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

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  $childs = array();
236  foreach ($this->type_grps[$parent_type] as $t => $g)
237  {
238  if (is_array($group[$t]))
239  {
240  // do we have to sort this group??
241  include_once("./Services/Container/classes/class.ilContainer.php");
242  include_once("./Services/Container/classes/class.ilContainerSorting.php");
243  $sort = ilContainerSorting::_getInstance($parent_obj_id);
244  $group = $sort->sortItems($group);
245 
246  // need extra session sorting here
247  if ($t == "sess")
248  {
249 
250  }
251 
252  foreach ($group[$t] as $k => $item)
253  {
254  $childs[] = $item;
255  }
256  }
257  }
258 
259  return $childs;
260  }
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getInstance($a_obj_id)
get instance by obj_id
+ 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: