ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilRepositoryGUI Class Reference

Class ilRepositoryGUI. More...

+ Collaboration diagram for ilRepositoryGUI:

Public Member Functions

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

Data Fields

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRepositoryGUI::__construct ( )

Constructor public.

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

References $_GET, $_POST, $_SESSION, $cur_ref_id, $ilCtrl, $ilias, $ilLog, $lng, $rbacsystem, $tpl, $tree, ilObject\_lookupType(), array, and ilUtil\isAPICall().

46  {
47  global $lng, $ilias, $tpl, $tree, $rbacsystem, $objDefinition, $ilCtrl, $ilLog;
48 
49  $this->lng = $lng;
50  $this->ilias = $ilias;
51  $this->tpl = $tpl;
52  $this->tree = $tree;
53  $this->rbacsystem = $rbacsystem;
54  $this->objDefinition = $objDefinition;
55 
56  $this->ctrl = $ilCtrl;
57 
58  $this->creation_mode = false;
59 
60  $this->ctrl->saveParameter($this, array("ref_id"));
61  if (!ilUtil::isAPICall())
62  $this->ctrl->setReturn($this,"");
63 
64  // determine current ref id and mode
65  if (!empty($_GET["ref_id"]) || $this->ctrl->getCmd() == "showTree")
66  {
67  $this->cur_ref_id = $_GET["ref_id"];
68  }
69  else
70  {
71 //echo "1-".$_SESSION["il_rep_ref_id"]."-";
72  if (!empty($_SESSION["il_rep_ref_id"]) && !empty($_GET["getlast"]))
73  {
74  $this->cur_ref_id = $_SESSION["il_rep_ref_id"];
75 //echo "2-".$this->cur_ref_id."-";
76  }
77  else
78  {
79  $this->cur_ref_id = $this->tree->getRootId();
80 
81  if ($_GET["cmd"] != "" && $_GET["cmd"] != "frameset")
82  {
83 //echo "hhh";
84  $get_str = $post_str = "";
85  foreach($_GET as $key => $value)
86  {
87  $get_str.= "-$key:$value";
88  }
89  foreach($_POST as $key => $value)
90  {
91  $post_str.= "-$key:$value";
92  }
93  $ilLog->write("Repository: command called without ref_id.".
94  "GET:".$get_str."-POST:".$post_str, $ilLog->WARNING);
95  }
96  // #10033
97  $_GET = array("baseClass"=>"ilRepositoryGUI");
98  $_POST = array();
99  $this->ctrl->setCmd("frameset");
100  }
101  }
102 //echo "<br>+".$_GET["ref_id"]."+";
103  if (!$tree->isInTree($this->cur_ref_id) && $this->ctrl->getCmd() != "showTree")
104  {
105  $this->cur_ref_id = $this->tree->getRootId();
106 
107  // check wether command has been called with
108  // item that is not in tree
109  if ($_GET["cmd"] != "" && $_GET["cmd"] != "frameset")
110  {
111  $get_str = $post_str = "";
112  foreach($_GET as $key => $value)
113  {
114  $get_str.= "-$key:$value";
115  }
116  foreach($_POST as $key => $value)
117  {
118  $post_str.= "-$key:$value";
119  }
120  $ilLog->write("Repository: command called with ref_id that is not in tree.".
121  "GET:".$get_str."-POST:".$post_str, $ilLog->WARNING);
122  }
123  $_GET = array();
124  $_POST = array();
125  $this->ctrl->setCmd("frameset");
126  }
127 
128  // set current repository view mode
129  if (!empty($_GET["set_mode"]))
130  {
131  $_SESSION["il_rep_mode"] = $_GET["set_mode"];
132  if ($this->ilias->account->getId() != ANONYMOUS_USER_ID)
133  {
134  $this->ilias->account->writePref("il_rep_mode", $_GET["set_mode"]);
135  }
136  }
137 
138  // get user setting
139  if ($_SESSION["il_rep_mode"] == "")
140  {
141  if ($this->ilias->account->getId() != ANONYMOUS_USER_ID)
142  {
143  $_SESSION["il_rep_mode"] = $this->ilias->account->getPref("il_rep_mode");
144  }
145  }
146 
147  // if nothing set, get default view
148  if ($_SESSION["il_rep_mode"] == "")
149  {
150  $_SESSION["il_rep_mode"] = $this->ilias->getSetting("default_repository_view");
151  }
152 
153  $this->mode = ($_SESSION["il_rep_mode"] != "")
154  ? $_SESSION["il_rep_mode"]
155  : "flat";
156 
157  // store current ref id
158  if ($this->ctrl->getCmd() != "showTree" &&
159  $rbacsystem->checkAccess("read", $this->cur_ref_id))
160  {
161  $type = ilObject::_lookupType($this->cur_ref_id, true);
162  if ($type == "cat" || $type == "grp" || $type == "crs"
163  || $type == "root")
164  {
165  $_SESSION["il_rep_ref_id"] = $this->cur_ref_id;
166  }
167  }
168 
169  $_GET["ref_id"] = $this->cur_ref_id;
170 
171  }
$_SESSION["AccountId"]
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
$_POST["username"]
static isAPICall()
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilRepositoryGUI::executeCommand ( )

execute command

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

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

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

◆ frameset()

ilRepositoryGUI::frameset ( )

output tree frameset

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

References $ilCtrl, and $lng.

Referenced by executeCommand().

360  {
361  global $lng, $ilCtrl, $ilAccess;
362 
363  $ilCtrl->redirectByClass("ilrepositorygui", "");
364  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ show()

ilRepositoryGUI::show ( )

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

References $ret.

Referenced by executeCommand().

348  {
349  // normal command processing
350  $ret = $this->ctrl->forwardCommand($this->gui_obj);
351  $this->tpl->setVariable("OBJECTS", $this->gui_obj->getHTML());
352 
353  $this->tpl->show();
354  }
$ret
Definition: parser.php:6
+ Here is the caller graph for this function:

◆ showTree()

ilRepositoryGUI::showTree ( )

display tree view

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

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

Referenced by executeCommand().

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

Field Documentation

◆ $cmd

ilRepositoryGUI::$cmd

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

Referenced by executeCommand().

◆ $ctrl

ilRepositoryGUI::$ctrl

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

◆ $cur_ref_id

ilRepositoryGUI::$cur_ref_id

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

Referenced by __construct().

◆ $ilias

ilRepositoryGUI::$ilias

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

Referenced by __construct(), and executeCommand().

◆ $lng

ilRepositoryGUI::$lng

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

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

◆ $mode

ilRepositoryGUI::$mode

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

◆ $rbacsystem

ilRepositoryGUI::$rbacsystem

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

Referenced by __construct(), and executeCommand().

◆ $tpl

ilRepositoryGUI::$tpl

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

Referenced by __construct().

◆ $tree

ilRepositoryGUI::$tree

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

Referenced by __construct(), and showTree().


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