ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilRepositoryGUI Class Reference

Class ilRepositoryGUI. More...

+ Collaboration diagram for ilRepositoryGUI:

Public Member Functions

 __construct ()
 Constructor @access public. More...
 
 executeCommand ()
 execute command More...
 
 show ()
 
 frameset ()
 output tree frameset More...
 
 showTree ()
 display tree view More...
 

Data Fields

 $lng
 
 $tpl
 
 $tree
 
 $rbacsystem
 
 $cur_ref_id
 
 $cmd
 
 $mode
 
 $ctrl
 

Protected Attributes

 $objDefinition
 
 $log
 
 $user
 
 $settings
 
 $help
 
 $error
 
 $access
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRepositoryGUI::__construct ( )

Constructor @access public.

Definition at line 79 of file class.ilRepositoryGUI.php.

80 {
81 global $DIC;
82
83 $this->log = $DIC["ilLog"];
84 $this->user = $DIC->user();
85 $this->settings = $DIC->settings();
86 $this->help = $DIC["ilHelp"];
87 $this->error = $DIC["ilErr"];
88 $this->access = $DIC->access();
89 $lng = $DIC->language();
90 $tpl = $DIC["tpl"];
91 $tree = $DIC->repositoryTree();
92 $rbacsystem = $DIC->rbac()->system();
93 $objDefinition = $DIC["objDefinition"];
94 $ilCtrl = $DIC->ctrl();
95 $ilLog = $DIC["ilLog"];
96 $ilUser = $DIC->user();
97 $ilSetting = $DIC->settings();
98
99 $this->lng = $lng;
100 $this->tpl = $tpl;
101 $this->tree = $tree;
102 $this->rbacsystem = $rbacsystem;
103 $this->objDefinition = $objDefinition;
104
105 $this->ctrl = $ilCtrl;
106
107 $this->creation_mode = false;
108
109 $this->ctrl->saveParameter($this, array("ref_id"));
110 if (!ilUtil::isAPICall()) {
111 $this->ctrl->setReturn($this, "");
112 }
113
114 // determine current ref id and mode
115 if (!empty($_GET["ref_id"]) || $this->ctrl->getCmd() == "showTree") {
116 $this->cur_ref_id = $_GET["ref_id"];
117 } else {
118 //echo "1-".$_SESSION["il_rep_ref_id"]."-";
119 if (!empty($_SESSION["il_rep_ref_id"]) && !empty($_GET["getlast"])) {
120 $this->cur_ref_id = $_SESSION["il_rep_ref_id"];
121 //echo "2-".$this->cur_ref_id."-";
122 } else {
123 $this->cur_ref_id = $this->tree->getRootId();
124
125 if ($_GET["cmd"] != "" && $_GET["cmd"] != "frameset") {
126 //echo "hhh";
127 $get_str = $post_str = "";
128 foreach ($_GET as $key => $value) {
129 $get_str.= "-$key:$value";
130 }
131 foreach ($_POST as $key => $value) {
132 $post_str.= "-$key:$value";
133 }
134 $ilLog->write("Repository: command called without ref_id." .
135 "GET:" . $get_str . "-POST:" . $post_str, $ilLog->WARNING);
136 }
137 // #10033
138 $_GET = array("baseClass"=>"ilRepositoryGUI");
139 $_POST = array();
140 $this->ctrl->setCmd("frameset");
141 }
142 }
143 //echo "<br>+".$_GET["ref_id"]."+";
144 if (!$tree->isInTree($this->cur_ref_id) && $this->ctrl->getCmd() != "showTree") {
145 $this->cur_ref_id = $this->tree->getRootId();
146
147 // check wether command has been called with
148 // item that is not in tree
149 if ($_GET["cmd"] != "" && $_GET["cmd"] != "frameset") {
150 $get_str = $post_str = "";
151 foreach ($_GET as $key => $value) {
152 $get_str.= "-$key:$value";
153 }
154 foreach ($_POST as $key => $value) {
155 $post_str.= "-$key:$value";
156 }
157 $ilLog->write("Repository: command called with ref_id that is not in tree." .
158 "GET:" . $get_str . "-POST:" . $post_str, $ilLog->WARNING);
159 }
160 $_GET = array();
161 $_POST = array();
162 $this->ctrl->setCmd("frameset");
163 }
164
165 // set current repository view mode
166 if (!empty($_GET["set_mode"])) {
167 $_SESSION["il_rep_mode"] = $_GET["set_mode"];
168 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
169 $ilUser->writePref("il_rep_mode", $_GET["set_mode"]);
170 }
171 }
172
173 // get user setting
174 if ($_SESSION["il_rep_mode"] == "") {
175 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
176 $_SESSION["il_rep_mode"] = $ilUser->getPref("il_rep_mode");
177 }
178 }
179
180 // if nothing set, get default view
181 if ($_SESSION["il_rep_mode"] == "") {
182 $_SESSION["il_rep_mode"] = $ilSetting->get("default_repository_view");
183 }
184
185 $this->mode = ($_SESSION["il_rep_mode"] != "")
186 ? $_SESSION["il_rep_mode"]
187 : "flat";
188
189 // store current ref id
190 if ($this->ctrl->getCmd() != "showTree" &&
191 $rbacsystem->checkAccess("read", $this->cur_ref_id)) {
192 $type = ilObject::_lookupType($this->cur_ref_id, true);
193 if ($type == "cat" || $type == "grp" || $type == "crs"
194 || $type == "root") {
195 $_SESSION["il_rep_ref_id"] = $this->cur_ref_id;
196 }
197 }
198
199 $_GET["ref_id"] = $this->cur_ref_id;
200 }
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
error($a_errmsg)
set error message @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
static isAPICall()
$key
Definition: croninfo.php:18
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17
$type
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18

