ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilOrgUnitExtension.php
Go to the documentation of this file.
1 <?php
2 
3 require_once "Services/Repository/classes/class.ilObjectPlugin.php";
4 require_once "Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php";
5 require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
6 
12 abstract class ilOrgUnitExtension extends ilObjectPlugin {
13 
17  protected $ilObjOrgUnitTree;
18 
22  protected $parent_ref_id;
23 
27  protected $tree;
28 
34  public function __construct($a_ref_id = 0) {
35  global $tree;
36 
37  parent::__construct($a_ref_id);
39  $this->parent_ref_id = $tree->getParentId($a_ref_id ? $a_ref_id : $_GET['ref_id']);
40  $this->tree = $tree;
41  }
42 
48  public static function getActivePluginIdsForTree() {
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  if (!$this->plugin) {
72  $this->plugin = ilPlugin::getPluginObject(IL_COMP_MODULE, "OrgUnit", "orguext", ilPlugin::lookupNameForId(IL_COMP_MODULE, "OrgUnit", "orguext", $this->getType()));
73  if (!$this->plugin instanceof ilOrgUnitExtensionPlugin) {
74  throw new ilPluginException("ilOrgUnitExtension: Could not instantiate plugin object for type " . $this->getType() . ".");
75  }
76  }
77 
78  return $this->plugin;
79  }
80 
81 
88  public function getEmployees($recursively = false) {
89  return $this->ilObjOrgUnitTree->getEmployees($this->parent_ref_id, $recursively);
90  }
91 
92 
99  public function getSuperiors($recursively = false) {
100  return $this->ilObjOrgUnitTree->getSuperiors($this->parent_ref_id, $recursively);
101  }
102 
103 
107  public function getOrgUnit() {
108  return ilObjectFactory::getInstanceByRefId($this->parent_ref_id);
109  }
110 
114  public function getOrgUnitPathRefIds() {
115  $path = array();
116  foreach ($this->getOrgUnitPath() as $node) {
117  $path[] = $node['child'];
118  }
119  return $path;
120  }
121 
126  public function getOrgUnitPath() {
127  return $this->tree->getPathFull($this->parent_ref_id, ilObjOrgUnit::getRootOrgRefId());
128  }
129 
133  public function getOrgUnitPathTitles() {
134  $titles = array();
135  foreach ($this->getOrgUnitPath() as $node) {
136  if ($node["title"] == "__OrgUnitAdministration") {
137  $node["title"] = $this->lng->txt("objs_orgu");
138  }
139  $titles[] = $node['title'];
140  }
141  return $titles;
142  }
143 
149  public function getOrgUnitSubtree($with_data = true, $type = "") {
150  $node = $this->tree->getNodeData($this->parent_ref_id);
151  return $this->tree->getSubTree($node, $with_data, $type);
152  }
153 }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
$path
Definition: aliased.php:25
getSuperiors($recursively=false)
Get all user ids of superiors of the underlying OrgUnit.
$_GET["client_id"]
__construct($a_ref_id=0)
ilOrgUnitExtension constructor.
getOrgUnitSubtree($with_data=true, $type="")
getEmployees($ref_id, $recursive=false)
static getActivePluginIdsForSlot($a_ctype, $a_cname, $a_slot_id)
Get All active plugin ids for a slot.
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
Class ilOrgUnitExtension.
getSuperiors($ref_id, $recursive=false)
const IL_COMP_MODULE
Class ilObjOrgUnitTree Implements a singleton pattern for caching.
static getRepoPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
Create styles array
The data for the language used.
static getRootOrgRefId()
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
getEmployees($recursively=false)
Get all user ids of employees of the underlying OrgUnit.
Class ilOrgUnitExtensionPlugin.