ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilOrgUnitExtension.php
Go to the documentation of this file.
1<?php
2
8abstract class ilOrgUnitExtension extends ilObjectPlugin
9{
10
18 protected $parent_ref_id;
22 protected $tree;
23
24
30 public function __construct($a_ref_id = 0)
31 {
32 global $DIC;
33 $tree = $DIC['tree'];
34
35 parent::__construct($a_ref_id);
37 $this->parent_ref_id = $tree->getParentId($a_ref_id ? $a_ref_id : $_GET['ref_id']);
38 $this->tree = $tree;
39 }
40
41
47 public static function getActivePluginIdsForTree()
48 {
52 $list = array();
53
54 $plugin_ids = ilPlugin::getActivePluginIdsForSlot(IL_COMP_MODULE, "OrgUnit", "orguext");
55 foreach ($plugin_ids as $plugin_id) {
57 if ($plugin->showInTree()) {
58 $list[] = $plugin_id;
59 }
60 }
61
62 return $list;
63 }
64
65
70 protected function getPlugin()
71 {
72 if (!$this->plugin) {
73 $this->plugin = ilPlugin::getPluginObject(IL_COMP_MODULE, "OrgUnit", "orguext", ilPlugin::lookupNameForId(IL_COMP_MODULE, "OrgUnit", "orguext", $this->getType()));
74 if (!$this->plugin instanceof ilOrgUnitExtensionPlugin) {
75 throw new ilPluginException("ilOrgUnitExtension: Could not instantiate plugin object for type " . $this->getType() . ".");
76 }
77 }
78
79 return $this->plugin;
80 }
81
82
90 public function getEmployees($recursively = false)
91 {
92 return $this->ilObjOrgUnitTree->getEmployees($this->parent_ref_id, $recursively);
93 }
94
95
103 public function getSuperiors($recursively = false)
104 {
105 return $this->ilObjOrgUnitTree->getSuperiors($this->parent_ref_id, $recursively);
106 }
107
108
112 public function getOrgUnit()
113 {
114 return ilObjectFactory::getInstanceByRefId($this->parent_ref_id);
115 }
116
117
121 public function getOrgUnitPathRefIds()
122 {
123 $path = array();
124 foreach ($this->getOrgUnitPath() as $node) {
125 $path[] = $node['child'];
126 }
127
128 return $path;
129 }
130
131
136 public function getOrgUnitPath()
137 {
138 return $this->tree->getPathFull($this->parent_ref_id, ilObjOrgUnit::getRootOrgRefId());
139 }
140
141
145 public function getOrgUnitPathTitles()
146 {
147 $titles = array();
148 foreach ($this->getOrgUnitPath() as $node) {
149 if ($node["title"] == "__OrgUnitAdministration") {
150 $node["title"] = $this->lng->txt("objs_orgu");
151 }
152 $titles[] = $node['title'];
153 }
154
155 return $titles;
156 }
157
158
165 public function getOrgUnitSubtree($with_data = true, $type = "")
166 {
167 $node = $this->tree->getNodeData($this->parent_ref_id);
168
169 return $this->tree->getSubTree($node, $with_data, $type);
170 }
171}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_MODULE
Class ilObjOrgUnitTree Implements a singleton pattern for caching.
getEmployees($ref_id, $recursive=false)
getSuperiors($ref_id, $recursive=false)
static getRootOrgRefId()
getType()
get object type @access public
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
Class ilOrgUnitExtensionPlugin.
Class ilOrgUnitExtension.
getOrgUnitSubtree($with_data=true, $type="")
__construct($a_ref_id=0)
ilOrgUnitExtension constructor.
getSuperiors($recursively=false)
Get all user ids of superiors of the underlying OrgUnit.
getEmployees($recursively=false)
Get all user ids of employees of the underlying OrgUnit.
static lookupNameForId(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_id)
static getActivePluginIdsForSlot(string $a_ctype, string $a_cname, string $a_slot_id)
Get All active plugin ids for a slot.
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46