References $_GET, $_POST, $_SESSION, $cur_ref_id, $DIC, $ilCtrl, $ilLog, $ilSetting, $ilUser, $key, $lng, $objDefinition, $rbacsystem, $tpl, $tree, $type, ilObject\_lookupType(), error(), ilUtil\isAPICall(), settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilRepositoryGUI::executeCommand ( )

execute command

Definition at line 206 of file class.ilRepositoryGUI.php.

207 {
211 $ilHelp = $this->help;
213
214 // check creation mode
215 // determined by "new_type" parameter
216 $new_type = ($_POST["new_type"] != "" && $ilCtrl->getCmd() == "create")
217 ? $_POST["new_type"]
218 : $_GET["new_type"];
219
220 if ($new_type != "" && $new_type != "sty") {
221 $this->creation_mode = true;
222 $ilHelp->setScreenIdComponent($new_type);
223 $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create");
224 }
225
226 // handle frameset command
227 $cmd = $this->ctrl->getCmd();
228 if (($cmd == "frameset" || $_GET["rep_frame"] == 1) && $_SESSION["il_rep_mode"] == "tree") {
229 $next_class = "";
230 $cmd = "frameset";
231 } elseif ($cmd == "frameset" && $_SESSION["il_rep_mode"] != "tree") {
232 $this->ctrl->setCmd("");
233 $cmd = "";
234 }
235
236 // determine next class
237 if ($cmd != "frameset") {
238 if ($this->creation_mode) {
239 $obj_type = $new_type;
240 $class_name = $this->objDefinition->getClassName($obj_type);
241 if (strtolower($class_name) != "user") {
242 $next_class = strtolower("ilObj" . $class_name . "GUI");
243 } else {
244 $next_class = $this->ctrl->getNextClass();
245 }
246 // Only set the fixed cmdClass if the next class is different to
247 // the GUI class of the new object.
248 // An example:
249 // Copy Category uses this call structure:
250 // RespositoryGUI -> CategoryGUI -> ilObjectCopyGUI
251 // Without this fix, the cmdClass ilObjectCopyGUI would never be reached
252
253 ilLoggerFactory::getLogger('obj')->debug($this->ctrl->getNextClass() . ' <-> ' . $class_name);
254
255 if ($this->ctrl->getNextClass() != strtolower('ilObj' . $class_name . 'GUI')) {
256 $this->ctrl->setCmdClass($next_class);
257 }
258 } elseif ((($next_class = $this->ctrl->getNextClass($this)) == "")
259 || ($next_class == "ilrepositorygui" && $this->ctrl->getCmd() == "return")) {
260 if ($cmd != "frameset" && $cmd != "showTree") {
261 // get GUI of current object
262 $obj_type = ilObject::_lookupType($this->cur_ref_id, true);
263 $class_name = $this->objDefinition->getClassName($obj_type);
264 $next_class = strtolower("ilObj" . $class_name . "GUI");
265
266 $this->ctrl->setCmdClass($next_class);
267 if ($this->ctrl->getCmd() == "return") {
268 $this->ctrl->setCmd("");
269 }
270 }
271 }
272 }
273
274 // commands that are always handled by repository gui
275 // to do: move to container
276 if ($cmd == "showTree") {
277 $next_class = "";
278 }
279
280 switch ($next_class) {
281 default:
282 // forward all other classes to gui commands
283 if ($next_class != "" && $next_class != "ilrepositorygui") {
284 $class_path = $this->ctrl->lookupClassPath($next_class);
285 // get gui class instance
286 require_once($class_path);
287 $class_name = $this->ctrl->getClassForClasspath($class_path);
288 if (!$this->creation_mode) {
289 if (is_subclass_of($class_name, "ilObject2GUI")) {
290 $this->gui_obj = new $class_name($this->cur_ref_id, ilObject2GUI::REPOSITORY_NODE_ID);
291 } else {
292 $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
293 }
294 } else {
295 if (is_subclass_of($class_name, "ilObject2GUI")) {
296 $this->gui_obj = new $class_name(null, ilObject2GUI::REPOSITORY_NODE_ID, $this->cur_ref_id);
297 } else {
298 $this->gui_obj = new $class_name("", 0, true, false);
299 }
300 }
301 //$this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
302
303
304 $tabs_out = ($new_type == "")
305 ? true
306 : false;
307 $this->gui_obj->setCreationMode($this->creation_mode);
308 $this->ctrl->setReturn($this, "return");
309
310 $this->show();
311 } else { //
312 // process repository frameset
313 if ($cmd == "frameset") {
314 if ($_SESSION["il_rep_mode"] == "tree") {
315 $this->frameset();
316 return;
317 }
318 $cmd = "";
319 $this->ctrl->setCmd("");
320 }
321
322 // process tree command
323 if ($cmd == "showTree") {
324 $this->showTree();
325 return;
326 }
327
328 $cmd = $this->ctrl->getCmd("");
329
330 // check read access for category
331 if ($this->cur_ref_id > 0 && !$rbacsystem->checkAccess("read", $this->cur_ref_id)) {
332 $_SESSION["il_rep_ref_id"] = "";
333 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
334 $this->tpl->show();
335 } else {
336 $this->cmd = $cmd;
337 $this->$cmd();
338 }
339 }
340 break;
341 }
342 }
const ID_PART_SCREEN
static getLogger($a_component_id)
Get component logger.
frameset()
output tree frameset
showTree()
display tree view
global $ilErr
Definition: raiseError.php:16

