ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilOrgUnitExtension.php
Go to the documentation of this file.
1 <?php
2 
8 abstract class ilOrgUnitExtension extends ilObjectPlugin
9 {
10 
14  protected $ilObjOrgUnitTree;
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 }
$path
Definition: aliased.php:25
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
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="")
static getPluginObjectByType($type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
static lookupNameForId(string $a_ctype, string $a_cname, string $a_slot_id, string $a_plugin_id)
getEmployees($ref_id, $recursive=false)
Class ilOrgUnitExtension.
getSuperiors($ref_id, $recursive=false)
const IL_COMP_MODULE
Class ilObjOrgUnitTree Implements a singleton pattern for caching.
static getRootOrgRefId()
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getActivePluginIdsForSlot(string $a_ctype, string $a_cname, string $a_slot_id)
Get All active plugin ids for a slot.
getEmployees($recursively=false)
Get all user ids of employees of the underlying OrgUnit.
Class ilOrgUnitExtensionPlugin.