90 function ilObjectGUI($a_data, $a_id = 0, $a_call_by_reference =
true, $a_prepare_output =
true)
94 $this->tabs_gui =& $ilTabs;
112 $params = array(
"ref_id");
114 if (!$a_call_by_reference)
116 $params = array(
"ref_id",
"obj_id");
119 $this->ctrl->saveParameter($this, $params);
122 $this->tree =&
$tree;
123 $this->formaction = array();
124 $this->return_location = array();
125 $this->target_frame = array();
127 $this->sub_objects =
"";
129 $this->data = $a_data;
131 $this->call_by_reference = $a_call_by_reference;
132 $this->prepare_output = $a_prepare_output;
133 $this->creation_mode =
false;
135 $this->ref_id = ($this->call_by_reference) ? $this->
id :
$_GET[
"ref_id"];
136 $this->obj_id = ($this->call_by_reference) ?
$_GET[
"obj_id"] : $this->
id;
140 $this->link_params =
"ref_id=".$this->ref_id;
147 if (is_object($this->
object))
149 if ($this->call_by_reference && $this->ref_id ==
$_GET[
"ref_id"])
151 $this->ctrl->setContext($this->object->getId(),
152 $this->
object->getType());
160 if ($a_prepare_output)
172 $next_class = $this->ctrl->getNextClass($this);
173 $cmd = $this->ctrl->getCmd();
198 return $this->call_by_reference;
209 $this->creation_mode = $a_mode;
217 return $this->creation_mode;
226 if ($this->call_by_reference)
244 $this->tpl->getStandardTemplate();
246 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
274 if($this->call_by_reference)
278 $class_name = $this->objDefinition->getClassName($obj_type);
279 $class = strtolower(
"ilObj".$class_name.
"GUI");
280 $class_path = $this->ctrl->lookupClassPath($class);
281 include_once($class_path);
282 $class_name = $this->ctrl->getClassForClasspath($class_path);
284 $this->parent_gui_obj =
new $class_name(
"",
$_GET[
"ref_id"],
true,
false);
286 $this->parent_gui_obj->setCreationMode(
true);
287 $this->parent_gui_obj->setTitleAndDescription();
299 require_once
'Services/WebDAV/classes/class.ilDAVServer.php';
301 $ilUser->getId() != ANONYMOUS_USER_ID)
308 require_once
'./Services/FileUpload/classes/class.ilFileUploadUtil.php';
323 if (!is_object($this->
object))
333 $this->tpl->setTitle($this->object->getPresentationTitle());
334 $this->tpl->setDescription($this->object->getLongDescription());
336 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
344 $this->lng->txt(
"obj_" . $this->object->getType()));
347 include_once
'./Services/Object/classes/class.ilObjectListGUIFactory.php';
349 $lgui->initItem($this->object->getRefId(), $this->
object->getId());
350 $this->tpl->setAlertProperties($lgui->getAlertProperties());
364 if(!$this->creation_mode && $this->
object)
366 include_once
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
368 $ilAccess, $this->object->getType(),
$this->ref_id, $this->
object->getId());
372 include_once
"Services/Object/classes/class.ilObjectListGUI.php";
373 ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this,
"redrawHeaderAction",
"",
true),
374 $this->ctrl->getLinkTargetByClass(array(
"ilcommonactiondispatchergui",
"ilnotegui"),
"",
"",
true,
false),
375 $this->ctrl->getLinkTargetByClass(array(
"ilcommonactiondispatchergui",
"iltagginggui"),
"",
"",
true,
false));
377 $lg = $dispatcher->initHeaderAction();
384 $lg->setContainerObject($this);
388 $lg->enableMultiDownload(
true);
392 include_once
"Services/Notes/classes/class.ilNote.php";
393 if($ilAccess->checkAccess(
"write",
"", $this->ref_id) ||
394 $ilAccess->checkAccess(
"edit_permissions",
"", $this->ref_id) ||
397 $lg->enableComments(
true);
400 $lg->enableNotes(
true);
401 $lg->enableTags(
true);
415 if(is_object($a_list_gui))
417 $this->tpl->setHeaderActionMenu($a_list_gui->getHeaderAction());
437 echo $lg->getHeaderAction();
440 echo $tpl->getOnLoadCodeForAsynch();
450 if ($this->object->getRefId() ==
"")
455 $tpl->setMountWebfolderIcon($this->object->getRefId());
466 $this->
getTabs($this->tabs_gui);
496 $tabs_gui->addTarget(
"view",
497 $this->ctrl->getLinkTarget($this,
"view"), array(
"",
"view"), get_class($this));
503 $tabs_gui->addTarget(
"perm_settings",
504 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
"",
"ilpermissiongui");
507 if ($tree->getSavedNodeData($this->object->getRefId()))
509 $tabs_gui->addTarget(
"trash",
510 $this->ctrl->getLinkTarget($this,
"trash"),
"trash", get_class($this));
529 if (is_array($a_actions))
531 foreach ($a_actions as $name =>
$lng)
533 $this->actions[$name] = array(
"name" => $name,
"lng" =>
$lng);
550 if (is_array($a_sub_objects))
552 foreach ($a_sub_objects as $name =>
$options)
554 $this->sub_objects[$name] = array(
"name" => $name,
"max" =>
$options[
"max"]);
559 $this->sub_objects =
"";
573 global $ilLocator,
$tpl;
575 if ($this->omit_locator)
581 if($this->call_by_reference)
588 : $this->object->getRefId();
589 $ilLocator->addRepositoryItems(
$ref_id);
592 if(!$this->creation_mode)
598 if (
$_GET[
"admin_mode"] ==
"" &&
599 strtolower($this->ctrl->getCmdClass()) ==
"ilobjrolegui")
601 $this->ctrl->setParameterByClass(
"ilobjrolegui",
602 "rolf_ref_id",
$_GET[
"rolf_ref_id"]);
603 $this->ctrl->setParameterByClass(
"ilobjrolegui",
604 "obj_id",
$_GET[
"obj_id"]);
605 $ilLocator->addItem($this->lng->txt(
"role"),
606 $this->ctrl->getLinkTargetByClass(array(
"ilpermissiongui",
607 "ilobjrolegui"),
"perm"));
623 $this->omit_locator = $a_omit;
636 if (
$_GET[
"admin_mode"] ==
"settings")
638 $this->ctrl->setParameterByClass(
"ilobjsystemfoldergui",
639 "ref_id", SYSTEM_FOLDER_ID);
640 $ilLocator->addItem($this->lng->txt(
"administration"),
641 $this->ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjsystemfoldergui"),
"")
643 if ($this->object->getRefId() != SYSTEM_FOLDER_ID && !$a_do_not_add_object)
645 $ilLocator->addItem($this->object->getTitle(),
646 $this->ctrl->getLinkTarget($this,
"view"));
651 $this->ctrl->setParameterByClass(
"iladministrationgui",
653 $this->ctrl->setParameterByClass(
"iladministrationgui",
654 "admin_mode",
"settings");
658 $this->ctrl->clearParametersByClass(
"iladministrationgui");
659 $ilLocator->addAdministrationItems();
672 if(isset(
$_POST[
"mref_id"]))
677 include_once(
"./Services/Repository/classes/class.ilRepUtilGUI.php");
681 $this->ctrl->returnToParent($this);
692 $this->ctrl->returnToParent($this);
704 $this->ctrl->returnToParent($this);
720 $this->ctrl->saveParameter($this,
"crtptrefid");
722 $this->ctrl->saveParameter($this,
"crtcb");
726 $ilErr->raiseError($this->lng->txt(
"permission_denied"),$ilErr->MESSAGE);
730 $this->lng->loadLanguageModule($new_type);
731 $this->ctrl->setParameter($this,
"new_type", $new_type);
736 if(
$_GET[
"cpfl"] && isset($forms[self::CFORM_CLONE]))
738 $forms = array(self::CFORM_CLONE => $forms[self::CFORM_CLONE]);
773 foreach($a_forms as $id => $form)
777 unset($a_forms[$id]);
782 if(
sizeof($a_forms) == 1)
784 $form_type = key($a_forms);
785 $a_forms = array_shift($a_forms);
788 if(method_exists($this,
"getCreationFormTitle"))
790 $form_title = $this->getCreationFormTitle($form_type);
791 if ($form_title !=
"")
793 $a_forms->setTitle($form_title);
796 return $a_forms->getHTML();
800 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
805 foreach ($a_forms as $form_type => $cf)
807 $htpl =
new ilTemplate(
"tpl.creation_acc_head.html",
true,
true,
"Services/Object");
811 if(method_exists($this,
"getCreationFormTitle"))
813 $form_title = $this->getCreationFormTitle($form_type);
817 $form_title = $cf->getTitle();
821 $htpl->setVariable(
"TITLE", $this->lng->txt(
"option").
" ".$cnt.
": ".
824 $cf->setTitleIcon(null);
825 $cf->setTableWidth(
"100%");
827 $acc->addItem($htpl->get(), $cf->getHTML());
832 return "<div class='ilCreationFormSection'>".$acc->getHTML().
"</div>";
844 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
846 $form->setTarget(
"_top");
847 $form->setFormAction($this->ctrl->getFormAction($this,
"save"));
848 $form->setTitle($this->lng->txt($a_new_type.
"_new"));
854 $ti->setRequired(
true);
865 $form->addCommandButton(
"save", $this->lng->txt($a_new_type.
"_add"));
866 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
880 $lng->loadLanguageModule(
'didactic');
883 $options[
'dtpl_0'] = array($this->lng->txt(
'didactic_default_type'),
885 $this->lng->txt(
'didactic_default_type_info'),
886 $this->lng->txt(
'objs_'.$this->type)
889 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateSettings.php';
893 foreach($templates as $template)
895 $options[
"dtpl_".$template->getId()] = array($template->getTitle(),
896 $template->getDescription());
905 $this->lng->txt(
'type'),
911 include_once
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
918 $type->setValue(
'dtpl_0');
926 $type->addOption($option);
950 $ilCtrl->redirectByClass(
"ilrepositorygui",
"frameset");
967 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->MESSAGE);
970 $this->lng->loadLanguageModule($new_type);
971 $this->ctrl->setParameter($this,
"new_type", $new_type);
974 if ($form->checkInput())
976 $this->ctrl->setParameter($this,
"new_type",
"");
979 $class_name =
"ilObj".$objDefinition->getClassName($new_type);
980 $location = $objDefinition->getLocation($new_type);
981 include_once(
$location.
"/class.".$class_name.
".php");
982 $newObj =
new $class_name();
983 $newObj->setType($new_type);
984 $newObj->setTitle($form->getInput(
"title"));
985 $newObj->setDescription($form->getInput(
"desc"));
994 $newObj->applyDidacticTemplate($dtpl);
1001 $args = func_get_args();
1014 $form->setValuesByPost();
1015 $tpl->setContent($form->getHtml());
1027 if(
$tpl && substr(
$tpl, 0, strlen($a_type)+1) == $a_type.
"_")
1029 return (
int)substr(
$tpl, strlen($a_type)+1);
1043 if(!$a_parent_node_id)
1045 $a_parent_node_id =
$_GET[
"ref_id"];
1051 $a_parent_node_id = (int)$_REQUEST[
"crtptrefid"];
1058 $this->obj_id = $a_obj->
getId();
1059 $this->ref_id = $a_obj->
getRefId();
1062 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
1067 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1068 $rbac_log_roles = $rbacreview->getParentRoleIds($this->ref_id,
false);
1073 if($_REQUEST[
"crtcb"])
1076 $class_name =
"ilObj".$objDefinition->getClassName($callback_type).
"GUI";
1077 $location = $objDefinition->getLocation($callback_type);
1078 include_once(
$location.
"/class.".$class_name.
".php");
1079 if (in_array(strtolower($class_name), array(
"ilobjitemgroupgui")))
1081 $callback_obj =
new $class_name((
int)$_REQUEST[
"crtcb"]);
1086 $callback_obj =
new $class_name(null, (
int)$_REQUEST[
"crtcb"],
true,
false);
1088 $callback_obj->afterSaveCallback($a_obj);
1100 $this->ctrl->returnToParent($this);
1110 global
$tpl, $ilTabs;
1114 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
1117 $ilTabs->activateTab(
"settings");
1123 $form->setValuesByArray($values);
1125 $tpl->setContent($form->getHTML());
1137 $lng->loadLanguageModule($this->object->getType());
1139 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1141 $form->setFormAction($this->ctrl->getFormAction($this,
"update"));
1142 $form->setTitle($this->lng->txt($this->object->getType().
"_edit"));
1148 $ti->setRequired(
true);
1149 $form->addItem($ti);
1155 $form->addItem($ta);
1159 $form->addCommandButton(
"update", $this->lng->txt(
"save"));
1182 $values[
"title"] = $this->
object->getTitle();
1183 $values[
"desc"] = $this->
object->getLongDescription();
1203 global $ilTabs,
$tpl;
1207 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
1211 if($form->checkInput() &&
1214 $this->
object->setTitle($form->getInput(
"title"));
1215 $this->
object->setDescription($form->getInput(
"desc"));
1217 $this->
object->update();
1224 $ilTabs->activateTab(
"settings");
1225 $form->setValuesByPost();
1226 $tpl->setContent($form->getHtml());
1256 $this->ctrl->redirect($this,
"edit");
1267 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1269 $form->setTarget(
"_top");
1270 $form->setFormAction($this->ctrl->getFormAction($this,
"importFile"));
1271 $form->setTitle($this->lng->txt($a_new_type.
"_import"));
1273 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
1274 $fi =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
1276 $fi->setRequired(
true);
1277 $form->addItem($fi);
1279 $form->addCommandButton(
"importFile", $this->lng->txt(
"import"));
1280 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
1294 $parent_id =
$_GET[
"ref_id"];
1301 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
1304 $this->lng->loadLanguageModule($new_type);
1305 $this->ctrl->setParameter($this,
"new_type", $new_type);
1308 if ($form->checkInput())
1312 if($objDefinition->isContainer($new_type))
1314 include_once
'./Services/Export/classes/class.ilImportContainer.php';
1319 include_once(
"./Services/Export/classes/class.ilImport.php");
1320 $imp =
new ilImport((
int)$parent_id);
1323 $new_id = $imp->importObject(null, $_FILES[
"importfile"][
"tmp_name"],
1324 $_FILES[
"importfile"][
"name"], $new_type);
1328 $this->ctrl->setParameter($this,
"new_type",
"");
1333 if(!$objDefinition->isContainer($new_type))
1343 if($objDefinition->isContainer($new_type))
1356 $form->setValuesByPost();
1357 $tpl->setContent($form->getHtml());
1368 $this->ctrl->returnToParent($this);
1381 if ($this->formaction[$a_cmd] !=
"")
1383 return $this->formaction[$a_cmd];
1387 return $a_formaction;
1401 $this->formaction[$a_cmd] = $a_formaction;
1413 if ($this->return_location[$a_cmd] !=
"")
1415 return $this->return_location[$a_cmd];
1433 $this->return_location[$a_cmd] = $a_location;
1445 if ($this->target_frame[$a_cmd] !=
"")
1447 return $this->target_frame[$a_cmd];
1449 elseif (!empty($a_target_frame))
1451 return "target=\"".$a_target_frame.
"\"";
1468 $this->target_frame[$a_cmd] =
"target=\"".$a_target_frame.
"\"";
1476 $ilBench->start(
"Explorer",
"setOutput_isVisible");
1479 if ($visible && $a_type ==
'crs') {
1481 if($crs_id = $tree->checkForParentType($a_ref_id,
'crs'))
1488 if(!$tmp_obj->isActivated())
1493 if(($crs_id != $a_ref_id) and $tmp_obj->isArchived())
1501 $ilBench->stop(
"Explorer",
"setOutput_isVisible");
1518 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
1522 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
1525 $this->object->getType(),
1526 $this->
object->getRefId(),
1527 $this->
object->getId(), $ilUser->getId());
1530 include_once(
"./Services/Repository/classes/class.ilAdminSubItemsTableGUI.php");
1531 if (!$this->call_by_reference)
1533 $this->ctrl->setParameter($this,
"obj_id", $this->obj_id);
1537 $tpl->setContent($itab->getHTML());
1551 if (
$_GET[
"item_ref_id"] !=
"")
1556 if(is_array(
$_POST[
"id"]))
1558 foreach(
$_POST[
"id"] as $idx => $id)
1560 $_POST[
"id"][$idx] = (int)$id;
1567 include_once(
"./Services/Repository/classes/class.ilRepUtilGUI.php");
1569 if (!$ru->showDeleteConfirmation(
$_POST[
"id"], $a_error))
1571 $ilCtrl->returnToParent($this);
1582 if ($this->sub_objects ==
"")
1584 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
1599 if ($row[
"max"] > 0)
1602 for ($i=0; $i<count($this->data[
"ctrl"]); $i++)
1604 if ($this->data[
"ctrl"][$i][
"type"] == $row[
"name"])
1611 if ($row[
"max"] ==
"" || $count < $row[
"max"])
1613 $subobj[] = $row[
"name"];
1618 if (is_array($subobj))
1623 $this->tpl->setCurrentBlock(
"add_object");
1624 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
1625 $this->tpl->setVariable(
"BTN_NAME",
"create");
1626 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
1627 $this->tpl->parseCurrentBlock();
1641 mk(); die(
"ilObjectGUI::getTemplateFile() is deprecated.");
1654 foreach ($a_ref_ids as $id)
1657 $tmp_obj =& $this->ilias->obj_factory->getInstanceByRefId($id);
1658 $title[] = $tmp_obj->getTitle();
1662 return $title ? $title : array();
1683 $ilToolbar->addButton($a_text, $this->ctrl->getLinkTarget($this, $a_cmd), $a_target);
1695 include_once
"./Services/Table/classes/class.ilTableGUI.php";
1709 case "clipboardObject":
1710 $offset =
$_GET[
"offset"];
1711 $order =
$_GET[
"sort_by"];
1712 $direction =
$_GET[
"sort_order"];
1713 $tbl->disable(
"footer");
1717 $offset =
$_GET[
"offset"];
1718 $order =
$_GET[
"sort_by"];
1719 $direction =
$_GET[
"sort_order"];
1723 $tbl->setOrderColumn($order);
1724 $tbl->setOrderDirection($direction);
1725 $tbl->setOffset($offset);
1726 $tbl->setLimit(
$_GET[
"limit"]);
1727 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
1728 $tbl->setData($result_set);
1743 $class_name = $this->objDefinition->getClassName($obj_type);
1744 $class = strtolower(
"ilObj".$class_name.
"GUI");
1745 $this->ctrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $a_ref_id);
1746 $this->ctrl->redirectByClass(array(
"ilrepositorygui", $class), $a_cmd);
1761 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
1763 $cp->setType($a_type);
1764 $cp->setTarget(
$_GET[
'ref_id']);
1767 $cp->showSourceSearch($a_tpl_varname);
1771 return $cp->showSourceSearch(null);
1783 include_once(
'./Services/Link/classes/class.ilLink.php');
1784 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1791 $ilErr->raiseError($this->lng->txt(
'permission_denied'));
1801 $ilErr->raiseError($this->lng->txt(
'permission_denied'));
1807 $wizard_options->saveOwner($ilUser->getId());
1808 $wizard_options->saveRoot((
int) $_REQUEST[
'clone_source']);
1811 foreach(
$options as $source_id => $option)
1813 $wizard_options->addEntry($source_id,$option);
1815 $wizard_options->read();
1818 $new_obj = $orig->cloneObject((
int)
$_GET[
'ref_id'],$copy_id);
1821 $wizard_options->deleteAll();
1835 include_once(
"Services/Block/classes/class.ilColumnGUI.php");
1840 if ($ilCtrl->getNextClass() !=
"ilcolumngui")
1843 return $this->getContent();
1847 if (!$ilCtrl->isAsynch())
1857 $this->html = $ilCtrl->forwardCommand($column_gui);
1864 $this->html = $ilCtrl->forwardCommand($column_gui);
1870 return $this->getContent();
1886 include_once(
"Services/Block/classes/class.ilColumnGUI.php");
1896 if ($ilCtrl->getNextClass() ==
"ilcolumngui" &&
1900 $html = $ilCtrl->forwardCommand($column_gui);
1904 if (!$ilCtrl->isAsynch())
1906 $html = $ilCtrl->getHTML($column_gui);
1918 $column_gui->setRepositoryMode(
true);
1919 $column_gui->setEnableEdit(
false);
1922 $column_gui->setEnableEdit(
true);
1939 if (!is_int(strpos($_SERVER[
"PHP_SELF"],
"goto.php")))
1942 if($a_perm ==
"create")
1946 $a_ref_id =
$_GET[
"ref_id"];
1953 if (!is_object($this->
object))
1959 $a_ref_id = $this->
object->getRefId();
1961 $type = $this->
object->getType();
1971 die(
"Permission Denied.");
1989 if($a_perm ==
"create")
1993 $a_ref_id =
$_GET[
"ref_id"];
1995 return $ilAccess->checkAccess($a_perm.
"_".$a_type, $a_cmd, $a_ref_id);
2000 if (!is_object($this->
object))
2006 $a_ref_id = $this->
object->getRefId();
2008 return $ilAccess->checkAccess($a_perm, $a_cmd, $a_ref_id);
2020 global $ilAccess,
$ilErr;
2022 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
2024 $_GET[
"cmd"] =
"frameset";
2025 $_GET[
"target"] =
"";
2026 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
2027 $_GET[
"baseClass"] =
"ilRepositoryGUI";
2028 include(
"ilias.php");
2034 $ilErr->raiseError(
$lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
2046 global $ilAccess,
$ilErr;
2048 $_GET[
"cmd"] = $a_cmd;
2049 $_GET[
"target"] =
"";
2050 $_GET[
"ref_id"] = $a_ref_id;
2051 $_GET[
"baseClass"] =
"ilRepositoryGUI";
2052 include(
"ilias.php");
2061 include_once(
"./Services/FileUpload/classes/class.ilFileUploadGUI.php");
2064 $this->tpl->enableDragDropFileUpload($this->ref_id);
2075 method_exists($a_new_obj,
"setRating"))
2077 $a_new_obj->setRating(
true);