84 function ilObjectGUI($a_data, $a_id = 0, $a_call_by_reference =
true, $a_prepare_output =
true)
88 $this->tabs_gui =& $ilTabs;
106 $params = array(
"ref_id");
108 if (!$a_call_by_reference)
110 $params = array(
"ref_id",
"obj_id");
113 $this->ctrl->saveParameter($this, $params);
116 $this->tree =&
$tree;
117 $this->formaction = array();
118 $this->return_location = array();
119 $this->target_frame = array();
121 $this->sub_objects =
"";
123 $this->data = $a_data;
125 $this->call_by_reference = $a_call_by_reference;
126 $this->prepare_output = $a_prepare_output;
127 $this->creation_mode =
false;
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;
134 $this->link_params =
"ref_id=".$this->ref_id;
141 if (is_object($this->
object))
143 if ($this->call_by_reference && $this->ref_id =
$_GET[
"ref_id"])
145 $this->ctrl->setContext($this->object->getId(),
146 $this->
object->getType());
154 if ($a_prepare_output)
168 $next_class = $this->ctrl->getNextClass($this);
169 $cmd = $this->ctrl->getCmd();
194 return $this->call_by_reference;
205 $this->creation_mode = $a_mode;
213 return $this->creation_mode;
222 if ($this->call_by_reference)
238 global $ilLocator,
$tpl, $ilUser;
240 $this->tpl->getStandardTemplate();
242 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
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);
278 $this->parent_gui_obj =
new $class_name(
"",
$_GET[
"ref_id"],
true,
false);
279 $this->parent_gui_obj->setTitleAndDescription();
291 require_once
'Services/WebDAV/classes/class.ilDAVServer.php';
293 $ilUser->getId() != ANONYMOUS_USER_ID)
309 $this->tpl->setTitle($this->object->getPresentationTitle());
310 $this->tpl->setDescription($this->object->getLongDescription());
311 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
320 $this->lng->txt(
"obj_" . $this->object->getType()));
328 if ($this->object->getRefId() ==
"")
333 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui")
335 if ($this->object->getRefId() != ROOT_FOLDER_ID &&
336 $this->
object->getRefId() != SYSTEM_FOLDER_ID)
338 $par_id = $tree->getParentId($this->object->getRefId());
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);
347 else if ($this->object->getRefId() == ROOT_FOLDER_ID)
349 $this->ctrl->setParameterByClass(
"iladministrationgui",
"ref_id",
"");
350 $this->ctrl->setParameterByClass(
"iladministrationgui",
"admin_mode",
"settings");
351 $tpl->setUpperIcon($this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
353 $this->ctrl->clearParametersByClass(
"iladministrationgui");
358 if ($this->object->getRefId() != ROOT_FOLDER_ID &&
359 $this->
object->getRefId() != SYSTEM_FOLDER_ID &&
360 $_GET[
"obj_id"] ==
"")
362 if (defined(
"ILIAS_MODULE"))
366 $par_id = $tree->getParentId($this->object->getRefId());
367 $tpl->setUpperIcon($prefix.
"repository.php?cmd=frameset&ref_id=".$par_id,
377 if ($this->object->getRefId() ==
"")
382 $tpl->setMountWebfolderIcon($this->object->getRefId());
393 $this->
getTabs($this->tabs_gui);
410 global $rbacsystem,
$tree;
412 if (
$_GET[
"admin_mode"] ==
"repository")
414 $this->ctrl->setParameterByClass(
"iladministrationgui",
"admin_mode",
"settings");
415 $tabs_gui->setBackTarget($this->lng->txt(
"administration"),
416 $this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
418 $this->ctrl->setParameterByClass(
"iladministrationgui",
"admin_mode",
"repository");
421 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
423 $tabs_gui->addTarget(
"view",
424 $this->ctrl->getLinkTarget($this,
"view"), array(
"",
"view"), get_class($this));
427 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
429 $tabs_gui->addTarget(
"perm_settings",
430 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
"",
"ilpermissiongui");
433 if ($tree->getSavedNodeData($this->object->getRefId()))
435 $tabs_gui->addTarget(
"trash",
436 $this->ctrl->getLinkTarget($this,
"trash"),
"trash", get_class($this));
455 if (is_array($a_actions))
476 if (is_array($a_sub_objects))
478 foreach ($a_sub_objects as
$name => $options)
480 $this->sub_objects[
$name] = array(
"name" =>
$name,
"max" => $options[
"max"]);
485 $this->sub_objects =
"";
499 global $ilLocator,
$tpl;
501 if ($this->omit_locator)
511 : $this->object->getRefId();
512 $ilLocator->addRepositoryItems(
$ref_id);
514 if(!$this->creation_mode)
520 if (
$_GET[
"admin_mode"] ==
"" &&
521 strtolower($this->ctrl->getCmdClass()) ==
"ilobjrolegui")
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"));
545 $this->omit_locator = $a_omit;
556 if (
$_GET[
"admin_mode"] ==
"settings")
558 $ilLocator->addItem($this->lng->txt(
"administration"),
559 $this->ctrl->getLinkTargetByClass(
"iladministrationgui",
"frameset"),
561 if ($this->object->getRefId() != SYSTEM_FOLDER_ID)
563 $ilLocator->addItem($this->object->getTitle(),
564 $this->ctrl->getLinkTarget($this,
"view"));
569 $this->ctrl->setParameterByClass(
"iladministrationgui",
571 $this->ctrl->setParameterByClass(
"iladministrationgui",
572 "admin_mode",
"settings");
576 $this->ctrl->clearParametersByClass(
"iladministrationgui");
577 $ilLocator->addAdministrationItems();
587 include_once(
"./Services/Repository/classes/class.ilRepUtilGUI.php");
589 $ru->restoreObjects(
$_GET[
"ref_id"],
$_POST[
"trash_id"]);
590 $this->ctrl->redirect($this,
"trash");
601 include_once(
"./Services/Repository/classes/class.ilRepUtilGUI.php");
604 session_unregister(
"saved_post");
605 $this->ctrl->returnToParent($this);
615 session_unregister(
"saved_post");
616 $this->ctrl->returnToParent($this);
626 global $rbacsystem,
$log, $ilAppEventHandler,
$lng;
628 include_once(
"./Services/Repository/classes/class.ilRepUtilGUI.php");
630 $ru->removeObjectsFromSystem(
$_POST[
"trash_id"]);
631 $this->ctrl->redirect($this,
"trash");
645 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
647 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
653 $data[
"fields"] = array();
660 $this->tpl->setCurrentBlock(
"img");
661 $this->tpl->setVariable(
"TYPE_IMG",
663 $this->tpl->setVariable(
"ALT_IMG",
664 $this->lng->txt(
"obj_".$new_type));
665 $this->tpl->parseCurrentBlock();
667 foreach (
$data[
"fields"] as $key => $val)
669 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
670 $this->tpl->setVariable(strtoupper($key), $val);
672 if ($this->prepare_output)
674 $this->tpl->parseCurrentBlock();
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");
684 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
696 session_unregister(
"saved_post");
698 $this->ctrl->returnToParent($this);
713 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
715 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->MESSAGE);
718 $location = $objDefinition->getLocation($new_type);
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);
728 $newObj->createReference();
729 $newObj->putInTree(
$_GET[
"ref_id"]);
730 $newObj->setPermissions(
$_GET[
"ref_id"]);
734 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
735 $rbac_log_roles = $rbacreview->getParentRoleIds($newObj->getRefId(),
false);
751 if (!$rbacsystem->checkAccess(
"write", $this->ref_id))
753 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
783 foreach ($fields as $key => $val)
785 $this->tpl->setVariable(
"TXT_".strtoupper($key), $this->lng->txt($key));
786 $this->tpl->setVariable(strtoupper($key), $val);
791 if (!$this->call_by_reference)
793 $this->ctrl->setParameter($this,
"obj_id", $this->obj_id);
796 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"update"));
797 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($this->object->getType().
"_edit"));
798 $this->tpl->setVariable(
"TARGET", $this->
getTargetFrame(
"update"));
799 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
800 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
801 $this->tpl->setVariable(
"CMD_SUBMIT",
"update");
802 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
816 $this->update = $this->
object->update();
825 $this->ctrl->redirect($this);
839 if ($this->formaction[$a_cmd] !=
"")
841 return $this->formaction[$a_cmd];
845 return $a_formaction;
859 $this->formaction[$a_cmd] = $a_formaction;
871 if ($this->return_location[$a_cmd] !=
"")
873 return $this->return_location[$a_cmd];
891 $this->return_location[$a_cmd] = $a_location;
903 if ($this->target_frame[$a_cmd] !=
"")
905 return $this->target_frame[$a_cmd];
907 elseif (!empty($a_target_frame))
909 return "target=\"".$a_target_frame.
"\"";
926 $this->target_frame[$a_cmd] =
"target=\"".$a_target_frame.
"\"";
934 $ilBench->start(
"Explorer",
"setOutput_isVisible");
935 $visible = $rbacsystem->checkAccess(
'visible,read',$a_ref_id);
937 if ($visible && $a_type ==
'crs') {
939 if($crs_id = $tree->checkForParentType($a_ref_id,
'crs'))
941 if(!$rbacsystem->checkAccess(
'write',$crs_id))
946 if(!$tmp_obj->isActivated())
951 if(($crs_id != $a_ref_id) and $tmp_obj->isArchived())
956 include_once
"./course/classes/class.ilCourseItems.php";
966 $ilBench->stop(
"Explorer",
"setOutput_isVisible");
979 global $rbacsystem,
$tpl;
981 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
983 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
986 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
991 $this->object->getType(),
992 $this->
object->getRefId(),
993 $this->
object->getId(), $ilUser->getId());
997 include_once(
"./Services/Repository/classes/class.ilAdminSubItemsTableGUI.php");
998 if (!$this->call_by_reference)
1000 $this->ctrl->setParameter($this,
"obj_id", $this->obj_id);
1004 $tpl->setContent($itab->getHTML());
1018 if (
$_GET[
"item_ref_id"] !=
"")
1026 include_once(
"./Services/Repository/classes/class.ilRepUtilGUI.php");
1028 if (!$ru->showDeleteConfirmation(
$_POST[
"id"], $a_error))
1030 $ilCtrl->returnToParent($this);
1043 include_once(
"./Services/Repository/classes/class.ilRepUtilGUI.php");
1045 $ru->showTrashTable(
$_GET[
"ref_id"]);
1055 if ($this->sub_objects ==
"")
1057 $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
1072 if ($row[
"max"] > 0)
1075 for ($i=0; $i<count($this->data[
"ctrl"]); $i++)
1077 if ($this->data[
"ctrl"][$i][
"type"] == $row[
"name"])
1084 if ($row[
"max"] ==
"" || $count < $row[
"max"])
1086 $subobj[] = $row[
"name"];
1091 if (is_array($subobj))
1096 $this->tpl->setCurrentBlock(
"add_object");
1097 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
1098 $this->tpl->setVariable(
"BTN_NAME",
"create");
1099 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"add"));
1100 $this->tpl->parseCurrentBlock();
1119 $template =
"tpl.".$a_type.
"_".$a_cmd.
".html";
1121 if (!$this->tpl->fileExists($template) &&
1122 !file_exists(
"./templates/default/".$template))
1124 $template =
"tpl.obj_".$a_cmd.
".html";
1126 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content", $template,$a_in_module);
1139 foreach ($a_ref_ids as $id)
1142 $tmp_obj =& $this->ilias->obj_factory->getInstanceByRefId($id);
1143 $title[] = $tmp_obj->getTitle();
1168 $ilToolbar->addButton($a_text, $this->ctrl->getLinkTarget($this, $a_cmd), $a_target);
1180 include_once
"./Services/Table/classes/class.ilTableGUI.php";
1194 case "clipboardObject":
1195 $offset =
$_GET[
"offset"];
1196 $order =
$_GET[
"sort_by"];
1197 $direction =
$_GET[
"sort_order"];
1198 $tbl->disable(
"footer");
1202 $offset =
$_GET[
"offset"];
1203 $order =
$_GET[
"sort_by"];
1204 $direction =
$_GET[
"sort_order"];
1208 $tbl->setOrderColumn($order);
1209 $tbl->setOrderDirection($direction);
1210 $tbl->setOffset($offset);
1211 $tbl->setLimit(
$_GET[
"limit"]);
1212 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
1213 $tbl->setData($result_set);
1221 $tpl =& $tbl->getTemplateObject();
1223 $tpl->setCurrentBlock(
"tbl_form_header");
1224 $tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
1225 $tpl->parseCurrentBlock();
1227 $tpl->setCurrentBlock(
"tbl_action_btn");
1228 $tpl->setVariable(
"BTN_NAME",
"paste");
1229 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"insert_object_here"));
1230 $tpl->parseCurrentBlock();
1232 $tpl->setCurrentBlock(
"tbl_action_btn");
1233 $tpl->setVariable(
"BTN_NAME",
"clear");
1234 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"clear_clipboard"));
1235 $tpl->parseCurrentBlock();
1237 $tpl->setCurrentBlock(
"tbl_action_row");
1238 $tpl->setVariable(
"COLUMN_COUNTS",3);
1240 $tpl->parseCurrentBlock();
1242 $tbl->setTitle($this->lng->txt(
"clipboard"),
"icon_typ_b.gif",$this->lng->txt(
"clipboard"));
1243 $tbl->setHeaderNames(array($this->lng->txt(
'obj_type'),
1244 $this->lng->txt(
'title'),
1245 $this->lng->txt(
'action')));
1246 $tbl->setHeaderVars(array(
'type',
1249 array(
'ref_id' => $this->object->getRefId(),
1250 'cmd' =>
'clipboard',
1251 'cmdClass' =>
$_GET[
'cmdClass'],
1252 'cmdNode' =>
$_GET[
'cmdNode']));
1254 $tbl->setColumnWidth(array(
"",
"80%",
"19%"));
1260 $this->tpl->setVariable(
"RESULT_TABLE",$tbl->tpl->get());
1277 $class_name = $this->objDefinition->getClassName($obj_type);
1278 $class = strtolower(
"ilObj".$class_name.
"GUI");
1279 $this->ctrl->redirectByClass(array(
"ilrepositorygui", $class), $a_cmd);
1295 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
1297 $cp->setType($a_type);
1298 $cp->setTarget(
$_GET[
'ref_id']);
1299 $cp->showSourceSearch($a_tpl_varname);
1313 include_once(
'classes/class.ilLink.php');
1314 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1316 global $ilAccess,
$ilErr,$rbacsystem,$ilUser;
1319 if(!$rbacsystem->checkAccess(
'create',(
int)
$_GET[
'ref_id'],$new_type))
1321 $ilErr->raiseError($this->lng->txt(
'permission_denied'));
1329 if(!$ilAccess->checkAccess(
'write',
'',(
int)
$_REQUEST[
'clone_source'],$new_type))
1331 $ilErr->raiseError($this->lng->txt(
'permission_denied'));
1337 $wizard_options->saveOwner($ilUser->getId());
1338 $wizard_options->saveRoot((
int) $_REQUEST[
'clone_source']);
1340 $options =
$_POST[
'cp_options'] ?
$_POST[
'cp_options'] : array();
1341 foreach($options as $source_id => $option)
1343 $wizard_options->addEntry($source_id,$option);
1345 $wizard_options->read();
1348 $new_obj = $orig->cloneObject((
int) $_GET[
'ref_id'],$copy_id);
1351 $wizard_options->deleteAll();
1376 include_once(
"Services/Block/classes/class.ilColumnGUI.php");
1381 if ($ilCtrl->getNextClass() !=
"ilcolumngui")
1384 return $this->getContent();
1388 if (!$ilCtrl->isAsynch())
1398 $this->html = $ilCtrl->forwardCommand($column_gui);
1405 $this->html = $ilCtrl->forwardCommand($column_gui);
1411 return $this->getContent();
1427 include_once(
"Services/Block/classes/class.ilColumnGUI.php");
1437 if ($ilCtrl->getNextClass() ==
"ilcolumngui" &&
1441 $html = $ilCtrl->forwardCommand($column_gui);
1445 if (!$ilCtrl->isAsynch())
1447 $html = $ilCtrl->getHTML($column_gui);
1461 $column_gui->setRepositoryMode(
true);
1462 $column_gui->setEnableEdit(
false);
1463 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
1465 $column_gui->setEnableEdit(
true);
1471 global $ilAccess,
$lng, $PHP_SELF;
1473 if (!is_object($this->
object))
1478 if (!$ilAccess->checkAccess($a_perm, $a_cmd, $this->object->getRefId()))
1483 if (!is_int(strpos($PHP_SELF,
"goto.php")))
1486 $this->
object->getRefId());
1490 die(
"Permission Denied.");