ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjectGUI.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 
14 {
16 
22  var $ilias;
23 
30 
36  var $tpl;
37 
43  var $tree;
44 
50  var $lng;
51 
57  var $data;
58 
64  var $object;
65  var $ref_id;
66  var $obj_id;
67  var $maxcount; // contains number of child objects
68  var $formaction; // special formation (array "cmd" => "formaction")
69  var $return_location; // special return location (array "cmd" => "location")
70  var $target_frame; // special target frame (array "cmd" => "location")
71 
73  var $actions;
75  var $omit_locator = false;
76 
84  function ilObjectGUI($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
85  {
86  global $ilias, $objDefinition, $tpl, $tree, $ilCtrl, $ilErr, $lng, $ilTabs;
87 
88  $this->tabs_gui =& $ilTabs;
89 
90  if (!isset($ilErr))
91  {
92  $ilErr = new ilErrorHandling();
93  $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK,array($ilErr,'errorHandler'));
94  }
95  else
96  {
97  $this->ilErr =& $ilErr;
98  }
99 
100  $this->ilias =& $ilias;
101  $this->objDefinition =& $objDefinition;
102  $this->tpl =& $tpl;
103  $this->html = "";
104  $this->ctrl =& $ilCtrl;
105 
106  $params = array("ref_id");
107 
108  if (!$a_call_by_reference)
109  {
110  $params = array("ref_id","obj_id");
111  }
112 
113  $this->ctrl->saveParameter($this, $params);
114 
115  $this->lng =& $lng;
116  $this->tree =& $tree;
117  $this->formaction = array();
118  $this->return_location = array();
119  $this->target_frame = array();
120  $this->actions = "";
121  $this->sub_objects = "";
122 
123  $this->data = $a_data;
124  $this->id = $a_id;
125  $this->call_by_reference = $a_call_by_reference;
126  $this->prepare_output = $a_prepare_output;
127  $this->creation_mode = false;
128 
129  $this->ref_id = ($this->call_by_reference) ? $this->id : $_GET["ref_id"];
130  $this->obj_id = ($this->call_by_reference) ? $_GET["obj_id"] : $this->id;
131 
132  if ($this->id != 0)
133  {
134  $this->link_params = "ref_id=".$this->ref_id;
135  }
136 
137  // get the object
138  $this->assignObject();
139 
140  // set context
141  if (is_object($this->object))
142  {
143  if ($this->call_by_reference && $this->ref_id = $_GET["ref_id"])
144  {
145  $this->ctrl->setContext($this->object->getId(),
146  $this->object->getType());
147  }
148  }
149 
150  // use global $lng instead, when creating new objects object is not available
151  //$this->lng =& $this->object->lng;
152 
153  //prepare output
154  if ($a_prepare_output)
155  {
156  $this->prepareOutput();
157  }
158  }
159 
160 
164  function &executeCommand()
165  {
166  global $rbacsystem;
167 
168  $next_class = $this->ctrl->getNextClass($this);
169  $cmd = $this->ctrl->getCmd();
170 
171  switch($next_class)
172  {
173  default:
174  $this->prepareOutput();
175  if(!$cmd)
176  {
177  $cmd = "view";
178  }
179  $cmd .= "Object";
180  $this->$cmd();
181 
182  break;
183  }
184 
185  return true;
186  }
187 
188 
192  public function withReferences()
193  {
194  return $this->call_by_reference;
195  }
196 
203  public function setCreationMode($a_mode = true)
204  {
205  $this->creation_mode = $a_mode;
206  }
207 
211  public function getCreationMode()
212  {
213  return $this->creation_mode;
214  }
215 
216  protected function assignObject()
217  {
218  // TODO: it seems that we always have to pass only the ref_id
219 //echo "<br>ilObjectGUIassign:".get_class($this).":".$this->id.":<br>";
220  if ($this->id != 0)
221  {
222  if ($this->call_by_reference)
223  {
224  $this->object = ilObjectFactory::getInstanceByRefId($this->id);
225  }
226  else
227  {
228  $this->object = ilObjectFactory::getInstanceByObjId($this->id);
229  }
230  }
231  }
232 
236  protected function prepareOutput()
237  {
238  global $ilLocator, $tpl, $ilUser;
239 
240  $this->tpl->getStandardTemplate();
241  // administration prepare output
242  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
243  {
244  $this->addAdminLocatorItems();
245  $tpl->setLocator();
246 
247 // ilUtil::sendInfo();
249 
250  $this->setTitleAndDescription();
251 
252  if ($this->getCreationMode() != true)
253  {
254  $this->setAdminTabs();
255  $this->showUpperIcon();
256  }
257 
258  return false;
259  }
260  // set locator
261  $this->setLocator();
262  // catch feedback message
263 // ilUtil::sendInfo();
265 
266  // in creation mode (parent) object and gui object
267  // do not fit
268  if ($this->getCreationMode() == true)
269  {
270  // get gui class of parent and call their title and description method
271  $obj_type = ilObject::_lookupType($_GET["ref_id"],true);
272  $class_name = $this->objDefinition->getClassName($obj_type);
273  $class = strtolower("ilObj".$class_name."GUI");
274  $class_path = $this->ctrl->lookupClassPath($class);
275  include_once($class_path);
276  $class_name = $this->ctrl->getClassForClasspath($class_path);
277 //echo "<br>instantiating parent for title and description";
278  $this->parent_gui_obj = new $class_name("", $_GET["ref_id"], true, false);
279  $this->parent_gui_obj->setTitleAndDescription();
280  }
281  else
282  {
283  // set title and description and title icon
284  $this->setTitleAndDescription();
285 
286  // set tabs
287  $this->setTabs();
288  $this->showUpperIcon();
289 
290  // BEGIN WebDAV: Display Mount Webfolder icon.
291  require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
292  if (ilDAVServer::_isActive() &&
293  $ilUser->getId() != ANONYMOUS_USER_ID)
294  {
295  $this->showMountWebfolderIcon();
296  }
297  // END WebDAV: Display Mount Webfolder icon.
298  }
299 
300  return true;
301  }
302 
303 
307  protected function setTitleAndDescription()
308  {
309  $this->tpl->setTitle($this->object->getPresentationTitle());
310  $this->tpl->setDescription($this->object->getLongDescription());
311  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
312  {
313  // alt text would be same as heading -> empty alt text
314  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_".$this->object->getType()."_b.gif"),
315  "");
316  }
317  else
318  {
319  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_".$this->object->getType()."_b.gif"),
320  $this->lng->txt("obj_" . $this->object->getType()));
321  }
322  }
323 
324  protected function showUpperIcon()
325  {
326  global $tree, $tpl, $objDefinition;
327 
328  if ($this->object->getRefId() == "")
329  {
330  return;
331  }
332 
333  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
334  {
335  if ($this->object->getRefId() != ROOT_FOLDER_ID &&
336  $this->object->getRefId() != SYSTEM_FOLDER_ID)
337  {
338  $par_id = $tree->getParentId($this->object->getRefId());
339  $obj_type = ilObject::_lookupType($par_id,true);
340  $class_name = $objDefinition->getClassName($obj_type);
341  $class = strtolower("ilObj".$class_name."GUI");
342  $this->ctrl->setParameterByClass($class, "ref_id", $par_id);
343  $tpl->setUpperIcon($this->ctrl->getLinkTargetByClass($class, "view"));
344  $this->ctrl->clearParametersByClass($class);
345  }
346  // link repository admin to admin settings
347  else if ($this->object->getRefId() == ROOT_FOLDER_ID)
348  {
349  $this->ctrl->setParameterByClass("iladministrationgui", "ref_id", "");
350  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
351  $tpl->setUpperIcon($this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
352  ilFrameTargetInfo::_getFrame("MainContent"));
353  $this->ctrl->clearParametersByClass("iladministrationgui");
354  }
355  }
356  else
357  {
358  if ($this->object->getRefId() != ROOT_FOLDER_ID &&
359  $this->object->getRefId() != SYSTEM_FOLDER_ID &&
360  $_GET["obj_id"] == "")
361  {
362  if (defined("ILIAS_MODULE"))
363  {
364  $prefix = "../";
365  }
366  $par_id = $tree->getParentId($this->object->getRefId());
367  $tpl->setUpperIcon($prefix."repository.php?cmd=frameset&ref_id=".$par_id,
368  ilFrameTargetInfo::_getFrame("MainContent"));
369  }
370  }
371  }
372  // BEGIN WebDAV: Show Mount Webfolder Icon.
373  final private function showMountWebfolderIcon()
374  {
375  global $tree, $tpl, $objDefinition;
376 
377  if ($this->object->getRefId() == "")
378  {
379  return;
380  }
381 
382  $tpl->setMountWebfolderIcon($this->object->getRefId());
383  }
384  // END WebDAV: Show Mount Webfolder Icon.
385 
386 
391  protected function setTabs()
392  {
393  $this->getTabs($this->tabs_gui);
394  }
395 
400  protected final function setAdminTabs()
401  {
402  $this->getAdminTabs($this->tabs_gui);
403  }
404 
408  function getAdminTabs(&$tabs_gui)
409  {
410  global $rbacsystem, $tree;
411 
412  if ($_GET["admin_mode"] == "repository")
413  {
414  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
415  $tabs_gui->setBackTarget($this->lng->txt("administration"),
416  $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
417  ilFrameTargetInfo::_getFrame("MainContent"));
418  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
419  }
420 
421  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
422  {
423  $tabs_gui->addTarget("view",
424  $this->ctrl->getLinkTarget($this, "view"), array("", "view"), get_class($this));
425  }
426 
427  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
428  {
429  $tabs_gui->addTarget("perm_settings",
430  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), "", "ilpermissiongui");
431  }
432 
433  if ($tree->getSavedNodeData($this->object->getRefId()))
434  {
435  $tabs_gui->addTarget("trash",
436  $this->ctrl->getLinkTarget($this, "trash"), "trash", get_class($this));
437  }
438  }
439 
440 
441  function getHTML()
442  {
443  return $this->html;
444  }
445 
446 
453  final private function setActions($a_actions = "")
454  {
455  if (is_array($a_actions))
456  {
457  foreach ($a_actions as $name => $lng)
458  {
459  $this->actions[$name] = array("name" => $name, "lng" => $lng);
460  }
461  }
462  else
463  {
464  $this->actions = "";
465  }
466  }
467 
474  final private function setSubObjects($a_sub_objects = "")
475  {
476  if (is_array($a_sub_objects))
477  {
478  foreach ($a_sub_objects as $name => $options)
479  {
480  $this->sub_objects[$name] = array("name" => $name, "max" => $options["max"]);
481  }
482  }
483  else
484  {
485  $this->sub_objects = "";
486  }
487  }
488 
497  protected function setLocator()
498  {
499  global $ilLocator, $tpl;
500 
501  if ($this->omit_locator)
502  {
503  return;
504  }
505 
506  // todo: admin workaround
507  // in the future, objectgui classes should not be called in
508  // admin section anymore (rbac/trash handling in own classes)
509  $ref_id = ($_GET["ref_id"] != "")
510  ? $_GET["ref_id"]
511  : $this->object->getRefId();
512  $ilLocator->addRepositoryItems($ref_id);
513 
514  if(!$this->creation_mode)
515  {
516  $this->addLocatorItems();
517  }
518 
519  // not so nice workaround: todo: handle $ilLocator as tabs in ilTemplate
520  if ($_GET["admin_mode"] == "" &&
521  strtolower($this->ctrl->getCmdClass()) == "ilobjrolegui")
522  {
523  $this->ctrl->setParameterByClass("ilobjrolegui",
524  "rolf_ref_id", $_GET["rolf_ref_id"]);
525  $this->ctrl->setParameterByClass("ilobjrolegui",
526  "obj_id", $_GET["obj_id"]);
527  $ilLocator->addItem($this->lng->txt("role"),
528  $this->ctrl->getLinkTargetByClass(array("ilpermissiongui",
529  "ilobjrolegui"), "perm"));
530  }
531 
532  $tpl->setLocator();
533  }
534 
539  protected function addLocatorItems()
540  {
541  }
542 
543  protected function omitLocator($a_omit = true)
544  {
545  $this->omit_locator = $a_omit;
546  }
547 
552  protected function addAdminLocatorItems()
553  {
554  global $ilLocator;
555 
556  if ($_GET["admin_mode"] == "settings") // system settings
557  {
558  $ilLocator->addItem($this->lng->txt("administration"),
559  $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
560  ilFrameTargetInfo::_getFrame("MainContent"));
561  if ($this->object->getRefId() != SYSTEM_FOLDER_ID)
562  {
563  $ilLocator->addItem($this->object->getTitle(),
564  $this->ctrl->getLinkTarget($this, "view"));
565  }
566  }
567  else // repository administration
568  {
569  $this->ctrl->setParameterByClass("iladministrationgui",
570  "ref_id", "");
571  $this->ctrl->setParameterByClass("iladministrationgui",
572  "admin_mode", "settings");
573  //$ilLocator->addItem($this->lng->txt("administration"),
574  // $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
575  // ilFrameTargetInfo::_getFrame("MainContent"));
576  $this->ctrl->clearParametersByClass("iladministrationgui");
577  $ilLocator->addAdministrationItems();
578  }
579 
580  }
581 
585  public function undeleteObject()
586  {
587  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
588  $ru = new ilRepUtilGUI($this);
589  $ru->restoreObjects($_GET["ref_id"], $_POST["trash_id"]);
590  $this->ctrl->redirect($this, "trash");
591  }
592 
597  public function confirmedDeleteObject()
598  {
599  global $ilSetting, $lng;
600 
601  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
602  $ru = new ilRepUtilGUI($this);
603  $ru->deleteObjects($_GET["ref_id"], $_SESSION["saved_post"]);
604  session_unregister("saved_post");
605  $this->ctrl->returnToParent($this);
606  }
607 
613  public function cancelDeleteObject()
614  {
615  session_unregister("saved_post");
616  $this->ctrl->returnToParent($this);
617  }
618 
624  public function removeFromSystemObject()
625  {
626  global $rbacsystem, $log, $ilAppEventHandler, $lng;
627 
628  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
629  $ru = new ilRepUtilGUI($this);
630  $ru->removeObjectsFromSystem($_POST["trash_id"]);
631  $this->ctrl->redirect($this, "trash");
632  }
633 
639  public function createObject()
640  {
641  global $rbacsystem;
642 
643  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
644 
645  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
646  {
647  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
648  }
649  else
650  {
651  // fill in saved values in case of error
652  $data = array();
653  $data["fields"] = array();
654  $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
655  $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
656 
657  $this->getTemplateFile("edit",$new_type);
658 
659  // show obj type image
660  $this->tpl->setCurrentBlock("img");
661  $this->tpl->setVariable("TYPE_IMG",
662  ilUtil::getImagePath("icon_".$new_type.".gif"));
663  $this->tpl->setVariable("ALT_IMG",
664  $this->lng->txt("obj_".$new_type));
665  $this->tpl->parseCurrentBlock();
666 
667  foreach ($data["fields"] as $key => $val)
668  {
669  $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
670  $this->tpl->setVariable(strtoupper($key), $val);
671 
672  if ($this->prepare_output)
673  {
674  $this->tpl->parseCurrentBlock();
675  }
676  }
677  $this->ctrl->setParameter($this, "new_type", $new_type);
678  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "save"));
679  $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
680  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
681  $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
682  $this->tpl->setVariable("CMD_SUBMIT", "save");
683  $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
684  $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
685  }
686  }
687 
688 
694  public function cancelObject($in_rep = false)
695  {
696  session_unregister("saved_post");
697 
698  $this->ctrl->returnToParent($this);
699  }
700 
706  public function saveObject()
707  {
708  global $rbacsystem, $objDefinition;
709 
710  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
711 
712  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
713  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
714  {
715  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
716  }
717 //echo ":".$_GET["new_type"].":".$_POST["new_type"].":";
718  $location = $objDefinition->getLocation($new_type);
719 
720  // create and insert object in objecttree
721  $class_name = "ilObj".$objDefinition->getClassName($new_type);
722  include_once($location."/class.".$class_name.".php");
723  $newObj = new $class_name();
724  $newObj->setType($new_type);
725  $newObj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
726  $newObj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
727  $newObj->create();
728  $newObj->createReference();
729  $newObj->putInTree($_GET["ref_id"]);
730  $newObj->setPermissions($_GET["ref_id"]);
731  //$newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
732 
733  return $newObj;
734  }
735 
741  public function editObject()
742  {
743  global $rbacsystem;
744 
745  if (!$rbacsystem->checkAccess("write", $this->ref_id))
746  {
747  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
748  }
749 
750  $fields = array();
751 
752  if ($_SESSION["error_post_vars"])
753  {
754  // fill in saved values in case of error
755  $fields["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
756  $fields["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
757  }
758  else
759  {
760  $fields["title"] = ilUtil::prepareFormOutput($this->object->getTitle());
761  $fields["desc"] = ilUtil::stripSlashes($this->object->getLongDescription());
762  }
763 
764  $this->displayEditForm($fields);
765  }
766 
773  protected function displayEditForm($fields)
774  {
775  $this->getTemplateFile("edit");
776 
777  foreach ($fields as $key => $val)
778  {
779  $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
780  $this->tpl->setVariable(strtoupper($key), $val);
781 // $this->tpl->parseCurrentBlock();
782  }
783 
784  //$obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
785  if (!$this->call_by_reference)
786  {
787  $this->ctrl->setParameter($this, "obj_id", $this->obj_id);
788  }
789 
790  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "update"));
791  $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType()."_edit"));
792  $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
793  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
794  $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
795  $this->tpl->setVariable("CMD_SUBMIT", "update");
796  $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
797 
798  }
799 
800 
806  public function updateObject()
807  {
808  $this->object->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
809  $this->object->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
810  $this->update = $this->object->update();
811 
812  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
813 
814  $this->afterUpdate();
815  }
816 
817  protected function afterUpdate()
818  {
819  $this->ctrl->redirect($this);
820  }
821 
822 
831  public function getFormAction($a_cmd, $a_formaction = "")
832  {
833  if ($this->formaction[$a_cmd] != "")
834  {
835  return $this->formaction[$a_cmd];
836  }
837  else
838  {
839  return $a_formaction;
840  }
841  }
842 
851  protected function setFormAction($a_cmd, $a_formaction)
852  {
853  $this->formaction[$a_cmd] = $a_formaction;
854  }
855 
863  protected function getReturnLocation($a_cmd, $a_location ="")
864  {
865  if ($this->return_location[$a_cmd] != "")
866  {
867  return $this->return_location[$a_cmd];
868  }
869  else
870  {
871  return $a_location;
872  }
873  }
874 
882  protected function setReturnLocation($a_cmd, $a_location)
883  {
884 //echo "-".$a_cmd."-".$a_location."-";
885  $this->return_location[$a_cmd] = $a_location;
886  }
887 
895  protected function getTargetFrame($a_cmd, $a_target_frame = "")
896  {
897  if ($this->target_frame[$a_cmd] != "")
898  {
899  return $this->target_frame[$a_cmd];
900  }
901  elseif (!empty($a_target_frame))
902  {
903  return "target=\"".$a_target_frame."\"";
904  }
905  else
906  {
907  return;
908  }
909  }
910 
918  protected function setTargetFrame($a_cmd, $a_target_frame)
919  {
920  $this->target_frame[$a_cmd] = "target=\"".$a_target_frame."\"";
921  }
922 
923  // BEGIN Security: Hide objects which aren't accessible by the user.
924  public function isVisible($a_ref_id,$a_type)
925  {
926  global $rbacsystem, $ilBench;
927 
928  $ilBench->start("Explorer", "setOutput_isVisible");
929  $visible = $rbacsystem->checkAccess('visible,read',$a_ref_id);
930 
931  if ($visible && $a_type == 'crs') {
932  global $tree;
933  if($crs_id = $tree->checkForParentType($a_ref_id,'crs'))
934  {
935  if(!$rbacsystem->checkAccess('write',$crs_id))
936  {
937  // Show only activated courses
938  $tmp_obj =& ilObjectFactory::getInstanceByRefId($crs_id,false);
939 
940  if(!$tmp_obj->isActivated())
941  {
942  unset($tmp_obj);
943  $visible = false;
944  }
945  if(($crs_id != $a_ref_id) and $tmp_obj->isArchived())
946  {
947  $visible = false;
948  }
949  // Show only activated course items
950  include_once "./course/classes/class.ilCourseItems.php";
951 
952  if(($crs_id != $a_ref_id) and (!ilCourseItems::_isActivated($a_ref_id)))
953  {
954  $visible = false;
955  }
956  }
957  }
958  }
959 
960  $ilBench->stop("Explorer", "setOutput_isVisible");
961 
962  return $visible;
963  }
964  // END Security: Hide objects which aren't accessible by the user.
965 
971  public function viewObject()
972  {
973  global $rbacsystem, $tpl;
974 
975  if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
976  {
977  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
978  }
979  // BEGIN ChangeEvent: record read event.
980  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
982  {
983  global $ilUser;
984  ilChangeEvent::_recordReadEvent($this->object->getId(), $ilUser->getId());
985  }
986  // END ChangeEvent: record read event.
987 
988  include_once("./Services/Repository/classes/class.ilAdminSubItemsTableGUI.php");
989  if (!$this->call_by_reference)
990  {
991  $this->ctrl->setParameter($this, "obj_id", $this->obj_id);
992  }
993  $itab = new ilAdminSubItemsTableGUI($this, "view", $_GET["ref_id"]);
994 
995  $tpl->setContent($itab->getHTML());
996  }
997 
1005  public function deleteObject($a_error = false)
1006  {
1007  global $tpl, $ilCtrl;
1008 
1009  if ($_GET["item_ref_id"] != "")
1010  {
1011  $_POST["id"] = array($_GET["item_ref_id"]);
1012  }
1013 
1014  // SAVE POST VALUES (get rid of this
1015  $_SESSION["saved_post"] = $_POST["id"];
1016 
1017  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
1018  $ru = new ilRepUtilGUI($this);
1019  if (!$ru->showDeleteConfirmation($_POST["id"], $a_error))
1020  {
1021  $ilCtrl->returnToParent($this);
1022  }
1023  }
1024 
1030  public function trashObject()
1031  {
1032  global $tpl;
1033 
1034  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
1035  $ru = new ilRepUtilGUI($this);
1036  $ru->showTrashTable($_GET["ref_id"]);
1037  }
1038 
1044  protected function showPossibleSubObjects()
1045  {
1046  if ($this->sub_objects == "")
1047  {
1048  $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
1049  }
1050  else
1051  {
1053  }
1054 
1055  $import = false;
1056 
1057  if (count($d) > 0)
1058  {
1059  foreach ($d as $row)
1060  {
1061  $count = 0;
1062 
1063  if ($row["max"] > 0)
1064  {
1065  //how many elements are present?
1066  for ($i=0; $i<count($this->data["ctrl"]); $i++)
1067  {
1068  if ($this->data["ctrl"][$i]["type"] == $row["name"])
1069  {
1070  $count++;
1071  }
1072  }
1073  }
1074 
1075  if ($row["max"] == "" || $count < $row["max"])
1076  {
1077  $subobj[] = $row["name"];
1078 /* deprecated
1079  if ($row["import"] == "1") // import allowed?
1080  {
1081  $import = true;
1082  }
1083 */
1084  }
1085  }
1086  }
1087 
1088  if (is_array($subobj))
1089  {
1090  // show import button if at least one
1091  // object type can be imported
1092 /* deprecated
1093  if ($import)
1094  {
1095  $this->tpl->setCurrentBlock("import_object");
1096  $this->tpl->setVariable("BTN_IMP", "import");
1097  $this->tpl->setVariable("TXT_IMP", $this->lng->txt("import"));
1098  $this->tpl->parseCurrentBlock();
1099  }
1100 */
1101 
1102  //build form
1103  $opts = ilUtil::formSelect(12,"new_type",$subobj);
1104  $this->tpl->setCurrentBlock("add_object");
1105  $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
1106  $this->tpl->setVariable("BTN_NAME", "create");
1107  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
1108  $this->tpl->parseCurrentBlock();
1109  }
1110  }
1111 
1120  public function getTemplateFile($a_cmd,$a_type = "")
1121  {
1122  if (!$a_type)
1123  {
1124  $a_type = $this->type;
1125  }
1126 
1127  $template = "tpl.".$a_type."_".$a_cmd.".html";
1128 
1129  if (!$this->tpl->fileExists($template) &&
1130  !file_exists("./templates/default/".$template))
1131  {
1132  $template = "tpl.obj_".$a_cmd.".html";
1133  }
1134 
1135  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", $template,$a_in_module);
1136 
1137  }
1138 
1147  protected function getTitlesByRefId($a_ref_ids)
1148  {
1149  foreach ($a_ref_ids as $id)
1150  {
1151  // GET OBJECT TITLE
1152  $tmp_obj =& $this->ilias->obj_factory->getInstanceByRefId($id);
1153  $title[] = $tmp_obj->getTitle();
1154  unset($tmp_obj);
1155  }
1156 
1157  return $title ? $title : array();
1158  }
1159 
1167  protected function getTabs(&$tabs_gui)
1168  {
1169  // please define your tabs here
1170 
1171  }
1172 
1173  // PROTECTED
1174  protected function __showButton($a_cmd,$a_text,$a_target = '')
1175  {
1176  global $ilToolbar;
1177 
1178  $ilToolbar->addButton($a_text, $this->ctrl->getLinkTarget($this, $a_cmd), $a_target);
1179  }
1180 
1181  protected function hitsperpageObject()
1182  {
1183  $_SESSION["tbl_limit"] = $_POST["hitsperpage"];
1184  $_GET["limit"] = $_POST["hitsperpage"];
1185  }
1186 
1187 
1188  protected function &__initTableGUI()
1189  {
1190  include_once "./Services/Table/classes/class.ilTableGUI.php";
1191 
1192  return new ilTableGUI(0,false);
1193  }
1194 
1200  protected function __setTableGUIBasicData(&$tbl,&$result_set,$a_from = "")
1201  {
1202  switch ($a_from)
1203  {
1204  case "clipboardObject":
1205  $offset = $_GET["offset"];
1206  $order = $_GET["sort_by"];
1207  $direction = $_GET["sort_order"];
1208  $tbl->disable("footer");
1209  break;
1210 
1211  default:
1212  $offset = $_GET["offset"];
1213  $order = $_GET["sort_by"];
1214  $direction = $_GET["sort_order"];
1215  break;
1216  }
1217 
1218  $tbl->setOrderColumn($order);
1219  $tbl->setOrderDirection($direction);
1220  $tbl->setOffset($offset);
1221  $tbl->setLimit($_GET["limit"]);
1222  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1223  $tbl->setData($result_set);
1224  }
1225 
1226  protected function __showClipboardTable($a_result_set,$a_from = "")
1227  {
1228  global $ilCtrl;
1229 
1230  $tbl =& $this->__initTableGUI();
1231  $tpl =& $tbl->getTemplateObject();
1232 
1233  $tpl->setCurrentBlock("tbl_form_header");
1234  $tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
1235  $tpl->parseCurrentBlock();
1236 
1237  $tpl->setCurrentBlock("tbl_action_btn");
1238  $tpl->setVariable("BTN_NAME","paste");
1239  $tpl->setVariable("BTN_VALUE",$this->lng->txt("insert_object_here"));
1240  $tpl->parseCurrentBlock();
1241 
1242  $tpl->setCurrentBlock("tbl_action_btn");
1243  $tpl->setVariable("BTN_NAME","clear");
1244  $tpl->setVariable("BTN_VALUE",$this->lng->txt("clear_clipboard"));
1245  $tpl->parseCurrentBlock();
1246 
1247  $tpl->setCurrentBlock("tbl_action_row");
1248  $tpl->setVariable("COLUMN_COUNTS",3);
1249  $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("spacer.gif"));
1250  $tpl->parseCurrentBlock();
1251 
1252  $tbl->setTitle($this->lng->txt("clipboard"),"icon_typ_b.gif",$this->lng->txt("clipboard"));
1253  $tbl->setHeaderNames(array($this->lng->txt('obj_type'),
1254  $this->lng->txt('title'),
1255  $this->lng->txt('action')));
1256  $tbl->setHeaderVars(array('type',
1257  'title',
1258  'act'),
1259  array('ref_id' => $this->object->getRefId(),
1260  'cmd' => 'clipboard',
1261  'cmdClass' => $_GET['cmdClass'],
1262  'cmdNode' => $_GET['cmdNode']));
1263 
1264  $tbl->setColumnWidth(array("","80%","19%"));
1265 
1266 
1267  $this->__setTableGUIBasicData($tbl,$a_result_set,$a_from);
1268  $tbl->render();
1269 
1270  $this->tpl->setVariable("RESULT_TABLE",$tbl->tpl->get());
1271 
1272  return true;
1273  }
1274 
1284  protected function redirectToRefId($a_ref_id, $a_cmd = "")
1285  {
1286  $obj_type = ilObject::_lookupType($a_ref_id,true);
1287  $class_name = $this->objDefinition->getClassName($obj_type);
1288  $class = strtolower("ilObj".$class_name."GUI");
1289  $this->ctrl->redirectByClass(array("ilrepositorygui", $class), $a_cmd);
1290  }
1291 
1292  // Object Cloning
1302  protected function fillCloneTemplate($a_tpl_varname,$a_type)
1303  {
1304 
1305  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
1306  $cp = new ilObjectCopyGUI($this);
1307  $cp->setType($a_type);
1308  $cp->setTarget($_GET['ref_id']);
1309  $cp->showSourceSearch($a_tpl_varname);
1310  return;
1311 
1312 
1313 
1314  global $objDefinition,$ilUser,$ilSetting;
1315 
1316  $max_entries = $ilSetting->get('search_max_hits',100);
1317 
1318  if(!count($existing_objs = ilUtil::_getObjectsByOperations($a_type,'copy',$ilUser->getId(),$max_entries)))
1319  {
1320  // No Objects with copy permission found
1321  return false;
1322  }
1323 
1324  if(count($existing_objs) >= $max_entries)
1325  {
1326  return $this->fillCloneSearchTemplate($a_tpl_varname,$a_type);
1327  }
1328  unset($_SESSION['wizard_search_title']);
1329  $ctpl = new ilTemplate('tpl.obj_duplicate.html', true, true);
1330  $this->ctrl->setParameter($this,'new_type',$a_type);
1331  /*$ctpl->setVariable('TYPE_IMG3',ilUtil::getImagePath('icon_'.$a_type.'.gif'));
1332  $ctpl->setVariable('ALT_IMG3',$this->lng->txt('obj_'.$a_type));*/
1333  if (!$objDefinition->isPlugin($a_type))
1334  {
1335  $ctpl->setVariable('TXT_DUPLICATE',$this->lng->txt('obj_'.$a_type.'_duplicate'));
1336  $ctpl->setVariable('WIZARD_TXT_SELECT',$this->lng->txt('obj_'.$a_type));
1337  }
1338  else
1339  {
1340  include_once("./Services/Component/classes/class.ilPlugin.php");
1341  $ctpl->setVariable('TXT_DUPLICATE',ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type."_duplicate"));
1342  $ctpl->setVariable('WIZARD_TXT_SELECT',ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type));
1343  }
1344  $ctpl->setVariable('WIZARD_OBJS', $this->buildCloneSelect($existing_objs));
1345 
1346  if($this->copyWizardHasOptions(self::COPY_WIZARD_NEEDS_PAGE))
1347  {
1348  $ctpl->setVariable('FORMACTION_CLONE',$this->ctrl->getFormAction($this,'cloneWizardPage'));
1349  $ctpl->setVariable('BTN_WIZARD',$this->lng->txt('btn_next'));
1350  $ctpl->setVariable('CMD_WIZARD','cloneWizardPage');
1351  }
1352  else
1353  {
1354  $ctpl->setVariable('FORMACTION_CLONE',$this->ctrl->getFormAction($this,'cloneAll'));
1355  if (!$objDefinition->isPlugin($a_type))
1356  {
1357  $ctpl->setVariable('BTN_WIZARD',$this->lng->txt('obj_'.$a_type.'_duplicate'));
1358  }
1359  else
1360  {
1361  include_once("./Services/Component/classes/class.ilPlugin.php");
1362  $ctpl->setVariable('BTN_WIZARD',ilPlugin::lookupTxt("rep_robj", $a_type, "obj_".$a_type."_duplicate"));
1363  }
1364  $ctpl->setVariable('CMD_WIZARD','cloneAll');
1365  }
1366 
1367  $ctpl->setVariable('WIZARD_TXT_CANCEL',$this->lng->txt('cancel'));
1368 
1369  if ($a_tpl_varname != "")
1370  {
1371  $this->tpl->setVariable(strtoupper($a_tpl_varname), $ctpl->get());
1372  }
1373  else
1374  {
1375  return $ctpl->get();
1376  }
1377  }
1378 
1387  protected function fillCloneSearchTemplate($a_tpl_varname,$a_type)
1388  {
1389  unset($_SESSION['wizard_search_title']);
1390 
1391  $this->tpl->addBlockFile(strtoupper($a_tpl_varname),strtolower($a_tpl_varname),'tpl.obj_duplicate_search.html');
1392  $this->ctrl->setParameter($this,'new_type',$a_type);
1393  $this->tpl->setVariable('FORMACTION_CLONE',$this->ctrl->getFormAction($this,'searchCloneSource'));
1394  $this->tpl->setVariable('TYPE_IMG3',ilUtil::getImagePath('icon_'.$a_type.'.gif'));
1395  $this->tpl->setVariable('ALT_IMG3',$this->lng->txt('obj_'.$a_type));
1396  $this->tpl->setVariable('TXT_DUPLICATE',$this->lng->txt('obj_'.$a_type.'_duplicate'));
1397 
1398  $this->tpl->setVariable('WIZARD_TXT_TITLE',$this->lng->txt('title'));
1399  $this->tpl->setVariable('WIZARD_TITLE',ilUtil::prepareFormOutput($_POST['wizard_search_title'],true));
1400  $this->tpl->setVariable('WIZARD_TITLE_INFO',$this->lng->txt('wizard_title_info'));
1401 
1402  $this->tpl->setVariable('BTN_WIZARD',$this->lng->txt('btn_next'));
1403  $this->tpl->setVariable('CMD_WIZARD','searchCloneSource');
1404  $this->tpl->setVariable('WIZARD_TXT_CANCEL',$this->lng->txt('cancel'));
1405  }
1406 
1412  protected function searchCloneSourceObject()
1413  {
1414  global $tree,$ilObjDataCache;
1415 
1416  $this->ctrl->setParameter($this,'new_type',$_REQUEST['new_type']);
1417 
1418  $_SESSION['wizard_search_title'] = ilUtil::stripSlashes($_POST['wizard_search_title']) ?
1419  ilUtil::stripSlashes($_POST['wizard_search_title']) :
1420  $_SESSION['wizard_search_title'];
1421 
1422  $this->lng->loadLanguageModule('search');
1423  include_once './Services/Search/classes/class.ilQueryParser.php';
1424  $query_parser =& new ilQueryParser(ilUtil::stripSlashes($_SESSION['wizard_search_title']));
1425  $query_parser->setMinWordLength(1,true);
1426  $query_parser->setCombination(QP_COMBINATION_AND);
1427  $query_parser->parse();
1428  if(!$query_parser->validate())
1429  {
1430  ilUtil::sendInfo($query_parser->getMessage());
1431  $this->createObject();
1432  return true;
1433  }
1434 
1435  // only like search since fulltext does not support search with less than 3 characters
1436  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
1437  $object_search =& new ilLikeObjectSearch($query_parser);
1438 
1439  $object_search->setFilter(array($_REQUEST['new_type']));
1440  $res = $object_search->performSearch();
1441  $res->setRequiredPermission('copy');
1442 
1443  // Add callback functions to receive only search_max_hits valid results
1444  $res->filter(ROOT_FOLDER_ID,true);
1445 
1446  if(!count($results = $res->getResultsByObjId()))
1447  {
1448  ilUtil::sendInfo($this->lng->txt('search_no_match'));
1449  $this->createObject();
1450  return true;
1451  }
1452 
1453  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.obj_duplicate_search_results.html');
1454 
1455  $num_rows = 0;
1456  foreach($results as $obj_id => $references)
1457  {
1458  foreach($references as $ref_id)
1459  {
1460  $this->tpl->setCurrentBlock('ref_row');
1461  $this->tpl->setVariable('RADIO_REF',ilUtil::formRadioButton(0,'clone_source',$ref_id));
1462  $this->tpl->setVariable('TXT_PATH',$this->lng->txt('path'));
1463 
1464  $path_arr = $tree->getPathFull($ref_id,ROOT_FOLDER_ID);
1465  $counter = 0;
1466  $path = '';
1467  foreach($path_arr as $data)
1468  {
1469  if($counter++)
1470  {
1471  $path .= " -> ";
1472  }
1473  $path .= $data['title'];
1474  }
1475  $this->tpl->setVariable('PATH',$path);
1476  $this->tpl->parseCurrentBlock();
1477  break;
1478  }
1479  if(strlen($desc = $ilObjDataCache->lookupDescription($obj_id)))
1480  {
1481  $this->tpl->setCurrentBlock('desc');
1482  $this->tpl->setVariable('DESCRIPTION',$desc);
1483  $this->tpl->parseCurrentBlock();
1484  }
1485  $this->tpl->setCurrentBlock('res_row');
1486  $this->tpl->setVariable('TBLROW',ilUtil::switchColor($num_rows++,'tblrow1','tblrow2'));
1487  $this->tpl->setVariable('TITLE',$ilObjDataCache->lookupTitle($obj_id));
1488  $this->tpl->setVariable('REFERENCES',$this->lng->txt('pathes'));
1489  $this->tpl->parseCurrentBlock();
1490  }
1491 
1492  $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this,'cancel'));
1493  $this->tpl->setVariable('TYPE_IMG',ilUtil::getImagePath('icon_'.$_REQUEST['new_type'].'.gif'));
1494  $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_'.$_REQUEST['new_type']));
1495  $this->tpl->setVariable('TXT_DUPLICATE',$this->lng->txt('obj_'.$_REQUEST['new_type'].'_duplicate'));
1496  $this->tpl->setVariable('INFO_DUPLICATE',$this->lng->txt('wizard_search_list'));
1497  if($this->copyWizardHasOptions(self::COPY_WIZARD_NEEDS_PAGE))
1498  {
1499  $this->tpl->setVariable('BTN_COPY',$this->lng->txt('btn_next'));
1500  $this->tpl->setVariable('CMD_COPY','cloneWizardPage');
1501  }
1502  else
1503  {
1504  $this->tpl->setVariable('BTN_COPY',$this->lng->txt('obj_'.$_REQUEST['new_type'].'_duplicate'));
1505  $this->tpl->setVariable('CMD_COPY','cloneAll');
1506  }
1507  $this->tpl->setVariable('BTN_BACK',$this->lng->txt('btn_back'));
1508  return true;
1509  }
1510 
1517  public function cloneAllObject()
1518  {
1519  include_once('classes/class.ilLink.php');
1520  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1521 
1522  global $ilAccess,$ilErr,$rbacsystem,$ilUser;
1523 
1524  $new_type = $_REQUEST['new_type'];
1525  if(!$rbacsystem->checkAccess('create',(int) $_GET['ref_id'],$new_type))
1526  {
1527  $ilErr->raiseError($this->lng->txt('permission_denied'));
1528  }
1529  if(!(int) $_REQUEST['clone_source'])
1530  {
1531  ilUtil::sendFailure($this->lng->txt('select_one'));
1532  $this->createObject();
1533  return false;
1534  }
1535  if(!$ilAccess->checkAccess('write','',(int) $_REQUEST['clone_source'],$new_type))
1536  {
1537  $ilErr->raiseError($this->lng->txt('permission_denied'));
1538  }
1539 
1540  // Save wizard options
1542  $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
1543  $wizard_options->saveOwner($ilUser->getId());
1544  $wizard_options->saveRoot((int) $_REQUEST['clone_source']);
1545 
1546  $options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
1547  foreach($options as $source_id => $option)
1548  {
1549  $wizard_options->addEntry($source_id,$option);
1550  }
1551  $wizard_options->read();
1552 
1553  $orig = ilObjectFactory::getInstanceByRefId((int) $_REQUEST['clone_source']);
1554  $new_obj = $orig->cloneObject((int) $_GET['ref_id'],$copy_id);
1555 
1556  // Delete wizard options
1557  $wizard_options->deleteAll();
1558 
1559  ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
1560  ilUtil::redirect(ilLink::_getLink($new_obj->getRefId()));
1561  }
1562 
1570  public function copyWizardHasOptions($a_mode)
1571  {
1572  return false;
1573  }
1574 
1581  protected function buildCloneSelect($existing_objs)
1582  {
1583  $options = ilObject::_prepareCloneSelection($existing_objs,$_REQUEST['new_type']);
1584  return ilUtil::formSelect((int) $_REQUEST['clone_source'],'clone_source',$options,false,true);
1585  }
1586 
1590  protected function getCenterColumnHTML()
1591  {
1592  global $ilCtrl, $ilAccess;
1593 
1594  include_once("Services/Block/classes/class.ilColumnGUI.php");
1595 
1596  $obj_id = ilObject::_lookupObjId($this->object->getRefId());
1597  $obj_type = ilObject::_lookupType($obj_id);
1598 
1599  if ($ilCtrl->getNextClass() != "ilcolumngui")
1600  {
1601  // normal command processing
1602  return $this->getContent();
1603  }
1604  else
1605  {
1606  if (!$ilCtrl->isAsynch())
1607  {
1608  //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
1610  {
1611  // right column wants center
1613  {
1614  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
1615  $this->setColumnSettings($column_gui);
1616  $this->html = $ilCtrl->forwardCommand($column_gui);
1617  }
1618  // left column wants center
1620  {
1621  $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
1622  $this->setColumnSettings($column_gui);
1623  $this->html = $ilCtrl->forwardCommand($column_gui);
1624  }
1625  }
1626  else
1627  {
1628  // normal command processing
1629  return $this->getContent();
1630  }
1631  }
1632  }
1633  }
1634 
1638  protected function getRightColumnHTML()
1639  {
1640  global $ilUser, $lng, $ilCtrl, $ilAccess;
1641 
1642  $obj_id = ilObject::_lookupObjId($this->object->getRefId());
1643  $obj_type = ilObject::_lookupType($obj_id);
1644 
1645  include_once("Services/Block/classes/class.ilColumnGUI.php");
1646  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
1647 
1648  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
1649  {
1650  return "";
1651  }
1652 
1653  $this->setColumnSettings($column_gui);
1654 
1655  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
1656  $column_gui->getCmdSide() == IL_COL_RIGHT &&
1657  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
1658  {
1659  $html = $ilCtrl->forwardCommand($column_gui);
1660  }
1661  else
1662  {
1663  if (!$ilCtrl->isAsynch())
1664  {
1665  $html = $ilCtrl->getHTML($column_gui);
1666  }
1667  }
1668 
1669  return $html;
1670  }
1671 
1675  protected function setColumnSettings($column_gui)
1676  {
1677  global $ilAccess;
1678 
1679  $column_gui->setRepositoryMode(true);
1680  $column_gui->setEnableEdit(false);
1681  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1682  {
1683  $column_gui->setEnableEdit(true);
1684  }
1685  }
1686 
1687  protected function checkPermission($a_perm, $a_cmd = "")
1688  {
1689  global $ilAccess, $lng, $PHP_SELF;
1690 
1691  if (!is_object($this->object))
1692  {
1693  return;
1694  }
1695 
1696  if (!$ilAccess->checkAccess($a_perm, $a_cmd, $this->object->getRefId()))
1697  {
1698  $_SESSION["il_rep_ref_id"] = "";
1699  ilUtil::sendFailure($lng->txt("permission_denied"), true);
1700 
1701  if (!is_int(strpos($PHP_SELF, "goto.php")))
1702  {
1703  ilUtil::redirect("goto.php?target=".$this->object->getType()."_".
1704  $this->object->getRefId());
1705  }
1706  else // we should never be here
1707  {
1708  die("Permission Denied.");
1709  }
1710  }
1711  }
1712 
1713 } // END class.ilObjectGUI (3.10: 2896 loc)
1714 ?>