References $_GET, $_POST, $_SESSION, $cmd, $ctrl, $error, $help, $ilCtrl, $ilErr, $lng, $rbacsystem, ilObject\_lookupType(), frameset(), ilLoggerFactory\getLogger(), ilHelpGUI\ID_PART_SCREEN, ilObject2GUI\REPOSITORY_NODE_ID, show(), and showTree().

+ Here is the call graph for this function:

◆ frameset()

ilRepositoryGUI::frameset ( )

output tree frameset

Definition at line 357 of file class.ilRepositoryGUI.php.

358 {
361 $ilAccess = $this->access;
362
363 $ilCtrl->redirectByClass("ilrepositorygui", "");
364 }

References $access, $ctrl, $ilCtrl, and $lng.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ show()

ilRepositoryGUI::show ( )

Definition at line 345 of file class.ilRepositoryGUI.php.

346 {
347 // normal command processing
348 $ret = $this->ctrl->forwardCommand($this->gui_obj);
349 $this->tpl->setVariable("OBJECTS", $this->gui_obj->getHTML());
350
351 $this->tpl->show();
352 }
$ret
Definition: parser.php:6

References $ret.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ showTree()

ilRepositoryGUI::showTree ( )

display tree view

Definition at line 370 of file class.ilRepositoryGUI.php.

