ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilOrgUnitExtension.php
Go to the documentation of this file.
1<?php
2
23abstract class ilOrgUnitExtension extends ilObjectPlugin
24{
26 protected int $parent_ref_id;
27 protected ilTree $tree;
28
32 public function __construct(int $a_ref_id = 0)
33 {
34 global $DIC;
35 $tree = $DIC->repositoryTree();
36
37 $http = $DIC->http();
38 $refinery = $DIC->refinery();
39 $ref_id = $http->wrapper()->query()->retrieve('ref_id', $refinery->to()->int());
40
41 parent::__construct($a_ref_id);
43 $this->parent_ref_id = $tree->getParentId($a_ref_id ? $a_ref_id : $ref_id);
44 $this->tree = $tree;
45 }
46
51 public static function getActivePluginIdsForTree(): array
52 {
53 global $DIC;
54 $component_factory = $DIC["component.factory"];
55
59 $list = array();
60
61 foreach ($component_factory->getActivePluginsInSlot("orguext") as $plugin) {
62 if ($plugin->showInTree()) {
63 $list[] = $plugin->getId();
64 }
65 }
66
67 return $list;
68 }
69
75 public function getEmployees(bool $recursively = false): array
76 {
77 return $this->ilObjOrgUnitTree->getEmployees($this->parent_ref_id, $recursively);
78 }
79
85 public function getSuperiors(bool $recursively = false): array
86 {
87 return $this->ilObjOrgUnitTree->getSuperiors($this->parent_ref_id, $recursively);
88 }
89
90 public function getOrgUnit(): ?ilObject
91 {
92 return ilObjectFactory::getInstanceByRefId($this->parent_ref_id);
93 }
94
98 public function getOrgUnitPathRefIds(): array
99 {
100 $path = array();
101 foreach ($this->getOrgUnitPath() as $node) {
102 $path[] = $node['child'];
103 }
104
105 return $path;
106 }
107
111 public function getOrgUnitPath(): array
112 {
113 return $this->tree->getPathFull($this->parent_ref_id, ilObjOrgUnit::getRootOrgRefId());
114 }
115
119 public function getOrgUnitPathTitles(): array
120 {
121 $titles = array();
122 foreach ($this->getOrgUnitPath() as $node) {
123 if ($node["title"] == "__OrgUnitAdministration") {
124 $node["title"] = $this->lng->txt("objs_orgu");
125 }
126 $titles[] = $node['title'];
127 }
128
129 return $titles;
130 }
131
137 public function getOrgUnitSubtree(bool $with_data = true, string $type = ""): array
138 {
139 $node = $this->tree->getNodeData($this->parent_ref_id);
140
141 return $this->tree->getSubTree($node, $with_data, [$type]);
142 }
143}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getEmployees(int $ref_id, bool $recursive=false)
getSuperiors(int $ref_id, bool $recursive=false)
static getRootOrgRefId()
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilComponentFactory $component_factory
Class ilObject Basic functions for all objects.
string $type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $a_ref_id=0)
ilOrgUnitExtension constructor.
ilObjOrgUnitTree $ilObjOrgUnitTree
getOrgUnitSubtree(bool $with_data=true, string $type="")
getEmployees(bool $recursively=false)
Get all user ids of employees of the underlying OrgUnit.
getSuperiors(bool $recursively=false)
Get all user ids of superiors of the underlying OrgUnit.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getParentId(int $a_node_id)
get parent id of given node
$http
Definition: deliver.php:30
getActivePluginsInSlot(string $slot_id)
Get the active plugins for the given slot.
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26