ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAdministrationExplorer.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4/*
5* Administration Explorer
6*
7* @author Alex Killing <alex.killing@gmx.de>
8* @version $Id$
9*
10*/
11
12require_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
13
15{
19 protected $lng;
20
24 protected $obj_definition;
25
29 protected $rbacsystem;
30
31
37 public $root_id;
38 public $output;
39 public $ctrl;
46 public function __construct($a_target)
47 {
48 global $DIC;
49
50 $this->lng = $DIC->language();
51 $this->obj_definition = $DIC["objDefinition"];
52 $this->rbacsystem = $DIC->rbac()->system();
53 $tree = $DIC->repositoryTree();
54 $ilCtrl = $DIC->ctrl();
55 $lng = $DIC->language();
56
57 $this->ctrl = $ilCtrl;
58
59 parent::__construct($a_target);
60 $this->tree = $tree;
61 $this->root_id = $this->tree->readRootId();
62 $this->order_column = "title";
63 $this->setSessionExpandVariable("expand");
64 $this->setTitle($lng->txt("overview"));
65 }
66
74 public function formatHeader(&$tpl, $a_obj_id, $a_option)
75 {
77 $objDefinition = $this->obj_definition;
78
79 if ($_GET["admin_mode"] == "settings") {
80 return;
81 }
82
83 $tpl->setCurrentBlock("icon");
84 $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_root.svg"));
85 $tpl->setVariable("TXT_ALT_IMG", $lng->txt("repository"));
86 $tpl->parseCurrentBlock();
87
88 $class_name = $objDefinition->getClassName("root");
89 $class = strtolower("ilObj" . $class_name . "GUI");
90 $this->ctrl->setParameterByClass($class, "ref_id", ROOT_FOLDER_ID);
91 $link = $this->ctrl->getLinkTargetByClass($class, "view");
92
93 $tpl->setCurrentBlock("link");
94 $tpl->setVariable("TITLE", $lng->txt("repository"));
95 $tpl->setVariable("LINK_TARGET", $link);
96 $tpl->setVariable("TARGET", " target=\"content\"");
97 $tpl->parseCurrentBlock();
98
99 $tpl->setCurrentBlock("element");
100 $tpl->parseCurrentBlock();
101 }
102
106 public function buildLinkTarget($a_node_id, $a_type)
107 {
109 $objDefinition = $this->obj_definition;
110
111 if ($a_type == "" || $a_type == "xxx") {
112 return;
113 }
114 if ($_GET["admin_mode"] == "settings" && $a_node_id == ROOT_FOLDER_ID) {
115 $this->ctrl->setParameterByClass("iladministrationgui", "ref_id", ROOT_FOLDER_ID);
116 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
117 $link = $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset");
118 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
119 } else {
120 $class_name = $objDefinition->getClassName($a_type);
121 $class = strtolower("ilObj" . $class_name . "GUI");
122 $this->ctrl->setParameterByClass($class, "ref_id", $a_node_id);
123 $link = $this->ctrl->getLinkTargetByClass($class, "view");
124 }
125 return $link;
126 }
127
131 public function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
132 {
133 if ($_GET["admin_mode"] == "settings" && $a_child == ROOT_FOLDER_ID) {
134 return ilFrameTargetInfo::_getFrame("MainContent");
135 } else {
136 return $this->frame_target;
137 }
138 }
139
140
144 public function getImage($a_name, $a_type = "", $a_obj_id = "")
145 {
146 if ($a_type != "") {
147 return ilObject::_getIcon($a_obj_id, "tiny", $a_type);
148 }
149
150 return parent::getImage($a_name);
151 }
152
153 public function isClickable($a_type, $a_ref_id)
154 {
156
157 return $rbacsystem->checkAccess('read', $a_ref_id);
158 }
159
160 public function isVisible($a_ref_id, $a_type)
161 {
163
164 if ($this->tree->getParentId($a_ref_id) == ROOT_FOLDER_ID && $a_type != "adm" &&
165 $_GET["admin_mode"] != "repository") {
166 return false;
167 }
168
169 // these objects may exist due to test cases that didnt clear
170 // data properly
171 if ($a_type == "" || $a_type == "xxx") {
172 return false;
173 }
174
175 $visible = $rbacsystem->checkAccess('visible', $a_ref_id);
176 if ($a_type == "rolf" && $a_ref_id != ROLE_FOLDER_ID) {
177 return false;
178 }
179
180 return $visible;
181 }
182
186 public function modifyChilds($a_parent_id, $a_objects)
187 {
190
191 if ($a_parent_id == SYSTEM_FOLDER_ID) {
192 $new_objects = array();
193 foreach ($a_objects as $object) {
194 $new_objects[$object["title"] . ":" . $object["child"]]
195 = $object;
196 }
197
198 // add entry for switching to repository admin
199 // note: please see showChilds methods which prevents infinite look
200 if ($rbacsystem->checkAccess('write', SYSTEM_FOLDER_ID)) {
201 $new_objects[$lng->txt("repository_admin") . ":" . ROOT_FOLDER_ID] =
202 array(
203 "tree" => 1,
204 "child" => ROOT_FOLDER_ID,
205 "ref_id" => ROOT_FOLDER_ID,
206 "depth" => 3,
207 "type" => "root",
208 "title" => $lng->txt("repository_admin"),
209 "description" => $lng->txt("repository_admin_desc"),
210 "desc" => $lng->txt("repository_admin_desc"),
211 );
212 }
213 ksort($new_objects);
214
215 return $new_objects;
216 }
217
218 return $a_objects;
219 }
220
221 public function showChilds($a_parent_id, $a_obj_id)
222 {
223
224 // prevent infinite loop due to (root folder tree) node
225 // that is inserted under system admin folder
226 if ($a_parent_id == ROOT_FOLDER_ID) {
227 if ($this->rootfolder_shown == true) {
228 return false;
229 }
230 $this->rootfolder_shown = true;
231 }
232
233 return true;
234 }
235
239 public function forceExpanded($a_obj_id)
240 {
241 if ($a_obj_id == SYSTEM_FOLDER_ID) {
242 return true;
243 } else {
244 return false;
245 }
246 }
247} // END class ilAdministrationExplorer
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
forceExpanded($a_obj_id)
force expansion of node
formatHeader(&$tpl, $a_obj_id, $a_option)
overwritten method from base class @access public
getImage($a_name, $a_type="", $a_obj_id="")
get image path
buildLinkTarget($a_node_id, $a_type)
build link target
modifyChilds($a_parent_id, $a_objects)
modify children of parent ()
__construct($a_target)
Constructor @access public.
isClickable($a_type, $a_ref_id)
check if links for certain object type are activated
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
get frame target (may be overwritten by derived classes)
Class ilExplorer class for explorer view in admin frame.
setSessionExpandVariable($a_var_name="expand")
set name of expand session variable
setTitle($a_val)
Set title.
static _getFrame($a_class, $a_type='')
Get content frame name.
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92