371 {
376
377 $ilCtrl->setParameter($this, "active_node", $_GET["active_node"]);
378
379 $this->tpl = new ilTemplate("tpl.main.html", true, true);
380 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
381
382 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
383
384 include_once("./Services/Repository/classes/class.ilRepositoryExplorer.php");
385
386 $active_node = ($_GET["active_node"] > 1)
387 ? $_GET["active_node"]
388 : ($_GET["ref_id"] > 1)
389 ? $_GET["ref_id"]
390 : 0;
391 $top_node = 0;
392 if ($ilSetting->get("rep_tree_limit_grp_crs") && $active_node > 0) {
393 $path = $tree->getPathId($active_node);
394 foreach ($path as $n) {
395 if ($top_node > 0) {
396 break;
397 }
398 if (in_array(
400 array("crs", "grp")
401 )) {
402 $top_node = $n;
403 }
404 }
405 }
406
407 $exp = new ilRepositoryExplorer("ilias.php?baseClass=ilRepositoryGUI&amp;cmd=goto", $top_node);
408 $exp->setUseStandardFrame(false);
409 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, "showTree"));
410 $exp->setFrameUpdater("tree", "updater");
411 $exp->setTargetGet("ref_id");
412
413 if ($_GET["repexpand"] == "") {
414 $expanded = $this->tree->readRootId();
415 } else {
416 $expanded = $_GET["repexpand"];
417 }
418
419 $exp->setExpand($expanded);
420
421 if ($active_node > 0) {
422 $path = $tree->getPathId($active_node);
423 if ($top_node > 0) {
424 $exp->setForceOpenPath($path);
425 $exp->setExpand($expanded);
426 } else {
427 $exp->setForceOpenPath($path + array($top_node));
428 }
429 $exp->highlightNode($active_node);
430 }
431
432 // build html-output
433 if ($top_node > 0) {
434 $head_tpl = new ilTemplate(
435 "tpl.cont_tree_head.html",
436 true,
437 true,
438 "Services/Repository"
439 );
440 $path = ilObject::_getIcon(ROOT_FOLDER_ID, "tiny", "root");
441 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
442 $title = $nd["title"];
443 if ($title == "ILIAS") {
444 $title = $lng->txt("repository");
445 }
446 $head_tpl->setVariable("IMG_SRC", $path);
447 $head_tpl->setVariable("ALT_IMG", $lng->txt("icon") . " " . $title);
448 $head_tpl->setVariable("LINK_TXT", $title);
449 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", "1");
450 $head_tpl->setVariable(
451 "LINK_HREF",
452 $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset")
453 );
454 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
455 $exp->setTreeLead($head_tpl->get());
456
457 $exp->initItemCounter(1);
458 $exp->setOutput(
459 $tree->getParentId($top_node),
460 1,
461 ilObject::_lookupObjId($tree->getParentId($top_node))
462 );
463 } else {
464 $exp->setOutput(0);
465 }
466 $output = $exp->getOutput(false);
467
468 //if ($GLOBALS["ilUser"]->getLogin() == "alex") echo "topnode:$top_node:activenode:$active_node:";
469
470
471 // asynchronous output
472 if ($ilCtrl->isAsynch()) {
473 echo $output;
474 exit;
475 }
476
477 $this->tpl->setCurrentBlock("content");
478 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("overview"));
479 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
480 $this->tpl->setVariable("EXPLORER", $output);
481 $ilCtrl->setParameter($this, "repexpand", $_GET["repexpand"]);
482 $this->tpl->setVariable("ACTION", $ilCtrl->getLinkTarget($this, "showTree", "", false, false));
483 $this->tpl->parseCurrentBlock();
484
485 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
486 iljQueryUtil::initjQuery($this->tpl);
487
488 $this->tpl->show(false);
489 exit;
490 }
$n
Definition: RandomTest.php:85
static _lookupObjId($a_id)
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$nd
Definition: error.php:10
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

References $_GET, $ctrl, $ilCtrl, $ilSetting, $lng, $n, $nd, $output, $path, $settings, $title, $tree, ilObject\_getIcon(), ilObject\_lookupObjId(), ilObject\_lookupType(), exit, ilUtil\getStyleSheetLocation(), and iljQueryUtil\initjQuery().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilRepositoryGUI::$access
protected

Definition at line 64 of file class.ilRepositoryGUI.php.

Referenced by frameset().

◆ $cmd

ilRepositoryGUI::$cmd

Definition at line 71 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $ctrl

ilRepositoryGUI::$ctrl

Definition at line 73 of file class.ilRepositoryGUI.php.

Referenced by executeCommand(), frameset(), and showTree().

◆ $cur_ref_id

ilRepositoryGUI::$cur_ref_id

Definition at line 70 of file class.ilRepositoryGUI.php.

Referenced by __construct().

◆ $error

ilRepositoryGUI::$error
protected

Definition at line 59 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $help

ilRepositoryGUI::$help
protected

Definition at line 54 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

◆ $lng

ilRepositoryGUI::$lng

Definition at line 66 of file class.ilRepositoryGUI.php.

Referenced by __construct(), executeCommand(), frameset(), and showTree().

◆ $log

ilRepositoryGUI::$log
protected

Definition at line 39 of file class.ilRepositoryGUI.php.

◆ $mode

ilRepositoryGUI::$mode

Definition at line 72 of file class.ilRepositoryGUI.php.

◆ $objDefinition

ilRepositoryGUI::$objDefinition
protected

Definition at line 34 of file class.ilRepositoryGUI.php.

Referenced by __construct().

◆ $rbacsystem

ilRepositoryGUI::$rbacsystem

Definition at line 69 of file class.ilRepositoryGUI.php.

Referenced by __construct(), and executeCommand().

◆ $settings

ilRepositoryGUI::$settings
protected

Definition at line 49 of file class.ilRepositoryGUI.php.

Referenced by showTree().

◆ $tpl

ilRepositoryGUI::$tpl

Definition at line 67 of file class.ilRepositoryGUI.php.

Referenced by __construct().

◆ $tree

ilRepositoryGUI::$tree

Definition at line 68 of file class.ilRepositoryGUI.php.

Referenced by __construct(), and showTree().

◆ $user

ilRepositoryGUI::$user
protected

Definition at line 44 of file class.ilRepositoryGUI.php.


The documentation for this class was generated from the following file: