ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObject2GUI.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 include_once("./Services/Object/classes/class.ilObjectGUI.php");
5 
27 abstract class ilObject2GUI extends ilObjectGUI
28 {
29  protected $object_id;
30  protected $node_id;
31  protected $creation_forms = array();
32  protected $id_type = array();
33  protected $parent_id;
34  public $tree;
35  protected $access_handler;
36 
37  const OBJECT_ID = 0;
38  const REPOSITORY_NODE_ID = 1;
39  const WORKSPACE_NODE_ID = 2;
43 
51  public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
52  {
53  global $DIC;
54 
55  $objDefinition = $DIC["objDefinition"];
56  $tpl = $DIC["tpl"];
57  $ilCtrl = $DIC["ilCtrl"];
58  $ilErr = $DIC["ilErr"];
59  $lng = $DIC["lng"];
60  $ilTabs = $DIC["ilTabs"];
61  $tree = $DIC["tree"];
62  $ilAccess = $DIC["ilAccess"];
63  $this->object_service = $DIC->object();
64 
65  if (!isset($ilErr)) {
66  $ilErr = new ilErrorHandling();
67  $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr,'errorHandler'));
68  } else {
69  $this->ilErr = $ilErr;
70  }
71 
72  $this->id_type = $a_id_type;
73  $this->parent_id = $a_parent_node_id;
74  $this->type = $this->getType();
75  $this->html = "";
76 
77  $this->tabs_gui = $ilTabs;
78  $this->objDefinition = $objDefinition;
79  $this->tpl = $tpl;
80  $this->ctrl = $ilCtrl;
81  $this->lng = $lng;
82 
83  // these are things that are initialised in ilObjectGUI constructor now
84  // and may miss here
85  $this->locator = $DIC["ilLocator"];
86  $this->user = $DIC->user();
87  $this->access = $DIC->access();
88  //$this->settings = $DIC->settings();
89  //$this->rbacreview = $DIC->rbac()->review();
90  $this->toolbar = $DIC->toolbar();
91 
92 
93  $params = array();
94  switch ($this->id_type) {
95  case self::REPOSITORY_NODE_ID:
96  $this->node_id = $a_id;
97  $this->object_id = ilObject::_lookupObjectId($this->node_id);
98  $this->tree = $tree;
99  $this->access_handler = $ilAccess;
100  $this->call_by_reference = true; // needed for prepareOutput()
101  $params[] = "ref_id";
102  break;
103 
104  case self::REPOSITORY_OBJECT_ID:
105  $this->object_id = $a_id;
106  $this->tree = $tree;
107  $this->access_handler = $ilAccess;
108  $params[] = "obj_id"; // ???
109  break;
110 
111  case self::WORKSPACE_NODE_ID:
112  $ilUser = $DIC["ilUser"];
113  $this->node_id = $a_id;
114  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
115  $this->tree = new ilWorkspaceTree($ilUser->getId());
116  $this->object_id = $this->tree->lookupObjectId($this->node_id);
117  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
118  $this->access_handler = new ilWorkspaceAccessHandler($this->tree);
119  $params[] = "wsp_id";
120  break;
121 
122  case self::WORKSPACE_OBJECT_ID:
123  $ilUser = $DIC["ilUser"];
124  $this->object_id = $a_id;
125  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
126  $this->tree = new ilWorkspaceTree($ilUser->getId());
127  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
128  $this->access_handler = new ilWorkspaceAccessHandler($this->tree);
129  $params[] = "obj_id"; // ???
130  break;
131 
132  case self::PORTFOLIO_OBJECT_ID:
133  $this->object_id = $a_id;
134  include_once('./Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php');
135  $this->access_handler = new ilPortfolioAccessHandler();
136  $params[] = "prt_id";
137  break;
138 
139  case self::OBJECT_ID:
140  $this->object_id = $a_id;
141  include_once "Services/Object/classes/class.ilDummyAccessHandler.php";
142  $this->access_handler = new ilDummyAccessHandler();
143  $params[] = "obj_id";
144  break;
145  }
146  $this->ctrl->saveParameter($this, $params);
147 
148 
149 
150  // old stuff for legacy code (obsolete?)
151  if (!$this->object_id) {
152  $this->creation_mode = true;
153  }
154  if ($this->node_id) {
155  // add parent node id if missing
156  if (!$this->parent_id && $this->tree) {
157  $this->parent_id = $this->tree->getParentId($this->node_id);
158  }
159  }
160  $this->ref_id = $this->node_id;
161  $this->obj_id = $this->object_id;
162 
163 
164 
165  $this->assignObject();
166 
167  // set context
168  if (is_object($this->object)) {
169  $this->ctrl->setContext($this->object->getId(), $this->object->getType());
170  }
171 
172  $this->afterConstructor();
173  }
174 
178  protected function afterConstructor()
179  {
180  }
181 
185  public function executeCommand()
186  {
187  $next_class = $this->ctrl->getNextClass($this);
188  $cmd = $this->ctrl->getCmd();
189 
190  $this->prepareOutput();
191 
192  switch ($next_class) {
193  case "ilworkspaceaccessgui":
194  if ($this->node_id) {
195  $this->tabs_gui->activateTab("id_permissions");
196 
197  include_once('./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
198  $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
199  $this->ctrl->forwardCommand($wspacc);
200  break;
201  }
202 
203  // no break
204  default:
205  if (!$cmd) {
206  $cmd = "render";
207  }
208  return $this->$cmd();
209  }
210 
211  return true;
212  }
213 
217  final protected function assignObject()
218  {
219  if ($this->object_id != 0) {
220  switch ($this->id_type) {
221  case self::OBJECT_ID:
222  case self::REPOSITORY_OBJECT_ID:
223  case self::WORKSPACE_OBJECT_ID:
224  case self::PORTFOLIO_OBJECT_ID:
225  $this->object = ilObjectFactory::getInstanceByObjId($this->object_id);
226  break;
227 
228  case self::REPOSITORY_NODE_ID:
229  $this->object = ilObjectFactory::getInstanceByRefId($this->node_id);
230  break;
231 
232  case self::WORKSPACE_NODE_ID:
233  // to be discussed
234  $this->object = ilObjectFactory::getInstanceByObjId($this->object_id);
235  break;
236  }
237  }
238  }
239 
245  protected function getAccessHandler()
246  {
247  return $this->access_handler;
248  }
249 
253  protected function setLocator()
254  {
255  global $DIC;
256 
257  $ilLocator = $DIC["ilLocator"];
258  $tpl = $DIC["tpl"];
259 
260  if ($this->omit_locator) {
261  return;
262  }
263 
264  switch ($this->id_type) {
265  case self::REPOSITORY_NODE_ID:
266  $ref_id = $this->node_id
267  ? $this->node_id
269  $ilLocator->addRepositoryItems($ref_id);
270 
271  // not so nice workaround: todo: handle $ilLocator as tabs in ilTemplate
272  if ($_GET["admin_mode"] == "" &&
273  strtolower($this->ctrl->getCmdClass()) == "ilobjrolegui") {
274  $this->ctrl->setParameterByClass(
275  "ilobjrolegui",
276  "rolf_ref_id",
277  $_GET["rolf_ref_id"]
278  );
279  $this->ctrl->setParameterByClass(
280  "ilobjrolegui",
281  "obj_id",
282  $_GET["obj_id"]
283  );
284  $ilLocator->addItem(
285  $this->lng->txt("role"),
286  $this->ctrl->getLinkTargetByClass(array("ilpermissiongui",
287  "ilobjrolegui"), "perm")
288  );
289  }
290 
291  // in workspace this is done in ilPersonalWorkspaceGUI
292  if ($this->object_id) {
293  $this->addLocatorItems();
294  }
295  $tpl->setLocator();
296 
297  break;
298 
299  case self::WORKSPACE_NODE_ID:
300  // :TODO:
301  break;
302  }
303  }
304 
308  public function delete()
309  {
310  switch ($this->id_type) {
311  case self::REPOSITORY_NODE_ID:
312  case self::REPOSITORY_OBJECT_ID:
313  return parent::deleteObject();
314 
315  case self::WORKSPACE_NODE_ID:
316  case self::WORKSPACE_OBJECT_ID:
317  return $this->deleteConfirmation();
318 
319  case self::OBJECT_ID:
320  case self::PORTFOLIO_OBJECT_ID:
321  // :TODO: should this ever occur?
322  break;
323  }
324  }
325 
331  protected function deleteConfirmation()
332  {
333  global $DIC;
334 
335  $tpl = $DIC["tpl"];
336  $lng = $DIC["lng"];
337 
338  $node_id = (int) $_REQUEST["item_ref_id"];
339  if (!$node_id) {
340  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
341  $this->ctrl->redirect($this, "");
342  }
343 
344  // on cancel or fail we return to parent node
345  $parent_node = $this->tree->getParentId($node_id);
346  $this->ctrl->setParameter($this, "wsp_id", $parent_node);
347 
348  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
349  $cgui = new ilConfirmationGUI();
350  $cgui->setHeaderText($lng->txt("info_delete_sure") . "<br/>" .
351  $lng->txt("info_delete_warning_no_trash"));
352 
353  $cgui->setFormAction($this->ctrl->getFormAction($this));
354  $cgui->setCancel($lng->txt("cancel"), "cancelDelete");
355  $cgui->setConfirm($lng->txt("confirm"), "confirmedDelete");
356 
357  $a_ids = array($node_id);
358  foreach ($a_ids as $node_id) {
359  $children = $this->tree->getSubTree($this->tree->getNodeData($node_id));
360  foreach ($children as $child) {
361  $node_id = $child["wsp_id"];
362  $obj_id = $this->tree->lookupObjectId($node_id);
364  $title = call_user_func(array(ilObjectFactory::getClassByType($type),'_lookupTitle'), $obj_id);
365 
366  // if anything fails, abort the whole process
367  if (!$this->checkPermissionBool("delete", "", "", $node_id)) {
368  ilUtil::sendFailure($lng->txt("msg_no_perm_delete") . " " . $title, true);
369  $this->ctrl->redirect($this);
370  }
371 
372  $cgui->addItem(
373  "id[]",
374  $node_id,
375  $title,
376  ilObject::_getIcon($obj_id, "small", $type),
377  $lng->txt("icon") . " " . $lng->txt("obj_" . $type)
378  );
379  }
380  }
381 
382  $tpl->setContent($cgui->getHTML());
383  }
384 
388  public function confirmedDelete()
389  {
390  switch ($this->id_type) {
391  case self::REPOSITORY_NODE_ID:
392  case self::REPOSITORY_OBJECT_ID:
393  return parent::confirmedDeleteObject();
394 
395  case self::WORKSPACE_NODE_ID:
396  case self::WORKSPACE_OBJECT_ID:
397  return $this->deleteConfirmedObjects();
398 
399  case self::OBJECT_ID:
400  case self::PORTFOLIO_OBJECT_ID:
401  // :TODO: should this ever occur?
402  break;
403  }
404  }
405 
411  protected function deleteConfirmedObjects()
412  {
413  global $DIC;
414 
415  $lng = $DIC["lng"];
416 
417 
418  if (sizeof($_POST["id"])) {
419  // #18797 - because of parent/child relations gather all nodes first
420  $del_nodes = array();
421  foreach ($_POST["id"] as $node_id) {
422  $del_nodes[$node_id] = $this->tree->getNodeData($node_id);
423  }
424 
425  foreach ($del_nodes as $node_id => $node) {
426  // tree/reference
427  $this->tree->deleteReference($node_id);
428  if ($this->tree->isInTree($node_id)) {
429  $this->tree->deleteTree($node);
430  }
431 
432  // permission
433  $this->getAccessHandler()->removePermission($node_id);
434 
435  // object
436  $object = ilObjectFactory::getInstanceByObjId($node["obj_id"], false);
437  if ($object) {
438  $object->delete();
439  }
440  }
441 
442  ilUtil::sendSuccess($lng->txt("msg_removed"), true);
443  } else {
444  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
445  }
446 
447  $this->ctrl->redirect($this, "");
448  }
449 
450  public function getHTML()
451  {
452  return parent::getHTML();
453  }
454 
458  final public function withReferences()
459  {
460  return parent::withReferences();
461  }
462  final public function setCreationMode($a_mode = true)
463  {
464  return parent::setCreationMode($a_mode);
465  }
466  final public function getCreationMode()
467  {
468  return parent::getCreationMode();
469  }
470  final public function prepareOutput($a_show_subobjects = true)
471  {
472  return parent::prepareOutput($a_show_subobjects);
473  }
474  protected function setTitleAndDescription()
475  {
476  return parent::setTitleAndDescription();
477  }
478  final protected function showUpperIcon()
479  {
480  return parent::showUpperIcon();
481  }
482  // final private function showMountWebfolderIcon() { return parent::showMountWebfolderIcon(); }
483  final protected function omitLocator($a_omit = true)
484  {
485  return parent::omitLocator($a_omit);
486  }
487  final protected function getTargetFrame($a_cmd, $a_target_frame = "")
488  {
489  return parent::getTargetFrame($a_cmd, $a_target_frame);
490  }
491  final protected function setTargetFrame($a_cmd, $a_target_frame)
492  {
493  return parent::setTargetFrame($a_cmd, $a_target_frame);
494  }
495  final public function isVisible($a_ref_id, $a_type)
496  {
497  return parent::isVisible($a_ref_id, $a_type);
498  }
499  final protected function getCenterColumnHTML()
500  {
501  return parent::getCenterColumnHTML();
502  }
503  final protected function getRightColumnHTML()
504  {
505  return parent::getRightColumnHTML();
506  }
507  final protected function setColumnSettings(ilColumnGUI $column_gui)
508  {
509  return parent::setColumnSettings($column_gui);
510  }
511  final protected function checkPermission($a_perm, $a_cmd = "", $a_type = "", $a_ref_id = null)
512  {
513  return parent::checkPermission($a_perm, $a_cmd, $a_type, $a_ref_id);
514  }
515 
516  // -> ilContainerGUI
517  final protected function showPossibleSubObjects()
518  {
519  return parent::showPossibleSubObjects();
520  }
521  // -> ilRepUtilGUI
522  final public function trash()
523  {
524  return parent::trashObject();
525  } // done
526  // -> ilRepUtil
527  final public function undelete()
528  {
529  return parent::undeleteObject();
530  } // done
531  final public function cancelDelete()
532  {
533  return parent::cancelDeleteObject();
534  } // ok
535  final public function removeFromSystem()
536  {
537  return parent::removeFromSystemObject();
538  } // done
539  final protected function redirectToRefId($a_ref_id, $a_cmd = "")
540  {
541  return parent::redirectToRefId();
542  } // ok
543 
544  // -> stefan
545  final protected function fillCloneTemplate($a_tpl_varname, $a_type)
546  {
547  return parent::fillCloneTemplate($a_tpl_varname, $a_type);
548  }
549  final protected function fillCloneSearchTemplate($a_tpl_varname, $a_type)
550  {
551  return parent::fillCloneSearchTemplate($a_tpl_varname, $a_type);
552  }
553  final protected function searchCloneSource()
554  {
555  return parent::searchCloneSourceObject();
556  }
557  final public function cloneAll()
558  {
559  return parent::cloneAllObject();
560  }
561  final protected function buildCloneSelect($existing_objs)
562  {
563  return parent::buildCloneSelect($existing_objs);
564  }
565 
566  // -> ilAdministration
567  final private function displayList()
568  {
569  return parent::displayList();
570  }
571  // final private function setAdminTabs() { return parent::setAdminTabs(); }
572  // final public function getAdminTabs() { return parent::getAdminTabs(); }
573  final protected function addAdminLocatorItems($a_do_not_add_object = false)
574  {
575  return parent::addAdminLocatorItems($a_do_not_add_object);
576  }
577 
581  public function view()
582  {
583  switch ($this->id_type) {
584  case self::REPOSITORY_NODE_ID:
585  case self::REPOSITORY_OBJECT_ID:
586  return parent::viewObject();
587 
588  case self::WORKSPACE_NODE_ID:
589  case self::WORKSPACE_OBJECT_ID:
590  return $this->render();
591 
592  case self::OBJECT_ID:
593  case self::PORTFOLIO_OBJECT_ID:
594  // :TODO: should this ever occur? do nothing or edit() ?!
595  break;
596  }
597  }
598 
604  protected function setTabs()
605  {
606  global $DIC;
607 
608  $ilTabs = $DIC["ilTabs"];
609  $lng = $DIC["lng"];
610 
611 
612  switch ($this->id_type) {
613  case self::REPOSITORY_NODE_ID:
614  case self::REPOSITORY_OBJECT_ID:
615  if ($this->checkPermissionBool("edit_permission")) {
616  $ilTabs->addTab(
617  "id_permissions",
618  $lng->txt("perm_settings"),
619  $this->ctrl->getLinkTargetByClass(array(get_class($this), "ilpermissiongui"), "perm")
620  );
621  }
622  break;
623 
624  case self::WORKSPACE_NODE_ID:
625  case self::WORKSPACE_OBJECT_ID:
626  // only files and blogs can be shared for now
627  if ($this->checkPermissionBool("edit_permission") && in_array($this->type, array("file", "blog")) && $this->node_id) {
628  $ilTabs->addTab(
629  "id_permissions",
630  $lng->txt("wsp_permissions"),
631  $this->ctrl->getLinkTargetByClass(array(get_class($this), "ilworkspaceaccessgui"), "share")
632  );
633  }
634  break;
635  }
636  }
637 
641  // final private function setSubObjects($a_sub_objects = "") { die("ilObject2GUI::setSubObjects() is deprecated."); }
642  // final public function getFormAction($a_cmd, $a_formaction = "") { die("ilObject2GUI::getFormAction() is deprecated."); }
643  // final protected function setFormAction($a_cmd, $a_formaction) { die("ilObject2GUI::setFormAction() is deprecated."); }
644  final protected function getReturnLocation($a_cmd, $a_location = "")
645  {
646  die("ilObject2GUI::getReturnLocation() is deprecated.");
647  }
648  final protected function setReturnLocation($a_cmd, $a_location)
649  {
650  die("ilObject2GUI::setReturnLocation() is deprecated.");
651  }
652  final protected function showActions()
653  {
654  die("ilObject2GUI::showActions() is deprecated.");
655  }
656  final protected function getTabs()
657  {
658  die("ilObject2GUI::getTabs() is deprecated.");
659  }
660  final protected function __showButton($a_cmd, $a_text, $a_target = '')
661  {
662  die("ilObject2GUI::__showButton() is deprecated.");
663  }
664  final protected function hitsperpageObject()
665  {
666  die("ilObject2GUI::hitsperpageObject() is deprecated.");
667  }
668  final protected function &__initTableGUI()
669  {
670  die("ilObject2GUI::__initTableGUI() is deprecated.");
671  }
672  final protected function __setTableGUIBasicData(&$tbl, &$result_set, $a_from = "")
673  {
674  die("ilObject2GUI::__setTableGUIBasicData() is deprecated.");
675  }
676 
680  protected function addLocatorItems()
681  {
682  }
683 
687  abstract public function getType();
688 
692  // final private function permObject() { parent::permObject(); }
693  // final private function permSaveObject() { parent::permSaveObject(); }
694  // final private function infoObject() { parent::infoObject(); }
695  // final private function __buildRoleFilterSelect() { parent::__buildRoleFilterSelect(); }
696  // final private function __filterRoles() { parent::__filterRoles(); }
697  // final private function ownerObject() { parent::ownerObject(); }
698  // final private function changeOwnerObject() { parent::changeOwnerObject(); }
699  // final private function addRoleObject() { parent::addRoleObject(); }
700  // final private function setActions($a_actions = "") { die("ilObject2GUI::setActions() is deprecated."); }
701  // final protected function getActions() { die("ilObject2GUI::getActions() is deprecated."); }
702 
706  public function create()
707  {
708  parent::createObject();
709  }
710  public function save()
711  {
712  parent::saveObject();
713  }
714  public function edit()
715  {
716  parent::editObject();
717  }
718  public function update()
719  {
720  parent::updateObject();
721  }
722  public function cancel()
723  {
724  parent::cancelObject();
725  }
726 
735  protected function initCreationForms($a_new_type)
736  {
737  $forms = parent::initCreationForms($a_new_type);
738 
739  // cloning doesn't work in workspace yet
740  if ($this->id_type == self::WORKSPACE_NODE_ID) {
741  unset($forms[self::CFORM_CLONE]);
742  }
743 
744  return $forms;
745  }
746 
752  public function importFile()
753  {
754  parent::importFileObject($this->parent_id);
755  }
756 
763  public function putObjectInTree(ilObject $a_obj, $a_parent_node_id = null)
764  {
765  global $DIC;
766 
767  $rbacreview = $DIC["rbacreview"];
768  $ilUser = $DIC["ilUser"];
769 
770 
771  $this->object_id = $a_obj->getId();
772 
773  if (!$a_parent_node_id) {
774  $a_parent_node_id = $this->parent_id;
775  }
776 
777  // add new object to custom parent container
778  if ((int) $_REQUEST["crtptrefid"]) {
779  $a_parent_node_id = (int) $_REQUEST["crtptrefid"];
780  }
781 
782  switch ($this->id_type) {
783  case self::REPOSITORY_NODE_ID:
784  case self::REPOSITORY_OBJECT_ID:
785  if (!$this->node_id) {
786  $a_obj->createReference();
787  $this->node_id = $a_obj->getRefId();
788  }
789  $a_obj->putInTree($a_parent_node_id);
790  $a_obj->setPermissions($a_parent_node_id);
791 
792  // rbac log
793  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
794  $rbac_log_roles = $rbacreview->getParentRoleIds($this->node_id, false);
795  $rbac_log = ilRbacLog::gatherFaPa($this->node_id, array_keys($rbac_log_roles), true);
796  ilRbacLog::add(ilRbacLog::CREATE_OBJECT, $this->node_id, $rbac_log);
797 
798  $this->ctrl->setParameter($this, "ref_id", $this->node_id);
799  break;
800 
801  case self::WORKSPACE_NODE_ID:
802  case self::WORKSPACE_OBJECT_ID:
803  if (!$this->node_id) {
804  $this->node_id = $this->tree->insertObject($a_parent_node_id, $this->object_id);
805  }
806  $this->getAccessHandler()->setPermissions($a_parent_node_id, $this->node_id);
807 
808  $this->ctrl->setParameter($this, "wsp_id", $this->node_id);
809  break;
810 
811  case self::OBJECT_ID:
812  case self::PORTFOLIO_OBJECT_ID:
813  // do nothing
814  break;
815  }
816 
817  // BEGIN ChangeEvent: Record save object.
818  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
819  ilChangeEvent::_recordWriteEvent($this->object_id, $ilUser->getId(), 'create');
820  // END ChangeEvent: Record save object.
821 
822  // use forced callback after object creation
823  self::handleAfterSaveCallback($a_obj, $_REQUEST["crtcb"]);
824  }
825 
832  public static function handleAfterSaveCallback(ilObject $a_obj, $a_callback_ref_id)
833  {
834  global $DIC;
835 
836  $objDefinition = $DIC["objDefinition"];
837 
838 
839  $a_callback_ref_id = (int) $a_callback_ref_id;
840  if ($a_callback_ref_id) {
841  $callback_type = ilObject::_lookupType($a_callback_ref_id, true);
842  $class_name = "ilObj" . $objDefinition->getClassName($callback_type) . "GUI";
843  $location = $objDefinition->getLocation($callback_type);
844  include_once($location . "/class." . $class_name . ".php");
845  if (in_array(strtolower($class_name), array("ilobjitemgroupgui"))) {
846  $callback_obj = new $class_name($a_callback_ref_id);
847  } else {
848  $callback_obj = new $class_name(null, $a_callback_ref_id, true, false);
849  }
850  $callback_obj->afterSaveCallback($a_obj);
851  }
852  }
853 
863  protected function checkPermissionBool($a_perm, $a_cmd = "", $a_type = "", $a_node_id = null)
864  {
865  global $DIC;
866 
867  $ilUser = $DIC["ilUser"];
868 
869 
870  if ($a_perm == "create") {
871  if (!$a_node_id) {
872  $a_node_id = $this->parent_id;
873  }
874  if ($a_node_id) {
875  return $this->getAccessHandler()->checkAccess($a_perm . "_" . $a_type, $a_cmd, $a_node_id);
876  }
877  } else {
878  if (!$a_node_id) {
879  $a_node_id = $this->node_id;
880  }
881  if ($a_node_id) {
882  return $this->getAccessHandler()->checkAccess($a_perm, $a_cmd, $a_node_id);
883  }
884  }
885 
886  // if we do not have a node id, check if current user is owner
887  if ($this->obj_id && $this->object->getOwner() == $ilUser->getId()) {
888  return true;
889  }
890  return false;
891  }
892 
900  protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
901  {
902  if ($this->id_type == self::WORKSPACE_NODE_ID) {
903  if (!$this->creation_mode && $this->object_id) {
904  include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
905  $dispatcher = new ilCommonActionDispatcherGUI(
907  $this->getAccessHandler(),
908  $this->getType(),
909  $this->node_id,
910  $this->object_id
911  );
912 
913  $dispatcher->setSubObject($a_sub_type, $a_sub_id);
914 
915  include_once "Services/Object/classes/class.ilObjectListGUI.php";
916  ilObjectListGUI::prepareJSLinks(
917  $this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true),
918  $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false),
919  $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false)
920  );
921 
922  $lg = $dispatcher->initHeaderAction();
923 
924  if (is_object($lg)) {
925  // to enable add to desktop / remove from desktop
926  if ($this instanceof ilDesktopItemHandling) {
927  $lg->setContainerObject($this);
928  }
929 
930  // for activation checks see ilObjectGUI
931  // $lg->enableComments(true);
932  $lg->enableNotes(true);
933  // $lg->enableTags(true);
934  }
935 
936  return $lg;
937  }
938  } else {
939  return parent::initHeaderAction();
940  }
941  }
942 
946  protected function redrawHeaderAction()
947  {
948  parent::redrawHeaderActionObject();
949  }
950 
951  protected function getPermanentLinkWidget($a_append = null, $a_center = false)
952  {
953  if ($this->id_type == self::WORKSPACE_NODE_ID) {
954  $a_append .= "_wsp";
955  }
956 
957  include_once('Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
958  $plink = new ilPermanentLinkGUI($this->getType(), $this->node_id, $a_append);
959  $plink->setIncludePermanentLinkText(false);
960  $plink->setAlignCenter($a_center);
961  return $plink->getHTML();
962  }
963 
964 
968  protected function handleAutoRating(ilObject $a_new_obj)
969  {
970  // only needed in repository
971  if ($this->id_type == self::REPOSITORY_NODE_ID) {
972  parent::handleAutoRating($a_new_obj);
973  }
974  }
975 }
static getClassByType($a_obj_type)
Get class by type.
setLocator()
set Locator
$lg
Definition: example_018.php:62
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
const PEAR_ERROR_CALLBACK
Definition: PEAR.php:35
executeCommand()
execute command
Class for permanent links.
view()
view object content (repository/workspace switch)
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
$type
global $DIC
Definition: saml.php:7
initCreationForms($a_new_type)
Init creation froms.
$_GET["client_id"]
$tbl
Definition: example_048.php:81
$location
Definition: buildRTE.php:44
getAccessHandler()
Get access handler.
fillCloneSearchTemplate($a_tpl_varname, $a_type)
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
getPermanentLinkWidget($a_append=null, $a_center=false)
confirmedDelete()
Delete objects (repository/workspace switch)
create()
Deleted in ilObject.
fillCloneTemplate($a_tpl_varname, $a_type)
Access handler for personal workspace.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.
__setTableGUIBasicData(&$tbl, &$result_set, $a_from="")
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
user()
Definition: user.php:4
Tree handler for personal workspace.
static _lookupObjectId($a_ref_id)
lookup object id
global $ilCtrl
Definition: ilias.php:18
isVisible($a_ref_id, $a_type)
getReturnLocation($a_cmd, $a_location="")
Deprecated functions.
setCreationMode($a_mode=true)
$a_type
Definition: workflow.php:92
createReference()
creates reference for object
setTargetFrame($a_cmd, $a_target_frame)
const CREATE_OBJECT
getId()
get object id public
__showButton($a_cmd, $a_text, $a_target='')
getType()
Functions that must be overwritten.
redirectToRefId($a_ref_id, $a_cmd="")
Column user interface class.
Class ilObjectGUI Basic methods of all Output classes.
handleAutoRating(ilObject $a_new_obj)
$ilUser
Definition: imgupload.php:18
static handleAfterSaveCallback(ilObject $a_obj, $a_callback_ref_id)
After creation callback.
getTargetFrame($a_cmd, $a_target_frame="")
withReferences()
Final/Private declaration of unchanged parent methods.
buildCloneSelect($existing_objs)
putInTree($a_parent_ref)
maybe this method should be in tree object!?
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
redrawHeaderAction()
Updating icons after ajax call.
ACL access handler GUI.
setTabs()
create tabs (repository/workspace switch)
setColumnSettings(ilColumnGUI $column_gui)
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
lookupObjectId($a_node_id)
Get object id for node id.
Access handler for portfolio.
html()
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
getRefId()
get reference id public
deleteConfirmedObjects()
Delete objects (workspace specific)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
prepareOutput($a_show_subobjects=true)
afterConstructor()
Do anything that should be done after constructor in here.
assignObject()
create object instance as internal property (repository/workspace switch)
addAdminLocatorItems($a_do_not_add_object=false)
deleteConfirmation()
Display delete confirmation form (workspace specific)
setReturnLocation($a_cmd, $a_location)
omitLocator($a_omit=true)
setPermissions($a_parent_ref)
set permissions of object
$_POST["username"]
Class ilCommonActionDispatcherGUI.
addLocatorItems()
Functions to be overwritten.
Confirmation screen class.