/** * execute command */ function executeCommand() { global $ilUser, $ilLocator, $ilTabs; $next_class = $this->ctrl->getNextClass($this); $cmd = $this->ctrl->getCmd(); if (strtolower($_GET["baseClass"]) == "iladministrationgui" || $this->getCreationMode() == true) { $this->prepareOutput(); } else { if (!in_array($cmd, array("", "framset")) || $next_class != "") { $this->getTemplate(); $this->setLocator(); $this->setTabs(); } } if (!$this->getCreationMode()) { if (IS_PAYMENT_ENABLED) { include_once 'Services/Payment/classes/class.ilPaymentObject.php'; if (ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) { $this->tpl->getStandardTemplate(); include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php'; $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']); $ret = $this->ctrl->forwardCommand($pp); return true; } } } switch ($next_class) { case 'ilmdeditorgui': $this->checkPermission("write"); $ilTabs->activateTab('id_meta_data'); include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php'; $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType()); $md_gui->addObserver($this->object, 'MDUpdateListener', 'General'); $this->ctrl->forwardCommand($md_gui); break; case "ilfilesystemgui": $this->checkPermission("write"); $ilTabs->activateTab('id_list_files'); $fs_gui = new ilFileSystemGUI($this->object->getDataDirectory()); $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose")); $fs_gui->setUseUploadDirectory(true); $fs_gui->setTableId("htlmfs" . $this->object->getId()); if ($this->object->getStartFile() != "") { $fs_gui->labelFile($this->object->getStartFile(), $this->lng->txt("cont_startfile")); } $fs_gui->addCommand($this, "setStartFile", $this->lng->txt("cont_set_start_file")); $this->ctrl->forwardCommand($fs_gui); // try to set start file automatically require_once "./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php"; if (!ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId())) { $do_update = false; $pcommand = $fs_gui->getLastPerformedCommand(); if (is_array($pcommand)) { $valid = array("index.htm", "index.html", "start.htm", "start.html"); if ($pcommand["cmd"] == "create_file") { $file = strtolower(basename($pcommand["name"])); if (in_array($file, $valid)) { $this->object->setStartFile($pcommand["name"]); $do_update = $pcommand["name"]; } } else { if ($pcommand["cmd"] == "unzip_file") { $zip_file = strtolower(basename($pcommand["name"])); $suffix = strrpos($zip_file, "."); if ($suffix) { $zip_file = substr($zip_file, 0, $suffix); } foreach ($pcommand["added"] as $file) { $chk_file = null; if (stristr($file, ".htm")) { $chk_file = strtolower(basename($file)); $suffix = strrpos($chk_file, "."); if ($suffix) { $chk_file = substr($chk_file, 0, $suffix); } } if (in_array(basename($file), $valid) || $zip_file && $chk_file && $chk_file == $zip_file) { $this->object->setStartFile($file); $do_update = $file; break; } } } } } if ($do_update) { ilUtil::sendInfo(sprintf($this->lng->txt("cont_start_file_set_to"), $do_update), true); $this->object->update(); $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles"); } } break; case "ilinfoscreengui": $ret =& $this->outputInfoScreen(); break; case "illearningprogressgui": $ilTabs->activateTab('id_learning_progress'); include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php'; $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId(), $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()); $this->ctrl->forwardCommand($new_gui); break; case 'ilpermissiongui': $ilTabs->activateTab('id_permissions'); include_once "Services/AccessControl/classes/class.ilPermissionGUI.php"; $perm_gui =& new ilPermissionGUI($this); $ret =& $this->ctrl->forwardCommand($perm_gui); break; case 'illicensegui': $ilTabs->activateTab('id_license'); include_once "./Services/License/classes/class.ilLicenseGUI.php"; $license_gui =& new ilLicenseGUI($this); $ret =& $this->ctrl->forwardCommand($license_gui); break; case "ilexportgui": $ilTabs->activateTab("export"); include_once "./Services/Export/classes/class.ilExportGUI.php"; $exp_gui = new ilExportGUI($this); $exp_gui->addFormat("xml"); $exp_gui->addFormat("html", "", $this, "exportHTML"); $ret = $this->ctrl->forwardCommand($exp_gui); // $this->tpl->show(); break; case "ilcommonactiondispatchergui": include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $this->ctrl->forwardCommand($gui); break; default: $cmd = $this->ctrl->getCmd("frameset"); if (strtolower($_GET["baseClass"]) == "iladministrationgui" || $this->getCreationMode() == true) { $cmd .= "Object"; } $ret =& $this->{$cmd}(); break; } $this->addHeaderAction(); }
/** * execute command */ function &executeCommand() { global $ilTabs, $lng, $ilAccess, $tpl, $ilCtrl; if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") { $this->explorer(); return; } $next_class = $this->ctrl->getNextClass($this); $cmd = $this->ctrl->getCmd(); $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"]; if ($new_type != "" && ($cmd != "confirmRemove" && $cmd != "copyToClipboard" && $cmd != "pasteFromClipboard")) { $this->setCreationMode(true); } if (!$this->getCreationMode()) { $tree =& $this->object->getTree(); if ($_GET["mepitem_id"] == "") { $_GET["mepitem_id"] = $tree->getRootId(); } } if ($cmd == "create") { switch ($_POST["new_type"]) { case "mob": $this->ctrl->redirectByClass("ilobjmediaobjectgui", "create"); break; case "fold": // todo $this->ctrl->redirectByClass("ilobjfoldergui", "create"); break; } } switch ($next_class) { case 'ilmediapoolpagegui': $this->prepareOutput(); $this->addHeaderAction(); $this->setMediaPoolPageTabs(); include_once "./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php"; $mep_page_gui = new ilMediaPoolPageGUI($_GET["mepitem_id"], $_GET["old_nr"]); if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) { $mep_page_gui->setEnableEditing(false); } $ret = $this->ctrl->forwardCommand($mep_page_gui); if ($ret != "") { $tpl->setContent($ret); } $this->tpl->show(); break; case "ilobjmediaobjectgui": //$cmd.="Object"; if ($cmd == "create" || $cmd == "save" || $cmd == "cancel") { $ret_obj = $_GET["mepitem_id"]; $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", 0, false, false); $ilObjMediaObjectGUI->setWidthPreset($this->object->getDefaultWidth()); $ilObjMediaObjectGUI->setHeightPreset($this->object->getDefaultHeight()); } else { $ret_obj = $tree->getParentId($_GET["mepitem_id"]); $ilObjMediaObjectGUI =& new ilObjMediaObjectGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false); $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId()); $ilTabs->setBackTarget($lng->txt("back"), $this->ctrl->getLinkTarget($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia")); } if ($this->ctrl->getCmdClass() == "ilinternallinkgui") { $this->ctrl->setReturn($this, "explorer"); } else { $this->ctrl->setParameter($this, "mepitem_id", $ret_obj); $this->ctrl->setReturn($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia"); $this->ctrl->setParameter($this, "mepitem_id", $_GET["mepitem_id"]); } $this->getTemplate(); $ilObjMediaObjectGUI->setTabs(); $this->setLocator(); //$ret =& $ilObjMediaObjectGUI->executeCommand(); $ret = $this->ctrl->forwardCommand($ilObjMediaObjectGUI); if ($cmd == "save" && $ret != false) { $mep_item = new ilMediaPoolItem(); $mep_item->setTitle($ret->getTitle()); $mep_item->setType("mob"); $mep_item->setForeignId($ret->getId()); $mep_item->create(); $parent = $_GET["mepitem_id"] == "" ? $tree->getRootId() : $_GET["mepitem_id"]; $tree->insertNode($mep_item->getId(), $parent); ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" . $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]); } else { $this->tpl->show(); } break; case "ilobjfoldergui": // todo $this->addHeaderAction(); $folder_gui = new ilObjFolderGUI("", 0, false, false); $this->ctrl->setReturn($this, "listMedia"); $cmd .= "Object"; switch ($cmd) { case "createObject": $this->prepareOutput(); $folder_gui =& new ilObjFolderGUI("", 0, false, false); $folder_gui->setFormAction("save", $this->ctrl->getFormActionByClass("ilobjfoldergui")); $folder_gui->createObject(); $this->tpl->show(); break; case "saveObject": //$folder_gui->setReturnLocation("save", $this->ctrl->getLinkTarget($this, "listMedia")); $parent = $_GET["mepitem_id"] == "" ? $tree->getRootId() : $_GET["mepitem_id"]; $folder_gui->setFolderTree($tree); $folder_gui->saveObject($parent); //$this->ctrl->redirect($this, "listMedia"); break; case "editObject": $this->prepareOutput(); $folder_gui =& new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false); $this->ctrl->setParameter($this, "foldereditmode", "1"); $folder_gui->setFormAction("update", $this->ctrl->getFormActionByClass("ilobjfoldergui")); $folder_gui->editObject(); $this->tpl->show(); break; case "updateObject": $folder_gui =& new ilObjFolderGUI("", ilMediaPoolItem::lookupForeignId($_GET["mepitem_id"]), false, false); $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId()); $this->ctrl->setReturn($this, "listMedia"); $folder_gui->updateObject(true); // this returns to parent break; case "cancelObject": if ($_GET["foldereditmode"]) { $this->ctrl->setParameter($this, "mepitem_id", $this->getParentFolderId()); } $this->ctrl->redirect($this, "listMedia"); break; } break; case "ileditclipboardgui": $this->prepareOutput(); $this->addHeaderAction(); $this->ctrl->setReturn($this, $_GET["mep_mode"] ? $_GET["mep_mode"] : "listMedia"); $clip_gui = new ilEditClipboardGUI(); $clip_gui->setMultipleSelections(true); $clip_gui->setInsertButtonTitle($lng->txt("mep_copy_to_mep")); $ilTabs->setTabActive("clipboard"); //$ret =& $clip_gui->executeCommand(); $ret =& $this->ctrl->forwardCommand($clip_gui); $this->tpl->show(); break; case 'ilinfoscreengui': $this->prepareOutput(); $this->addHeaderAction(); $this->infoScreen(); $this->tpl->show(); break; case 'ilpermissiongui': $this->prepareOutput(); $this->addHeaderAction(); include_once "Services/AccessControl/classes/class.ilPermissionGUI.php"; $perm_gui =& new ilPermissionGUI($this); $ret =& $this->ctrl->forwardCommand($perm_gui); $this->tpl->show(); break; case "ilexportgui": $this->prepareOutput(); $this->addHeaderAction(); include_once "./Services/Export/classes/class.ilExportGUI.php"; $exp_gui = new ilExportGUI($this); $exp_gui->addFormat("xml"); $ret = $this->ctrl->forwardCommand($exp_gui); $this->tpl->show(); break; case "ilfilesystemgui": $this->prepareOutput(); $this->addHeaderAction(); $ilTabs->clearTargets(); $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "listMedia")); $mset = new ilSetting("mobs"); if (trim($mset->get("upload_dir")) != "") { include_once "./Services/FileSystem/classes/class.ilFileSystemGUI.php"; $fs_gui = new ilFileSystemGUI($mset->get("upload_dir")); $fs_gui->setPostDirPath(true); $fs_gui->setTableId("mepud" . $this->object->getId()); $fs_gui->setAllowFileCreation(false); $fs_gui->setAllowDirectoryCreation(false); $fs_gui->clearCommands(); $fs_gui->addCommand($this, "selectUploadDirFiles", $this->lng->txt("mep_sel_upload_dir_files"), false, true); //$fs_gui->addCommand($this, "assignFullscreenObject", $this->lng->txt("cont_assign_full")); $ret =& $this->ctrl->forwardCommand($fs_gui); } $this->tpl->show(); break; case "ilcommonactiondispatchergui": include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $this->ctrl->forwardCommand($gui); break; default: $this->prepareOutput(); $this->addHeaderAction(); $cmd = $this->ctrl->getCmd("frameset"); $this->{$cmd}(); if (!$this->getCreationMode()) { $this->tpl->show(); } break; } }