/**
  * 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();
     }
 }
 private function populateSolutionOutput(ilTemplate $tpl)
 {
     // FOR WHAT EXACTLY IS THIS USEFUL?
     $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
     $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
     $pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
     $pageGUI->setEditPreview(true);
     $pageGUI->setEnabledTabs(false);
     // FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
     if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) {
         $this->ctrl->setCmdClass(get_class($pageGUI));
         $this->ctrl->setCmd('preview');
     }
     $this->questionGUI->setPreviewSession($this->previewSession);
     $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0)));
     //$pageGUI->setHeader($this->questionOBJ->getTitle()); // NO ADDITIONAL HEADER
     //$pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
     //$pageGUI->setTemplateTargetVar("ADM_CONTENT"); // NOT REQUIRED, OR IS?
     $tpl->setCurrentBlock('solution_output');
     $tpl->setVariable('SOLUTION_OUTPUT', $pageGUI->preview());
     $tpl->parseCurrentBlock();
 }