ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilOrgUnitExtensionGUI.php
Go to the documentation of this file.
1 <?php
2 
3 require_once "Services/Repository/classes/class.ilObjectPluginGUI.php";
4 require_once "Modules/OrgUnit/classes/class.ilObjOrgUnit.php";
5 require_once "Modules/OrgUnit/classes/class.ilOrgUnitExplorerGUI.php";
6 require_once("./Modules/OrgUnit/classes/Extension/class.ilOrgUnitExtension.php");
7 
13 abstract class ilOrgUnitExtensionGUI extends ilObjectPluginGUI {
14 
18  protected $ilLocator;
19 
20 
28  public function __construct($a_ref_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0) {
29  global $ilLocator;
30  parent::__construct($a_ref_id, $a_id_type, $a_parent_node_id);
31  $this->ilLocator = $ilLocator;
32  $this->showTree();
33  }
34 
35 
42  protected function getPlugin() {
43  if (!$this->plugin) {
44  $this->plugin = ilPlugin::getPluginObject(IL_COMP_MODULE, "OrgUnit", "orguext", ilPlugin::lookupNameForId(IL_COMP_MODULE, "OrgUnit", "orguext", $this->getType()));
45  if (!$this->plugin instanceof ilOrgUnitExtensionPlugin) {
46  throw new ilPluginException("ilObjectPluginGUI: Could not instantiate plugin object for type " . $this->getType() . ".");
47  }
48  }
49 
50  return $this->plugin;
51  }
52 
53 
57  protected function supportsExport() {
58  return false;
59  }
60 
61 
65  protected function lookupParentTitleInCreationMode() {
66  $parent = parent::lookupParentTitleInCreationMode();
67  if ($parent == '__OrgUnitAdministration') {
68  return $this->lng->txt("objs_orgu");
69  }
70 
71  return $parent;
72  }
73 
77  protected function supportsCloning() {
78  return false;
79  }
80 
81 
85  protected function setLocator() {
86  global $tpl;
87  if ($this->getCreationMode()) {
88  $endnode_id = $this->parent_id;
89  } else {
90  $endnode_id = $this->ref_id;
91  }
92 
93  $path = $this->tree->getPathFull($endnode_id, ilObjOrgUnit::getRootOrgRefId());
94  // add item for each node on path
95  foreach ((array)$path as $key => $row) {
96  if ($row["title"] == "__OrgUnitAdministration") {
97  $row["title"] = $this->lng->txt("objs_orgu");
98  }
99  $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $row["child"]);
100  $this->ilLocator->addItem($row["title"], $this->ctrl->getLinkTargetByClass(array(
101  "iladministrationgui",
102  "ilobjorgunitgui",
103  ), "view"), ilFrameTargetInfo::_getFrame("MainContent"), $row["child"]);
104  $this->ctrl->setParameterByClass("ilobjplugindispatchgui", "ref_id", $_GET["ref_id"]);
105  }
106  $tpl->setLocator();
107  }
108 
109 
113  public function showTree() {
114  $this->ctrl->setParameterByClass("ilObjPluginDispatchGUI", "ref_id", $_GET["ref_id"]);
115  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $_GET["ref_id"]);
116  $tree = new ilOrgUnitExplorerGUI("orgu_explorer", array("ilAdministrationGUI", "ilObjOrgUnitGUI"), "showTree", new ilTree(1));
117  $tree->setTypeWhiteList($this->getTreeWhiteList());
118  if (!$tree->handleCommand()) {
119  $this->tpl->setLeftNavContent($tree->getHTML());
120  }
121  }
122 
123 
127  protected function getTreeWhiteList() {
128  $whiteList = array("orgu");
129  $pls = ilOrgUnitExtension::getActivePluginIdsForTree();
130 
131  return array_merge($whiteList, $pls);
132  }
133 }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
$path
Definition: aliased.php:25
showTree()
Views in the Org Unit have the Navigation Tree enabled by default.
$_GET["client_id"]
getType()
Functions that must be overwritten.
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
const IL_COMP_MODULE
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
Class ilOrgUnitExtensionGUI.
static getRootOrgRefId()
static _getFrame($a_class, $a_type='')
Get content frame name.
__construct($a_ref_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
ilOrgUnitExtensionGUI constructor.
setLocator()
Override the locator (breadcrumbs).
Class ilOrgUnitExplorerGUI.
Class ilOrgUnitExtensionPlugin.