ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilOrgUnitExplorerGUI Class Reference

Class ilOrgUnitExplorerGUI. More...

+ Inheritance diagram for ilOrgUnitExplorerGUI:
+ Collaboration diagram for ilOrgUnitExplorerGUI:

Public Member Functions

 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree, \ilAccessHandler $access=null)
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getRootNode ()
 
 getNodeIcon ($a_node)
 Get node icon. More...
 
 getNodeHref ($a_node)
 
 isNodeClickable ($a_node)
 
 isNodeSelectable ($a_node)
 
 getChildsOfNode ($a_parent_node_id)
 
- 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

 getLinkTarget ()
 
 getPluginLinkTarget ()
 
 filterChildrenByPermission (array $children)
 
- 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

const ORGU = "orgu"
 
array $stay_with_command = array('', 'render', 'view', 'infoScreen', 'showStaff', 'performPaste', 'cut')
 
ilTree $tree = null
 
ilAccessHandler $access
 
ILIAS HTTP Wrapper RequestWrapper $http_post
 
ILIAS HTTP Wrapper RequestWrapper $http_query
 
ILIAS Refinery Factory $refinery
 
- 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 Member Functions

 getNodeArrayRepresentation ($a_node)
 

Private Attributes

ilSetting $settings
 

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

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitExplorerGUI::__construct (   $a_expl_id,
  $a_parent_obj,
  $a_parent_cmd,
  $a_tree,
\ilAccessHandler  $access = null 
)
Parameters
$a_expl_id
$a_parent_obj
$a_parent_cmd
$a_tree
$access

Definition at line 46 of file class.ilOrgUnitExplorerGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\refinery(), ilExplorerBaseGUI\setAjax(), ILIAS\Repository\settings(), and ilTreeExplorerGUI\setTypeWhiteList().

47  {
48  global $DIC;
49  parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree);
50  $this->setAjax(true);
51  $this->setTypeWhiteList(array(self::ORGU));
52  $this->tree->initLangCode();
53  $this->access = $DIC->access();
54  $this->settings = $DIC->settings();
55  $this->http_post = $DIC->http()->wrapper()->post();
56  $this->http_query = $DIC->http()->wrapper()->query();
57  $this->refinery = $DIC["refinery"];
58  }
setTypeWhiteList(array $a_val)
Set type white list.
global $DIC
Definition: shib_login.php:25
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ filterChildrenByPermission()

ilOrgUnitExplorerGUI::filterChildrenByPermission ( array  $children)
protected

Definition at line 231 of file class.ilOrgUnitExplorerGUI.php.

References ILIAS\Repository\access().

Referenced by getChildsOfNode().

