/** * Plugin command execution runpoint. * * The performCommand() method is called internally * by ilias to handle a specific request action. * The $cmd given as argument is used to identify * the command to be executed. * * @param string $cmd The command (method) to execute. */ public function performCommand($cmd) { /** * @var $ilTabs ilTabsGUI * @var $tpl ilTemplate */ global $ilTabs, $tpl; $tpl->setDescription($this->object->getDescription()); $next_class = $this->ctrl->getNextClass($this); switch ($next_class) { case 'ilmdeditorgui': $this->checkPermission('write'); require_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'); $ilTabs->setTabActive('meta_data'); $this->ctrl->forwardCommand($md_gui); return; break; case 'ilcommonactiondispatchergui': require_once 'Services/Object/classes/class.ilCommonActionDispatcherGUI.php'; $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $this->ctrl->forwardCommand($gui); break; default: switch ($cmd) { case 'updateSettings': case 'updateMemberships': case 'initSelectTests': case 'selectTests': case 'performAddTests': case 'removeTests': case 'addMemberships': case 'removeMemberships': case 'editSettings': $this->checkPermission('write'); $this->{$cmd}(); break; case 'showContent': case 'applyOverviewFilter': case 'applyTestsFilter': case 'applyGroupsFilter': case 'resetOverviewFilter': case 'resetTestsFilter': case 'resetGroupsFilter': case 'addToDesk': case 'removeFromDesk': if (in_array($cmd, array('addToDesk', 'removeFromDesk'))) { $cmd .= 'Object'; } $this->checkPermission('read'); $this->{$cmd}(); break; case 'submitManualScores': $this->{$cmd}(); } break; } $this->addHeaderAction(); }
/** * execute command * * @global ilLocatorGUI $ilLocator * @global ilAccessHandler $ilAccess * @global ilNavigationHistory $ilNavigationHistory * @global ilTemplate $tpl * @global ilCtrl $ilCtrl * @global ilTabsGUI $ilTabs * @global ilLanguage $lng * @global ILIAS $ilias */ function executeCommand() { global $ilUser, $ilLocator, $ilAccess, $ilNavigationHistory, $tpl, $ilCtrl, $ilErr, $ilTabs, $lng, $ilDB, $ilPluginAdmin; if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) && !$ilAccess->checkAccess("visible", "", $_GET["ref_id"])) { global $ilias; $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } // add entry to navigation history if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) { if ('qpl' == $this->object->getType()) { $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=" . $_GET["ref_id"], "qpl"); } } $cmd = $this->ctrl->getCmd("questions"); $next_class = $this->ctrl->getNextClass($this); if (in_array($next_class, array('', 'ilobjquestionpoolgui')) && $cmd == 'questions') { $_GET['q_id'] = ''; } $this->prepareOutput(); $this->ctrl->setReturn($this, "questions"); $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print"); $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "ta.css", "Modules/Test"), "screen"); if ($_GET["q_id"] < 1) { $q_type = $_POST["sel_question_types"] != "" ? $_POST["sel_question_types"] : $_GET["sel_question_types"]; } if ($cmd != "createQuestion" && $cmd != "createQuestionForTest" && $next_class != "ilassquestionpagegui") { if ($_GET["test_ref_id"] != "" or $_GET["calling_test"]) { $ref_id = $_GET["test_ref_id"]; if (!$ref_id) { $ref_id = $_GET["calling_test"]; } } } switch ($next_class) { case "ilcommonactiondispatchergui": include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $this->ctrl->forwardCommand($gui); break; case 'ilmdeditorgui': if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } 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 'ilassquestionpreviewgui': $this->ctrl->saveParameter($this, "q_id"); require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php'; $gui = new ilAssQuestionPreviewGUI($this->ctrl, $this->tabs_gui, $this->tpl, $this->lng, $ilDB); $gui->initQuestion((int) $_GET['q_id'], $this->object->getId()); $gui->initPreviewSettings($this->object->getRefId()); $gui->initPreviewSession($ilUser->getId(), (int) $_GET['q_id']); $gui->initHintTracking(); $gui->initStyleSheets(); global $ilHelp; $ilHelp->setScreenIdComponent("qpl"); $this->ctrl->forwardCommand($gui); break; case "ilassquestionpagegui": include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); $q_gui->setQuestionTabs(); $q_gui->outAdditionalOutput(); $q_gui->object->setObjId($this->object->getId()); $q_gui->setTargetGuiClass(null); $q_gui->setQuestionActionCmd(null); $question = $q_gui->object; $this->ctrl->saveParameter($this, "q_id"); include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php"; $this->lng->loadLanguageModule("content"); $this->ctrl->setReturnByClass("ilAssQuestionPageGUI", "view"); $this->ctrl->setReturn($this, "questions"); $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]); $page_gui->setEditPreview(true); $page_gui->setEnabledTabs(false); if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST["editImagemapForward_x"])) { $this->ctrl->setCmdClass(get_class($page_gui)); $this->ctrl->setCmd("preview"); } $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE))); $page_gui->setTemplateTargetVar("ADM_CONTENT"); $page_gui->setOutputMode("edit"); $page_gui->setHeader($question->getTitle()); $page_gui->setPresentationTitle($question->getTitle()); $ret = $this->ctrl->forwardCommand($page_gui); $tpl->setContent($ret); break; case 'ilpermissiongui': include_once "Services/AccessControl/classes/class.ilPermissionGUI.php"; $perm_gui = new ilPermissionGUI($this); $ret = $this->ctrl->forwardCommand($perm_gui); break; case 'ilobjectcopygui': include_once './Services/Object/classes/class.ilObjectCopyGUI.php'; $cp = new ilObjectCopyGUI($this); $cp->setType('qpl'); $this->ctrl->forwardCommand($cp); break; case "ilquestionpoolexportgui": require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolExportGUI.php'; $exp_gui = new ilQuestionPoolExportGUI($this); $exp_gui->addFormat('zip', $this->lng->txt('qpl_export_xml'), $this, 'createExportQTI'); $exp_gui->addFormat('xls', $this->lng->txt('qpl_export_excel'), $this, 'createExportExcel'); $ret = $this->ctrl->forwardCommand($exp_gui); break; case "ilinfoscreengui": $this->infoScreenForward(); break; case 'ilassquestionhintsgui': // set return target $this->ctrl->setReturn($this, "questions"); // set context tabs require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); global $ilHelp; $ilHelp->setScreenIdComponent("qpl"); // forward to ilAssQuestionHintsGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php'; $gui = new ilAssQuestionHintsGUI($questionGUI); $ilCtrl->forwardCommand($gui); break; case 'illocalunitconfigurationgui': if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); $this->ctrl->setReturn($this, 'questions'); require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php'; require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php'; $gui = new ilLocalUnitConfigurationGUI(new ilUnitConfigurationRepository((int) $_GET['q_id'])); $ilCtrl->forwardCommand($gui); break; case 'ilassquestionfeedbackeditinggui': // set return target $this->ctrl->setReturn($this, "questions"); // set context tabs require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); global $ilHelp; $ilHelp->setScreenIdComponent("qpl"); // forward to ilAssQuestionFeedbackGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php'; $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng); $ilCtrl->forwardCommand($gui); break; case 'ilobjquestionpoolsettingsgeneralgui': require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolSettingsGeneralGUI.php'; $gui = new ilObjQuestionPoolSettingsGeneralGUI($ilCtrl, $ilAccess, $lng, $tpl, $ilTabs, $this); $this->ctrl->forwardCommand($gui); break; case "ilobjtaxonomygui": require_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPoolTaxonomyEditingCommandForwarder.php'; $forwarder = new ilObjQuestionPoolTaxonomyEditingCommandForwarder($this->object, $ilDB, $ilPluginAdmin, $ilCtrl, $ilTabs, $lng); $forwarder->forward(); break; case 'ilquestionbrowsertablegui': $this->ctrl->forwardCommand($this->buildQuestionBrowserTableGUI($taxIds = array())); // no tax ids required break; case "ilobjquestionpoolgui": case "": if ($cmd == 'questions') { $this->ctrl->setParameter($this, 'q_id', ''); } $cmd .= "Object"; $ret = $this->{$cmd}(); break; default: $this->ctrl->setReturn($this, "questions"); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI($q_type, $_GET["q_id"]); $q_gui->object->setObjId($this->object->getId()); if ($this->object->getType() == 'qpl') { $q_gui->setTaxonomyIds($this->object->getTaxonomyIds()); $this->object->addQuestionChangeListeners($q_gui->object); } $q_gui->setQuestionTabs(); global $ilHelp; $ilHelp->setScreenIdComponent("qpl"); $ret = $this->ctrl->forwardCommand($q_gui); break; } if (!(strtolower($_GET["baseClass"]) == "iladministrationgui" || strtolower($_GET['baseClass']) == 'ilrepositorygui') && $this->getCreationMode() != true) { $this->tpl->show(); } }
/** * execute command * * @global ilLocatorGUI $ilLocator * @global ilAccessHandler $ilAccess * @global ilNavigationHistory $ilNavigationHistory * @global ilTemplate $tpl * @global ilCtrl $ilCtrl * @global ILIAS $ilias */ function executeCommand() { global $ilLocator, $ilAccess, $ilNavigationHistory, $tpl, $ilCtrl, $ilErr; if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) && !$ilAccess->checkAccess("visible", "", $_GET["ref_id"])) { global $ilias; $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } // add entry to navigation history if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) { $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjQuestionPoolGUI&cmd=questions&ref_id=" . $_GET["ref_id"], "qpl"); } $cmd = $this->ctrl->getCmd("questions"); $next_class = $this->ctrl->getNextClass($this); if (in_array($next_class, array('', 'ilobjquestionpoolgui')) && $cmd == 'questions') { $_GET['q_id'] = ''; } $this->prepareOutput(); $this->ctrl->setReturn($this, "questions"); $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print"); $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "ta.css", "Modules/Test"), "screen"); if ($_GET["q_id"] < 1) { $q_type = $_POST["sel_question_types"] != "" ? $_POST["sel_question_types"] : $_GET["sel_question_types"]; } if ($cmd != "createQuestion" && $cmd != "createQuestionForTest" && $next_class != "ilpageobjectgui") { if ($_GET["test_ref_id"] != "" or $_GET["calling_test"]) { $ref_id = $_GET["test_ref_id"]; if (!$ref_id) { $ref_id = $_GET["calling_test"]; } } } switch ($next_class) { case 'ilmdeditorgui': if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } 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 "ilpageobjectgui": include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); $q_gui->setQuestionTabs(); $q_gui->outAdditionalOutput(); $q_gui->object->setObjId($this->object->getId()); $question = $q_gui->object; $this->ctrl->saveParameter($this, "q_id"); include_once "./Services/COPage/classes/class.ilPageObject.php"; include_once "./Services/COPage/classes/class.ilPageObjectGUI.php"; $this->lng->loadLanguageModule("content"); $this->ctrl->setReturnByClass("ilPageObjectGUI", "view"); $this->ctrl->setReturn($this, "questions"); //$page =& new ilPageObject("qpl", $_GET["q_id"]); $page_gui = new ilPageObjectGUI("qpl", $_GET["q_id"]); $page_gui->setEditPreview(true); $page_gui->setEnabledTabs(false); $page_gui->setEnabledInternalLinks(false); if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST["editImagemapForward_x"])) { $this->ctrl->setCmdClass(get_class($page_gui)); $this->ctrl->setCmd("preview"); } //$page_gui->setQuestionXML($question->toXML(false, false, true)); $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE))); $page_gui->setTemplateTargetVar("ADM_CONTENT"); $page_gui->setOutputMode("edit"); $page_gui->setHeader($question->getTitle()); $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile")); $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen")); $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this)); $page_gui->setPresentationTitle($question->getTitle()); $ret = $this->ctrl->forwardCommand($page_gui); $tpl->setContent($ret); break; case 'ilpermissiongui': include_once "Services/AccessControl/classes/class.ilPermissionGUI.php"; $perm_gui = new ilPermissionGUI($this); $ret = $this->ctrl->forwardCommand($perm_gui); break; case 'ilobjectcopygui': include_once './Services/Object/classes/class.ilObjectCopyGUI.php'; $cp = new ilObjectCopyGUI($this); $cp->setType('qpl'); $this->ctrl->forwardCommand($cp); break; case "ilexportgui": include_once "./Services/Export/classes/class.ilExportGUI.php"; $exp_gui = new ilExportGUI($this); $exp_gui->addFormat("zip", $this->lng->txt('qpl_export_xml'), $this, "createExportQTI"); $exp_gui->addFormat("xls", $this->lng->txt('qpl_export_excel'), $this, "createExportExcel"); // $exp_gui->addCustomColumn($lng->txt("cont_public_access"), $this, "getPublicAccessColValue"); // $exp_gui->addCustomMultiCommand($lng->txt("cont_public_access"), $this, "publishExportFile"); $ret = $this->ctrl->forwardCommand($exp_gui); break; case "ilinfoscreengui": $this->infoScreenForward(); break; case 'ilassquestionhintsgui': // set return target $this->ctrl->setReturn($this, "questions"); // set context tabs require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php'; $questionGUI = assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']); $questionGUI->object->setObjId($this->object->getId()); $questionGUI->setQuestionTabs(); // forward to ilAssQuestionHintsGUI require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php'; $gui = new ilAssQuestionHintsGUI($questionGUI); $ilCtrl->forwardCommand($gui); break; case "ilobjquestionpoolgui": case "": if ($cmd == 'questions') { $this->ctrl->setParameter($this, 'q_id', ''); } $cmd .= "Object"; $ret = $this->{$cmd}(); break; default: $this->ctrl->setReturn($this, "questions"); include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI($q_type, $_GET["q_id"]); $q_gui->object->setObjId($this->object->getId()); $q_gui->setQuestionTabs(); $ret = $this->ctrl->forwardCommand($q_gui); break; } if (strtolower($_GET["baseClass"]) != "iladministrationgui" && $this->getCreationMode() != true) { $this->tpl->show(); } }