ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 Get root node. More...
 
 getNodeIcon ($a_node)
 Get node icon. More...
 
 getNodeHref ($a_node)
 
 isNodeClickable ($a_node)
 
 isNodeSelectable ($a_node)
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
- 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
 getChildren ( $record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 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 44 of file class.ilOrgUnitExplorerGUI.php.

45 {
46 global $DIC;
47 parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree);
48 $this->setAjax(true);
49 $this->setTypeWhiteList(array(self::ORGU));
50 $this->tree->initLangCode();
51 $this->access = $DIC->access();
52 $this->settings = $DIC->settings();
53 $this->http_post = $DIC->http()->wrapper()->post();
54 $this->http_query = $DIC->http()->wrapper()->query();
55 $this->refinery = $DIC["refinery"];
56 }
setTypeWhiteList(array $a_val)
Set type white list.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ filterChildrenByPermission()

ilOrgUnitExplorerGUI::filterChildrenByPermission ( array  $children)
protected

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

229 : array
230 {
231 return array_filter(
232 $children,
233 function ($child) {
234 return $this->access->checkAccess("visible", "", $child["ref_id"]);
235 }
236 );
237 }

References ILIAS\Repository\access().

Referenced by getChildsOfNode().

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

◆ getChildsOfNode()

ilOrgUnitExplorerGUI::getChildsOfNode (   $a_parent_node_id)

Get childs of node.

Parameters
int | string$a_parent_node_idparent id
Returns
array childs

Reimplemented from ilTreeExplorerGUI.

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

223 : array
224 {
225 $children = parent::getChildsOfNode($a_parent_node_id);
226 return $this->filterChildrenByPermission($children);
227 }
filterChildrenByPermission(array $children)

References filterChildrenByPermission().

+ Here is the call graph for this function:

◆ getLinkTarget()

ilOrgUnitExplorerGUI::getLinkTarget ( )
protected

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

130 : string
131 {
132 if ($this->ctrl->getCmdClass() === strtolower(ilObjOrgUnitGUI::class) && in_array(
133 $this->ctrl->getCmd(),
134 $this->stay_with_command,
135 true
136 )) {
137 return $this->ctrl->getLinkTargetByClass(
138 array(ilAdministrationGUI::class, $this->ctrl->getCmdClass()),
139 $this->ctrl->getCmd()
140 );
141 }
142
143 return $this->ctrl->getLinkTargetByClass(array(ilAdministrationGUI::class, ilObjOrgUnitGUI::class), 'view');
144 }

References ILIAS\Repository\ctrl().

Referenced by getNodeHref().

+ 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 214 of file class.ilOrgUnitExplorerGUI.php.

214 : array
215 {
216 if (is_object($a_node)) {
217 return (array) $a_node;
218 }
219
220 return $a_node;
221 }

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

+ 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

Reimplemented from ilExplorerBaseGUI.

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

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

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

+ Here is the call graph for this function:

◆ getNodeHref()

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

Reimplemented from ilExplorerBaseGUI.

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

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

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

+ 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

Reimplemented from ilExplorerBaseGUI.

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

88 : string
89 {
90 $node = $this->getNodeArrayRepresentation($a_node);
91
92 $obj_id = 0;
93 if ($this->settings->get('custom_icons')) {
94 $icons_cache = ilObjOrgUnit::getIconsCache();
95 $obj_id = ilObject::_lookupObjId($node["child"]);
96 if (isset($icons_cache[$obj_id])) {
97 return $icons_cache[$obj_id];
98 }
99 }
100
101 return ilObject::_getIcon($obj_id, "tiny", $node["type"]);
102 }
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)

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

+ Here is the call graph for this function:

◆ getPluginLinkTarget()

ilOrgUnitExplorerGUI::getPluginLinkTarget ( )
protected
Exceptions
ilCtrlException

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

149 : string
150 {
151 return $this->ctrl->getLinkTargetByClass(ilObjPluginDispatchGUI::class, 'forward');
152 }

References ILIAS\Repository\ctrl().

Referenced by getNodeHref().

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

◆ getRootNode()

ilOrgUnitExplorerGUI::getRootNode ( )

Get root node.

Returns
object|array node

Reimplemented from ilTreeExplorerGUI.

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

77 : array
78 {
79 return $this->getTree()->getNodeData(ilObjOrgUnit::getRootOrgRefId());
80 }
static getRootOrgRefId()

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

+ Here is the call graph for this function:

◆ isNodeClickable()

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

Reimplemented from ilExplorerBaseGUI.

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

158 : bool
159 {
160 $node = $this->getNodeArrayRepresentation($a_node);
161
162 $node = $this->getNodeArrayRepresentation($a_node);
163
164 if ($this->access->checkAccess('read', '', $node['ref_id'])) {
165 return true;
166 }
167
168 return false;
169 }

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

+ Here is the call graph for this function:

◆ isNodeSelectable()

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

Reimplemented from ilExplorerBaseGUI.

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilOrgUnitExplorerGUI::$access
protected

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

◆ $http_post

ILIAS HTTP Wrapper RequestWrapper ilOrgUnitExplorerGUI::$http_post
protected

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

◆ $http_query

ILIAS HTTP Wrapper RequestWrapper ilOrgUnitExplorerGUI::$http_query
protected

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

◆ $refinery

ILIAS Refinery Factory ilOrgUnitExplorerGUI::$refinery
protected

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

Referenced by isNodeSelectable().

◆ $settings

ilSetting ilOrgUnitExplorerGUI::$settings
private

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

◆ $stay_with_command

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

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

◆ $tree

ilTree ilOrgUnitExplorerGUI::$tree = null
protected

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

◆ ORGU

const ilOrgUnitExplorerGUI::ORGU = "orgu"
protected

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

Referenced by getNodeHref().


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