231  : array
232  {
233  return array_filter(
234  $children,
235  function ($child) {
236  return $this->access->checkAccess("visible", "", $child["ref_id"]);
237  }
238  );
239  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChildsOfNode()

ilOrgUnitExplorerGUI::getChildsOfNode (   $a_parent_node_id)

Definition at line 225 of file class.ilOrgUnitExplorerGUI.php.

References filterChildrenByPermission().

225  : array
226  {
227  $children = parent::getChildsOfNode($a_parent_node_id);
228  return $this->filterChildrenByPermission($children);
229  }
filterChildrenByPermission(array $children)
+ Here is the call graph for this function:

◆ getLinkTarget()

ilOrgUnitExplorerGUI::getLinkTarget ( )
protected

Definition at line 132 of file class.ilOrgUnitExplorerGUI.php.

References $stay_with_command, and ILIAS\Repository\ctrl().

Referenced by getNodeHref().

132  : string
133  {
134  if ($this->ctrl->getCmdClass() === strtolower(ilObjOrgUnitGUI::class) && in_array(
135  $this->ctrl->getCmd(),
137  true
138  )) {
139  return $this->ctrl->getLinkTargetByClass(
140  array(ilAdministrationGUI::class, $this->ctrl->getCmdClass()),
141  $this->ctrl->getCmd()
142  );
143  }
144 
145  return $this->ctrl->getLinkTargetByClass(array(ilAdministrationGUI::class, ilObjOrgUnitGUI::class), 'view');
146  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeArrayRepresentation()

ilOrgUnitExplorerGUI::getNodeArrayRepresentation (   $a_node)
private
Parameters
$a_node
Returns
array

Definition at line 216 of file class.ilOrgUnitExplorerGUI.php.

Referenced by getNodeContent(), getNodeHref(), getNodeIcon(), isNodeClickable(), and isNodeSelectable().

216  : array
217  {
218  if (is_object($a_node)) {
219  return (array) $a_node;
220  }
221 
222  return $a_node;
223  }
+ Here is the caller graph for this function:

◆ getNodeContent()

ilOrgUnitExplorerGUI::getNodeContent (   $a_node)

Get content of a node.

Parameters
object | array$a_nodenode array or object
Returns
string content of the node

Definition at line 65 of file class.ilOrgUnitExplorerGUI.php.

References $_GET, getNodeArrayRepresentation(), ILIAS\Repository\lng(), and ilUtil\secureString().

65  : string
66  {
67  $node = $this->getNodeArrayRepresentation($a_node);
68 
69  if ($node['title'] === '__OrgUnitAdministration') {
70  $node['title'] = $this->lng->txt('objs_orgu');
71  }
72  if ((int) $node['child'] === (int) $_GET['ref_id']) {
73  return "<span class='ilExp2NodeContent ilHighlighted'>" . $node['title'] . '</span>';
74  }
75 
76  return ilUtil::secureString($node['title']);
77  }
static secureString(string $a_str, bool $a_strip_html=true, string $a_allow="")
$_GET['cmd']
Definition: lti.php:26
+ Here is the call graph for this function:

◆ getNodeHref()

ilOrgUnitExplorerGUI::getNodeHref (   $a_node)
Parameters
array | object$a_node
Exceptions
ilCtrlException

Definition at line 110 of file class.ilOrgUnitExplorerGUI.php.

References ILIAS\Repository\ctrl(), getLinkTarget(), getNodeArrayRepresentation(), and getPluginLinkTarget().

110  : string
111  {
112  $node = $this->getNodeArrayRepresentation($a_node);
113 
114  if ($this->select_postvar) {
115  return '#';
116  }
117 
118  if ($this->ctrl->getCmd() === 'performPaste') {
119  $this->ctrl->setParameterByClass(ilObjOrgUnitGUI::class, 'target_node', $node['child']);
120  }
121  $array = $this->ctrl->getParameterArrayByClass(ilObjOrgUnitGUI::class);
122  $temp = $array['ref_id'];
123 
124  $this->ctrl->setParameterByClass(ilObjOrgUnitGUI::class, 'ref_id', $node['child']);
125  $this->ctrl->setParameterByClass(ilObjPluginDispatchGUI::class, 'ref_id', $node['child']);
126 
127  $link_target = ($node['type'] === self::ORGU) ? $this->getLinkTarget() : $this->getPluginLinkTarget();
128  $this->ctrl->setParameterByClass(ilObjOrgUnitGUI::class, 'ref_id', $temp);
129  return $link_target;
130  }
+ Here is the call graph for this function:

◆ getNodeIcon()

ilOrgUnitExplorerGUI::getNodeIcon (   $a_node)

Get node icon.

Parameters
array | object$a_nodeReturn custom icon of OrgUnit type if existing
Returns
string

Definition at line 90 of file class.ilOrgUnitExplorerGUI.php.

References ilObject\_getIcon(), ilObject\_lookupObjId(), ilObjOrgUnit\getIconsCache(), getNodeArrayRepresentation(), and ILIAS\Repository\settings().

90  : string
91  {
92  $node = $this->getNodeArrayRepresentation($a_node);
93 
94  $obj_id = 0;
95  if ($this->settings->get('custom_icons')) {
96  $icons_cache = ilObjOrgUnit::getIconsCache();
97  $obj_id = ilObject::_lookupObjId($node["child"]);
98  if (isset($icons_cache[$obj_id])) {
99  return $icons_cache[$obj_id];
100  }
101  }
102 
103  return ilObject::_getIcon($obj_id, "tiny", $node["type"]);
104  }
static getIconsCache()
Returns an array that maps from OrgUnit object IDs to its icon defined by the assigned OrgUnit type...
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:

◆ getPluginLinkTarget()

ilOrgUnitExplorerGUI::getPluginLinkTarget ( )
protected
Exceptions
ilCtrlException

Definition at line 151 of file class.ilOrgUnitExplorerGUI.php.

References ILIAS\Repository\ctrl().

Referenced by getNodeHref().

151  : string
152  {
153  return $this->ctrl->getLinkTargetByClass(ilObjPluginDispatchGUI::class, 'forward');
154  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootNode()

ilOrgUnitExplorerGUI::getRootNode ( )

Definition at line 79 of file class.ilOrgUnitExplorerGUI.php.

References ilObjOrgUnit\getRootOrgRefId(), and ilTreeExplorerGUI\getTree().

79  : array
80  {
81  return $this->getTree()->getNodeData(ilObjOrgUnit::getRootOrgRefId());
82  }
static getRootOrgRefId()
+ Here is the call graph for this function:

◆ isNodeClickable()

ilOrgUnitExplorerGUI::isNodeClickable (   $a_node)
Parameters
object | array$a_node
Returns
bool

Definition at line 160 of file class.ilOrgUnitExplorerGUI.php.

References ILIAS\Repository\access(), and getNodeArrayRepresentation().

160  : bool
161  {
162  $node = $this->getNodeArrayRepresentation($a_node);
163 
164  $node = $this->getNodeArrayRepresentation($a_node);
165 
166  if ($this->access->checkAccess('read', '', $node['ref_id'])) {
167  return true;
168  }
169 
170  return false;
171  }
+ Here is the call graph for this function:

◆ isNodeSelectable()

ilOrgUnitExplorerGUI::isNodeSelectable (   $a_node)
Parameters
$a_node
Returns
bool

Definition at line 178 of file class.ilOrgUnitExplorerGUI.php.

References $r, $refinery, ilExplorerBaseGUI\$selected_nodes, and getNodeArrayRepresentation().

178  : bool
179  {
181  if ($this->http_post->has("id")) {
182  // Node selected via multiselect in "manage".
183  $selected_nodes = $this->http_post->retrieve(
184  "id",
185  $r->kindlyTo()->listOf($r->kindlyTo()->int()),
186  );
187  } elseif ($this->http_query->has("item_ref_id")) {
188  // Node selected via "move"-action.
189  $selected_nodes = $this->http_query->retrieve(
190  "item_ref_id",
191  $r->kindlyTo()->listOf($r->kindlyTo()->int()),
192  );
193  } else {
194  // No node selected.
195  return true;
196  }
197 
198  $node = $this->getNodeArrayRepresentation($a_node);
199  foreach ($selected_nodes as $sn) {
200  // Can't insert into itself.
201  if ($node["child"] == $sn) {
202  return false;
203  }
204  // Can't insert below itself.
205  if ($this->tree->isGrandChild($sn, $node["child"])) {
206  return false;
207  }
208  }
209  return true;
210  }
ILIAS Refinery Factory $refinery
$r
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilOrgUnitExplorerGUI::$access
protected

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

◆ $http_post

ILIAS HTTP Wrapper RequestWrapper ilOrgUnitExplorerGUI::$http_post
protected

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

◆ $http_query

ILIAS HTTP Wrapper RequestWrapper ilOrgUnitExplorerGUI::$http_query
protected

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

◆ $refinery

ILIAS Refinery Factory ilOrgUnitExplorerGUI::$refinery
protected

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

Referenced by isNodeSelectable().

◆ $settings

ilSetting ilOrgUnitExplorerGUI::$settings
private

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

◆ $stay_with_command

array ilOrgUnitExplorerGUI::$stay_with_command = array('', 'render', 'view', 'infoScreen', 'showStaff', 'performPaste', 'cut')
protected

Definition at line 31 of file class.ilOrgUnitExplorerGUI.php.

Referenced by getLinkTarget().

◆ $tree

ilTree ilOrgUnitExplorerGUI::$tree = null
protected

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

◆ ORGU

const ilOrgUnitExplorerGUI::ORGU = "orgu"
protected

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


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