ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilOrgUnitExtension.php
Go to the documentation of this file.
1<?php
2
8abstract class ilOrgUnitExtension extends ilObjectPlugin
9{
10
15
19 protected $parent_ref_id;
20
24 protected $tree;
25
31 public function __construct($a_ref_id = 0)
32 {
33 global $DIC;
34 $tree = $DIC['tree'];
35
36 parent::__construct($a_ref_id);
38 $this->parent_ref_id = $tree->getParentId($a_ref_id ? $a_ref_id : $_GET['ref_id']);
39 $this->tree = $tree;
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
89 public function getEmployees($recursively = false)
90 {
91 return $this->ilObjOrgUnitTree->getEmployees($this->parent_ref_id, $recursively);
92 }
93
94
101 public function getSuperiors($recursively = false)
102 {
103 return $this->ilObjOrgUnitTree->getSuperiors($this->parent_ref_id, $recursively);
104 }
105
106
110 public function getOrgUnit()
111 {
112 return ilObjectFactory::getInstanceByRefId($this->parent_ref_id);
113 }
114
118 public function getOrgUnitPathRefIds()
119 {
120 $path = array();
121 foreach ($this->getOrgUnitPath() as $node) {
122 $path[] = $node['child'];
123 }
124 return $path;
125 }
126
131 public function getOrgUnitPath()
132 {
133 return $this->tree->getPathFull($this->parent_ref_id, ilObjOrgUnit::getRootOrgRefId());
134 }
135
139 public function getOrgUnitPathTitles()
140 {
141 $titles = array();
142 foreach ($this->getOrgUnitPath() as $node) {
143 if ($node["title"] == "__OrgUnitAdministration") {
144 $node["title"] = $this->lng->txt("objs_orgu");
145 }
146 $titles[] = $node['title'];
147 }
148 return $titles;
149 }
150
156 public function getOrgUnitSubtree($with_data = true, $type = "")
157 {
158 $node = $this->tree->getNodeData($this->parent_ref_id);
159 return $this->tree->getSubTree($node, $with_data, $type);
160 }
161}
$_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 getRepoPluginObjectByType($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 getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
static getActivePluginIdsForSlot($a_ctype, $a_cname, $a_slot_id)
Get All active plugin ids for a slot.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7