/**
  * 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();
     }
 }
 /**
  * Forward to page editor
  */
 protected function forwardToPageObject()
 {
     global $lng, $tpl;
     $key = (int) $_REQUEST['key'];
     $this->ctrl->saveParameter($this, 'key', $key);
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     include_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
     include_once './Services/Style/classes/class.ilObjStyleSheet.php';
     $lng->loadLanguageModule("content");
     if (!ilPageObject::_exists('auth', $key)) {
         // doesn't exist -> create new one
         $new_page_object = new ilPageObject('auth');
         $new_page_object->setParentId($key);
         $new_page_object->setId($key);
         $new_page_object->createFromXML();
     }
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
     $tpl->setCurrentBlock("SyntaxStyle");
     $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $tpl->parseCurrentBlock();
     $this->ctrl->setReturnByClass('ilpageobjectgui', "edit");
     $page_gui = new ilPageObjectGUI('auth', $key);
     $page_gui->setIntLinkHelpDefault("RepositoryItem", $key);
     $page_gui->setTemplateTargetVar("ADM_CONTENT");
     $page_gui->setLinkXML($link_xml);
     //$page_gui->enableChangeComments($this->content_object->isActiveHistoryUserComments());
     //$page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
     //$page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "showMediaFullscreen"));
     //$page_gui->setLinkParams($this->ctrl->getUrlParameterString()); // todo
     //		$page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this, ""));
     $page_gui->setPresentationTitle("");
     $page_gui->setTemplateOutput(false);
     //$page_gui->setLocator($contObjLocator);
     $page_gui->setHeader("");
     $page_gui->setEnabledRepositoryObjects(true);
     $page_gui->setEnabledLoginPage(true);
     $page_gui->setEnabledFileLists(false);
     $page_gui->setEnabledMaps(true);
     $page_gui->setEnabledPCTabs(true);
     $page_gui->setEnabledInternalLinks(true);
     // style tab
     //$page_gui->setTabHook($this, "addPageTabs");
     if ($this->ctrl->getCmd() == 'editPage') {
         $this->ctrl->setCmd('edit');
     }
     $html = $this->ctrl->forwardCommand($page_gui);
     $tpl->setContent($html);
 }