ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilRepositorySelectorExplorerGUI Class Reference

Explorer for selecting repository items. More...

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

Public Member Functions

 setNodeContentModifier (Closure $a_val)
 
 getNodeContentModifier ()
 
 getNodeContent ($a_node)
 
 getNodeIcon ($a_node)
 
 getNodeIconAlt ($a_node)
 
 isNodeHighlighted ($a_node)
 
 getNodeHref ($a_node)
 
 isNodeVisible ($a_node)
 
 sortChilds (array $a_childs, $a_parent_node_id)
 
 getChildsOfNode ($a_parent_node_id)
 
 setClickablePermission (string $rbac_perm)
 
 isNodeClickable ($a_node)
 
 setHighlightedNode (string $a_value)
 
 getHighlightedNode ()
 
 setClickableTypes (array $a_types)
 
 getClickableTypes ()
 
 setSelectableTypes (array $a_types)
 
 getSelectableTypes ()
 
- Public Member Functions inherited from ilTreeExplorerGUI
 __construct (string $a_expl_id, $a_parent_obj, string $a_parent_cmd, ilTree $a_tree, string $a_node_parameter_name="node_id")
 
 getTree ()
 
 setOrderField (string $a_val, bool $a_numeric=false)
 
 getOrderField ()
 
 setTypeWhiteList (array $a_val)
 Set type white list. More...
 
 getTypeWhiteList ()
 Get type white list. More...
 
 setTypeBlackList (array $a_val)
 Set type black list. More...
 
 getTypeBlackList ()
 Get type black list. More...
 
 setPreloadChilds (bool $a_val)
 
 getPreloadChilds ()
 
 getSuccessorNode ( $a_node_id, string $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...
 
 setRootId ($a_root)
 
 setPathOpen ($a_id)
 Set node path to be opened. More...
 
 getHTML ($new=false)
 Get HTML. More...
 
 getChildren ($record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record, $environment=null)
 
 getTreeLabel ()
 
 getTreeComponent ()
 
 toggleExplorerNodeState ()
 Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed. More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 setChildLimit (int $a_val)
 
 getChildLimit ()
 
 setSearchTerm (string $a_val)
 
 getSearchTerm ()
 
 setMainTemplate (?ilGlobalTemplateInterface $a_main_tpl=null)
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get children 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 children Please note that this standard method may not be optimal depending on what a derived class does in isNodeVisible. More...
 
 sortChilds (array $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 (bool $a_val)
 
 getSkipRootNode ()
 
 setAjax (bool $a_val)
 
 getAjax ()
 
 setSecondaryHighlightedNodes (array $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 (string $a_postvar, bool $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 (bool $a_val)
 
 getOfflineMode ()
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 
 renderNode ($a_node, ilTemplate $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, ilTemplate $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId (string $a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart (ilTemplate $tpl, $a_node)
 List item start. More...
 
 listItemEnd (ilTemplate $tpl)
 
 listStart (ilTemplate $tpl)
 
 listEnd (ilTemplate $tpl)
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled (bool $nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd (bool $enable_dnd)
 
- Public Member Functions inherited from ILIAS\UI\Component\Tree\TreeRecursion
 build (Node\Factory $factory, $record, $environment=null)
 Build and return a Node. More...
 

Protected Member Functions

 isNodeSelectable ($a_node)
 
- Protected Member Functions inherited from ilTreeExplorerGUI
 preloadChilds ()
 
 matches ($node)
 Does a node match a search term (or is search term empty) More...
 
 getRootId ()
 
 createNode (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
 Creates at tree node, can be overwritten in derivatives if another node type should be used. More...
 
 getNodeStateToggleCmdClasses ($record)
 Should return an array of ilCtrl-enabled command classes which should be used to build the URL for the expand/collapse actions applied on a tree node. More...
 
 render ()
 
- 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...
 
 isNodeOpen ($node_id)
 Get all open nodes. More...
 
 getJSTreePlugins ()
 
 isNodeRequested (string $a_node_id)
 

Protected Attributes

ilObjectDefinition $obj_definition
 
array $type_grps = []
 
array $session_materials = []
 
string $highlighted_node = ""
 
array $clickable_types = []
 
array $selectable_types = []
 
ilAccessHandler $access
 
Closure $nc_modifier = null
 
string $selection_gui = null
 
string $selection_par
 
string $selection_cmd
 
StandardGUIRequest $request
 
int $cur_ref_id
 
- Protected Attributes inherited from ilTreeExplorerGUI
ilLanguage $lng
 
Psr Http Message ServerRequestInterface $httpRequest
 
ilTree $tree = null
 
string $tree_label = ""
 
string $order_field = ""
 
bool $order_field_numeric = false
 
array $type_white_list = array()
 
array $type_black_list = array()
 
array $childs = array()
 
bool $preloaded = false
 
bool $preload_childs = false
 
array $root_node_data = null
 
array $all_childs = array()
 
 $root_id = 0
 
ILIAS DI UIServices $ui
 
- Protected Attributes inherited from ilExplorerBaseGUI
string $node_parameter_name
 
ilLogger $log
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
bool $skip_root_node = false
 
bool $ajax = false
 
array $custom_open_nodes = array()
 
array $selected_nodes = array()
 
string $select_postvar = ""
 
bool $offline_mode = false
 
array $sec_highl_nodes = array()
 
bool $enable_dnd = false
 
string $search_term = ""
 
array $open_nodes = []
 
ilSessionIStorage $store
 
bool $select_multi = false
 
 $parent_obj
 
int $child_limit = 0
 
string $parent_cmd = ''
 
string $requested_exp_cmd = ""
 
string $requested_exp_cont = ""
 
string $requested_searchterm = ""
 
string $requested_node_id = ""
 
string $id
 

Private Attributes

string $clickable_permission = 'read'
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 
static getLocalJsTreeJsPath ()
 
static getLocalJsTreeCssPath ()
 
static createHTMLExportDirs (string $a_target_dir)
 
static init (?ilGlobalTemplateInterface $a_main_tpl=null)
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static string $js_tree_path = "./node_modules/jstree/dist/jstree.js"
 
static string $js_tree_path_css = "./node_modules/jstree/dist/themes/default/style.min.css"
 
static string $js_expl_path = "assets/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.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ getChildsOfNode()

ilRepositorySelectorExplorerGUI::getChildsOfNode (   $a_parent_node_id)

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

References $access.

245  : array
246  {
247  $ilAccess = $this->access;
248  if (!$ilAccess->checkAccess("read", "", (int) $a_parent_node_id)) {
249  return [];
250  }
251 
252  return parent::getChildsOfNode($a_parent_node_id);
253  }

◆ getClickableTypes()

ilRepositorySelectorExplorerGUI::getClickableTypes ( )

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

References $clickable_types.

Referenced by isNodeClickable().

290  : array
291  {
292  return $this->clickable_types;
293  }
+ Here is the caller graph for this function:

◆ getHighlightedNode()

ilRepositorySelectorExplorerGUI::getHighlightedNode ( )

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

References $highlighted_node.

Referenced by isNodeHighlighted().

280  : string
281  {
283  }
+ Here is the caller graph for this function:

◆ getNodeContent()

ilRepositorySelectorExplorerGUI::getNodeContent (   $a_node)

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

References $c, ilTreeExplorerGUI\$lng, getNodeContentModifier(), ilTreeExplorerGUI\getNodeId(), ilTreeExplorerGUI\getRootNode(), and ilLanguage\txt().

116  : string
117  {
118  $lng = $this->lng;
119 
120  $c = $this->getNodeContentModifier();
121  if (is_callable($c)) {
122  return $c($a_node);
123  }
124 
125  $title = $a_node["title"];
126  if ($title === "ILIAS" && (int) $a_node["child"] === (int) $this->getNodeId($this->getRootNode())) {
127  $title = $lng->txt("repository");
128  }
129 
130  return (string) $title;
131  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$c
Definition: deliver.php:25
getNodeId($a_node)
Get id for node.
getRootNode()
Get root node.
+ Here is the call graph for this function:

◆ getNodeContentModifier()

ilRepositorySelectorExplorerGUI::getNodeContentModifier ( )

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

References $nc_modifier.

Referenced by getNodeContent().

+ Here is the caller graph for this function:

◆ getNodeHref()

ilRepositorySelectorExplorerGUI::getNodeHref (   $a_node)

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

References ilExplorerBaseGUI\$ctrl, and ilCtrl\setParameterByClass().

170  : string
171  {
172  $ilCtrl = $this->ctrl;
173 
174  if ($this->select_postvar === "") {
175  $ilCtrl->setParameterByClass($this->selection_gui, $this->selection_par, $a_node["child"]);
176  $link = $ilCtrl->getLinkTargetByClass($this->selection_gui, $this->selection_cmd);
177  $ilCtrl->setParameterByClass($this->selection_gui, $this->selection_par, "");
178  } else {
179  return "#";
180  }
181 
182  return $link;
183  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
+ Here is the call graph for this function:

◆ getNodeIcon()

ilRepositorySelectorExplorerGUI::getNodeIcon (   $a_node)

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

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

133  : string
134  {
135  $obj_id = ilObject::_lookupObjId($a_node["child"]);
136  return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
137  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilRepositorySelectorExplorerGUI::getNodeIconAlt (   $a_node)

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

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

139  : string
140  {
141  $lng = $this->lng;
142 
143  if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
144  $title = $a_node["title"];
145  if ($title === "ILIAS") {
146  $title = $lng->txt("repository");
147  }
148  return $lng->txt("icon") . " " . $title;
149  }
150 
151  return parent::getNodeIconAlt($a_node);
152  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getNodeId($a_node)
Get id for node.
getRootNode()
Get root node.
+ Here is the call graph for this function:

◆ getSelectableTypes()

ilRepositorySelectorExplorerGUI::getSelectableTypes ( )

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

References $selectable_types.

Referenced by isNodeSelectable().

300  : array
301  {
303  }
+ Here is the caller graph for this function:

◆ isNodeClickable()

ilRepositorySelectorExplorerGUI::isNodeClickable (   $a_node)

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

References $access, and getClickableTypes().

260  : bool
261  {
262  $ilAccess = $this->access;
263 
264  if (!$ilAccess->hasUserRBACorAnyPositionAccess($this->clickable_permission, $a_node["child"])) {
265  return false;
266  }
267 
268  if (is_array($this->getClickableTypes()) && count($this->getClickableTypes()) > 0) {
269  return in_array($a_node["type"], $this->getClickableTypes(), true);
270  }
271 
272  return true;
273  }
+ Here is the call graph for this function:

◆ isNodeHighlighted()

ilRepositorySelectorExplorerGUI::isNodeHighlighted (   $a_node)

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

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

154  : bool
155  {
156  if ($this->getHighlightedNode()) {
157  if ((int) $this->getHighlightedNode() === (int) $a_node["child"]) {
158  return true;
159  }
160  return false;
161  }
162 
163  if ((int) $a_node["child"] === $this->cur_ref_id ||
164  ($this->cur_ref_id === 0 && (int) $a_node["child"] === (int) $this->getNodeId($this->getRootNode()))) {
165  return true;
166  }
167  return false;
168  }
getNodeId($a_node)
Get id for node.
getRootNode()
Get root node.
+ Here is the call graph for this function:

◆ isNodeSelectable()

ilRepositorySelectorExplorerGUI::isNodeSelectable (   $a_node)
protected

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

References getSelectableTypes().

305  : bool
306  {
307  if (count($this->getSelectableTypes())) {
308  return in_array($a_node['type'], $this->getSelectableTypes(), true);
309  }
310  return true;
311  }
+ Here is the call graph for this function:

◆ isNodeVisible()

ilRepositorySelectorExplorerGUI::isNodeVisible (   $a_node)

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

References $access.

185  : bool
186  {
187  $ilAccess = $this->access;
188 
189  if (!$ilAccess->checkAccess('visible', '', $a_node["child"])) {
190  return false;
191  }
192 
193  return true;
194  }

◆ setClickablePermission()

ilRepositorySelectorExplorerGUI::setClickablePermission ( string  $rbac_perm)

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

255  : void
256  {
257  $this->clickable_permission = $rbac_perm;
258  }

◆ setClickableTypes()

ilRepositorySelectorExplorerGUI::setClickableTypes ( array  $a_types)

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

Referenced by ilStandardGlossarySelectorGUI\__construct(), ilPCFileItemFileSelectorGUI\__construct(), and ilTestQuestionPoolSelectorExplorer\__construct().

285  : void
286  {
287  $this->clickable_types = $a_types;
288  }
+ Here is the caller graph for this function:

◆ setHighlightedNode()

ilRepositorySelectorExplorerGUI::setHighlightedNode ( string  $a_value)

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

275  : void
276  {
277  $this->highlighted_node = $a_value;
278  }

◆ setNodeContentModifier()

ilRepositorySelectorExplorerGUI::setNodeContentModifier ( Closure  $a_val)

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

106  : void
107  {
108  $this->nc_modifier = $a_val;
109  }

◆ setSelectableTypes()

ilRepositorySelectorExplorerGUI::setSelectableTypes ( array  $a_types)

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

295  : void
296  {
297  $this->selectable_types = $a_types;
298  }

◆ sortChilds()

ilRepositorySelectorExplorerGUI::sortChilds ( array  $a_childs,
  $a_parent_node_id 
)

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

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

196  : array
197  {
198  $objDefinition = $this->obj_definition;
199 
200  $parent_obj_id = ilObject::_lookupObjId((int) $a_parent_node_id);
201 
202  if ($parent_obj_id > 0) {
203  $parent_type = ilObject::_lookupType($parent_obj_id);
204  } else {
205  $parent_type = "dummy";
206  $this->type_grps["dummy"] = ["root" => "dummy"];
207  }
208 
209  if (empty($this->type_grps[$parent_type])) {
210  $this->type_grps[$parent_type] =
211  $objDefinition::getGroupedRepositoryObjectTypes($parent_type);
212  }
213  $group = [];
214 
215  foreach ($a_childs as $child) {
216  $g = $objDefinition->getGroupOfObj($child["type"]);
217  if ($g == "") {
218  $g = $child["type"];
219  }
220  $group[$g][] = $child;
221  }
222 
223  // #14587 - $objDefinition->getGroupedRepositoryObjectTypes does NOT include side blocks!
224  $wl = $this->getTypeWhiteList();
225  if (is_array($wl) && in_array("poll", $wl, true)) {
226  $this->type_grps[$parent_type]["poll"] = [];
227  }
228 
229  $childs = [];
230  foreach ($this->type_grps[$parent_type] as $t => $g) {
231  if (isset($group[$t])) {
232  // do we have to sort this group??
233  $sort = ilContainerSorting::_getInstance($parent_obj_id);
234  $group = $sort->sortItems($group);
235 
236  foreach ($group[$t] as $k => $item) {
237  $childs[] = $item;
238  }
239  }
240  }
241 
242  return $childs;
243  }
static _lookupObjId(int $ref_id)
static _getInstance(int $a_obj_id)
static _lookupType(int $id, bool $reference=false)
getTypeWhiteList()
Get type white list.
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilRepositorySelectorExplorerGUI::$access
protected

◆ $clickable_permission

string ilRepositorySelectorExplorerGUI::$clickable_permission = 'read'
private

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

◆ $clickable_types

array ilRepositorySelectorExplorerGUI::$clickable_types = []
protected

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

Referenced by getClickableTypes().

◆ $cur_ref_id

int ilRepositorySelectorExplorerGUI::$cur_ref_id
protected

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

◆ $highlighted_node

string ilRepositorySelectorExplorerGUI::$highlighted_node = ""
protected

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

Referenced by getHighlightedNode().

◆ $nc_modifier

Closure ilRepositorySelectorExplorerGUI::$nc_modifier = null
protected

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

Referenced by getNodeContentModifier().

◆ $obj_definition

ilObjectDefinition ilRepositorySelectorExplorerGUI::$obj_definition
protected

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

Referenced by sortChilds().

◆ $request

StandardGUIRequest ilRepositorySelectorExplorerGUI::$request
protected

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

◆ $selectable_types

array ilRepositorySelectorExplorerGUI::$selectable_types = []
protected

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

Referenced by getSelectableTypes().

◆ $selection_cmd

string ilRepositorySelectorExplorerGUI::$selection_cmd
protected

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

◆ $selection_gui

string ilRepositorySelectorExplorerGUI::$selection_gui = null
protected

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

◆ $selection_par

string ilRepositorySelectorExplorerGUI::$selection_par
protected

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

◆ $session_materials

array ilRepositorySelectorExplorerGUI::$session_materials = []
protected

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

◆ $type_grps

array ilRepositorySelectorExplorerGUI::$type_grps = []
protected

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


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