public function exportQuestion($a_ref_id, $a_image_path = null, $a_output_mode = "presentation")
 {
     if ($a_ref_id != "") {
         $inst_id = ilInternalLink::_extractInstOfTarget($a_ref_id);
         if (!($inst_id > 0)) {
             $q_id = ilInternalLink::_extractObjIdOfTarget($a_ref_id);
         }
     }
     $this->q_gui = assQuestionGUI::_getQuestionGUI("", $q_id);
     if (!is_object($this->q_gui->object)) {
         return "Error: Question not found.";
     }
     $type = $this->q_gui->object->getQuestionType();
     if (method_exists($this, $type)) {
         $this->q_gui->object->setExportImagePath($a_image_path);
         $this->q_gui->object->feedbackOBJ->setPageObjectOutputMode($a_output_mode);
         $this->json = $this->q_gui->object->toJSON();
         $this->json_decoded = json_decode($this->json);
         self::$exported[$this->json_decoded->id] = $this->json;
         self::$mobs[$this->json_decoded->id] = $this->json_decoded->mobs;
         return $this->{$type}();
     } else {
         return "Error: Question Type not implemented/Question editing not finished";
     }
 }
 /**
  * @param $qId
  */
 public function __construct($qId = -1)
 {
     parent::__construct();
     require_once 'Modules/TestQuestionPool/classes/class.assKprimChoice.php';
     $this->object = new assKprimChoice();
     if ($qId > 0) {
         $this->object->loadFromDb($qId);
     }
 }
 /**
  * assNumericGUI constructor
  *
  * The constructor takes possible arguments an creates an instance of the assNumericGUI object.
  *
  * @param integer $id The database id of a Numeric question object
  *
  * @return assNumericGUI
  */
 public function __construct($id = -1)
 {
     parent::__construct();
     require_once './Modules/TestQuestionPool/classes/class.assNumeric.php';
     $this->object = new assNumeric();
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
 }
 /**
  * assJavaAppletGUI constructor
  *
  * The constructor takes possible arguments an creates an instance of the assJavaAppletGUI object.
  *
  * @param integer $id The database id of a image map question object
  * 
  * @return \assJavaAppletGUI
  */
 function __construct($id = -1)
 {
     parent::__construct();
     include_once './Modules/TestQuestionPool/classes/class.assJavaApplet.php';
     $this->object = new assJavaApplet();
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
 }
 /**
  * assFormulaQuestionGUI constructor
  * The constructor takes possible arguments an creates an instance of the assFormulaQuestionGUI object.
  * @param integer $id The database id of a multiple choice question object
  * @access public
  */
 function __construct($id = -1)
 {
     parent::__construct();
     $this->object = new assFormulaQuestion();
     $this->newUnitId = null;
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
 }
 /**
  * assMultipleChoiceGUI constructor
  *
  * The constructor takes possible arguments an creates an instance of the assMultipleChoiceGUI object.
  *
  * @param integer $id The database id of a multiple choice question object
  * @access public
  */
 function __construct($id = -1)
 {
     parent::__construct();
     include_once "./Modules/TestQuestionPool/classes/class.assMultipleChoice.php";
     $this->object = new assMultipleChoice();
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
 }
 /**
  * assErrorTextGUI constructor
  *
  * The constructor takes possible arguments an creates an instance of the assOrderingHorizontalGUI object.
  *
  * @param integer $id The database id of a single choice question object
  * @access public
  */
 public function __construct($id = -1)
 {
     parent::__construct();
     include_once "./Modules/TestQuestionPool/classes/class.assErrorText.php";
     $this->object = new assErrorText();
     $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
 }
 /**
  * assOrderingQuestionGUI constructor
  *
  * The constructor takes possible arguments an creates an instance of the assOrderingQuestionGUI object.
  *
  * @param integer $id The database id of a ordering question object
  *                    
  * @return assOrderingQuestionGUI
  */
 public function __construct($id = -1)
 {
     parent::__construct();
     include_once "./Modules/TestQuestionPool/classes/class.assOrderingQuestion.php";
     $this->object = new assOrderingQuestion();
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
     $this->object->setOutputType(OUTPUT_JAVASCRIPT);
 }
 /**
  * assFlashQuestionGUI constructor
  *
  * The constructor takes possible arguments an creates an instance of the assFlashQuestionGUI object.
  *
  * @param integer $id The database id of a single choice question object
  * @access public
  */
 function __construct($id = -1)
 {
     parent::__construct();
     include_once "./Modules/TestQuestionPool/classes/class.assFlashQuestion.php";
     $this->object = new assFlashQuestion();
     $this->newUnitId = null;
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
 }
 /**
  * assImagemapQuestionGUI constructor
  *
  * The constructor takes possible arguments an creates an instance of the assImagemapQuestionGUI object.
  *
  * @param integer $id The database id of a image map question object.
  * 
  * @return \assImagemapQuestionGUI
  */
 public function __construct($id = -1)
 {
     parent::__construct();
     include_once './Modules/TestQuestionPool/classes/class.assImagemapQuestion.php';
     $this->object = new assImagemapQuestion();
     if ($id >= 0) {
         $this->object->loadFromDb($id);
     }
     $assessmentSetting = new ilSetting("assessment");
     $this->linecolor = strlen($assessmentSetting->get("imap_line_color")) ? "#" . $assessmentSetting->get("imap_line_color") : "#FF0000";
 }
 /**
  * called by prepare output
  */
 function setTitleAndDescription()
 {
     parent::setTitleAndDescription();
     if ($_GET["q_id"] > 0) {
         include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
         $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
         if ($q_gui->object instanceof assQuestion) {
             $q_gui->object->setObjId($this->object->getId());
             $title = $q_gui->object->getTitle();
             if (!$title) {
                 $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType());
             }
             $this->tpl->setTitle($title);
             $this->tpl->setDescription($q_gui->object->getComment());
             if ($this->object instanceof ilObjectPlugin) {
                 $this->tpl->setTitleIcon($this->object->plugin->getImagePath("icon_" . $this->object->getType() . ".svg"), $this->lng->txt("obj_" . $this->object->getType()));
             } else {
                 $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType()));
             }
         } else {
             // Workaround for context issues: If no object was found, redirect without q_id parameter
             $this->ctrl->setParameter($this, 'q_id', '');
             $this->ctrl->redirect($this);
         }
     } else {
         $this->tpl->setTitle($this->object->getTitle());
         $this->tpl->setDescription($this->object->getLongDescription());
         $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType()));
     }
 }
 /**
  * Saves the feedback for a single choice question
  *
  * @access public
  */
 function saveFeedback()
 {
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $errors = $this->feedback(true);
     $this->object->saveFeedbackGeneric(0, $_POST["feedback_incomplete"]);
     $this->object->saveFeedbackGeneric(1, $_POST["feedback_complete"]);
     foreach ($this->object->getErrorData() as $index => $answer) {
         $this->object->saveFeedbackSingleAnswer($index, $_POST["feedback_answer_{$index}"]);
     }
     $this->object->cleanupMediaObjectUsage();
     parent::saveFeedback();
 }
 public function handleToolbarCommand()
 {
     global $ilCtrl;
     include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
     if ($_REQUEST['qtype']) {
         include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
         $questionType = ilObjQuestionPool::getQuestionTypeByTypeId($_REQUEST['qtype']);
     } elseif ($_REQUEST['sel_question_types']) {
         $questionType = $_REQUEST['sel_question_types'];
     }
     if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled()) {
         $addContEditMode = $_POST['add_quest_cont_edit_mode'];
     } else {
         $addContEditMode = assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT;
     }
     $q_gui =& assQuestionGUI::_getQuestionGUI($questionType);
     // CHECK THIS !!! --> obj or ref id ???
     $q_gui->object->setObjId($_GET['ref_id']);
     $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
     $q_gui->object->createNewQuestion();
     $previousQuestionId = $_REQUEST['position'];
     switch ($_REQUEST['usage']) {
         case 3:
             // existing pool
             $ilCtrl->setParameterByClass('ilobjtestgui', 'sel_qpl', $_REQUEST['sel_qpl']);
             $ilCtrl->setParameterByClass('ilobjtestgui', 'sel_question_types', $questionType);
             $ilCtrl->setParameterByClass('ilobjtestgui', 'q_id', $q_gui->object->getId());
             $ilCtrl->setParameterByClass('ilobjtestgui', 'prev_qid', $previousQuestionId);
             if ($_REQUEST['test_express_mode']) {
                 $ilCtrl->setParameterByClass('ilobjtestgui', 'test_express_mode', 1);
             }
             $ilCtrl->setParameterByClass('ilobjtestgui', 'usage', 3);
             $ilCtrl->setParameterByClass('ilobjtestgui', 'calling_test', $this->test_object->getId());
             $link = $ilCtrl->getLinkTargetByClass('ilobjtestgui', 'executeCreateQuestion', false, false, false);
             ilUtil::redirect($link);
             break;
         case 2:
             // new pool
             $ilCtrl->setParameterByClass('ilobjtestgui', 'txt_qpl', $_REQUEST['txt_qpl']);
             $ilCtrl->setParameterByClass('ilobjtestgui', 'sel_question_types', $questionType);
             $ilCtrl->setParameterByClass('ilobjtestgui', 'q_id', $q_gui->object->getId());
             $ilCtrl->setParameterByClass('ilobjtestgui', 'prev_qid', $previousQuestionId);
             if ($_REQUEST['test_express_mode']) {
                 $ilCtrl->setParameterByClass('ilobjtestgui', 'test_express_mode', 1);
             }
             $ilCtrl->setParameterByClass('ilobjtestgui', 'usage', 2);
             $ilCtrl->setParameterByClass('ilobjtestgui', 'calling_test', $this->test_object->getId());
             $link = $ilCtrl->getLinkTargetByClass('ilobjtestgui', 'executeCreateQuestion', false, false, false);
             ilUtil::redirect($link);
             break;
         case 1:
             // no pool
         // no pool
         default:
             $this->redirectToQuestionEditPage($questionType, $q_gui->object->getId(), $previousQuestionId);
             break;
     }
 }
 /**
  * Saves the feedback for the question
  *
  * @access public
  */
 function saveFeedback()
 {
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $errors = $this->feedback(true);
     $this->object->saveFeedbackGeneric(0, $_POST["feedback_incomplete"]);
     $this->object->saveFeedbackGeneric(1, $_POST["feedback_complete"]);
     $this->object->cleanupMediaObjectUsage();
     parent::saveFeedback();
 }
Beispiel #15
0
 /**
  * Creates a question gui representation
  *
  * Creates a question gui representation and returns the alias to the question gui
  *
  * @param string $question_type The question type as it is used in the language database
  * @param integer $question_id The database ID of an existing question to load it into assQuestionGUI
  * @return object The alias to the question object
  * @access public
  *
  * @deprecated: WTF is this? GUIobject::question should be a GUIobject !? WTF is a question alias !?
  */
 function &createQuestionGUI($question_type, $question_id = -1)
 {
     include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
     $this->question =& assQuestionGUI::_getQuestionGUI($question_type, $question_id);
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $ilCtrl, $ilTabs, $lng, $ilAccess, $tpl;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     //$this->ctrl->addTab("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
     //	, "view", "ilEditClipboardGUI");
     $this->getTabs();
     $ilCtrl->setReturn($this, "edit");
     //echo "-".$next_class."-";
     switch ($next_class) {
         case 'ilmdeditorgui':
             //$this->setTabs();
             $ilTabs->setTabActive("meta_data");
             include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->meta_data_rep_obj_id, $this->meta_data_sub_obj_id, $this->meta_data_type);
             if (is_object($this->meta_data_observer_obj)) {
                 $md_gui->addObserver($this->meta_data_observer_obj, $this->meta_data_observer_func, "General");
             }
             $this->ctrl->forwardCommand($md_gui);
             break;
         case "ileditclipboardgui":
             //$this->tabs_gui->clearTargets();
             //$this->ctrl->setReturn($this, "view");
             $clip_gui = new ilEditClipboardGUI();
             $clip_gui->setPageBackTitle($this->page_back_title);
             //$ret =& $clip_gui->executeCommand();
             $ret =& $this->ctrl->forwardCommand($clip_gui);
             break;
             // notes
         // notes
         case "ilnotegui":
             switch ($_GET["notes_mode"]) {
                 default:
                     $html = $this->edit();
                     $ilTabs->setTabActive("edit");
                     return $html;
             }
             break;
         case 'ilpublicuserprofilegui':
             require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
             $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
             $ret = $this->ctrl->forwardCommand($profile_gui);
             break;
         case "ilpageeditorgui":
             if (!$this->getEnableEditing()) {
                 ilUtil::sendFailure($lng->txt("permission_denied"), true);
                 $ilCtrl->redirect($this, "preview");
             }
             $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
             $page_editor->setLocator($this->locator);
             $page_editor->setHeader($this->getHeader());
             $page_editor->setPageBackTitle($this->page_back_title);
             $page_editor->setIntLinkReturn($this->int_link_return);
             //$page_editor->executeCommand();
             $ret =& $this->ctrl->forwardCommand($page_editor);
             break;
         case 'ilnewsitemgui':
             include_once "./Services/News/classes/class.ilNewsItemGUI.php";
             $news_item_gui = new ilNewsItemGUI();
             $news_item_gui->setEnableEdit(true);
             $news_item_gui->setContextObjId($this->news_obj_id);
             $news_item_gui->setContextObjType($this->news_obj_type);
             $news_item_gui->setContextSubObjId($this->obj->getId());
             $news_item_gui->setContextSubObjType("pg");
             $ret = $ilCtrl->forwardCommand($news_item_gui);
             break;
             $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
             $ret = $this->ctrl->forwardCommand($profile_gui);
             break;
         case "ilpropertyformgui":
             include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
             $form = $this->initOpenedContentForm();
             $this->ctrl->forwardCommand($form);
             break;
         case "ilinternallinkgui":
             $this->lng->loadLanguageModule("content");
             require_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
             $link_gui = new ilInternalLinkGUI("Media_Media", 0);
             //$link_gui->filterLinkType("RepositoryItem");
             $link_gui->filterLinkType("PageObject_FAQ");
             $link_gui->filterLinkType("GlossaryItem");
             $link_gui->filterLinkType("Media_Media");
             $link_gui->filterLinkType("Media_FAQ");
             $link_gui->setFilterWhiteList(true);
             $link_gui->setMode("asynch");
             $ilCtrl->forwardCommand($link_gui);
             break;
         case "ilquestioneditgui":
             $this->setQEditTabs("question");
             include_once "./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php";
             $edit_gui = new ilQuestionEditGUI();
             $edit_gui->setPageConfig($this->getPageConfig());
             //			    $edit_gui->addNewIdListener($this, "setNewQuestionId");
             $edit_gui->setSelfAssessmentEditingMode(true);
             $ret = $ilCtrl->forwardCommand($edit_gui);
             $this->tpl->setContent($ret);
             break;
         case 'ilassquestionfeedbackeditinggui':
             $this->onFeedbackEditingForwarding();
             // set tabs
             $this->setQEditTabs("feedback");
             // load required lang mods
             $lng->loadLanguageModule("assessment");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
             $questionGUI = assQuestionGUI::_getQuestionGUI(assQuestion::_getQuestionType((int) $_GET['q_id']), (int) $_GET['q_id']);
             $questionGUI->object->setObjId(0);
             $questionGUI->object->setSelfAssessmentEditingMode(true);
             $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
             // 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 "ilpagemultilanggui":
             				$ilCtrl->setReturn($this, "edit");
             				include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
             				$ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
             					$this->getPageConfig()->getSinglePageMode());
             				//$this->setTabs("settings");
             				//$this->setSubTabs("cont_multilinguality");
             				$ret = $this->ctrl->forwardCommand($ml_gui);
             				break;*/
         /*			case "ilpagemultilanggui":
         				$ilCtrl->setReturn($this, "edit");
         				include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
         				$ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
         					$this->getPageConfig()->getSinglePageMode());
         				//$this->setTabs("settings");
         				//$this->setSubTabs("cont_multilinguality");
         				$ret = $this->ctrl->forwardCommand($ml_gui);
         				break;*/
         default:
             $cmd = $this->ctrl->getCmd("preview");
             $ret = $this->{$cmd}();
             break;
     }
     //echo "+$ret+";
     return $ret;
 }
Beispiel #17
0
 /**
  * Modify page content after xsl
  *
  * @param string $a_output
  * @return string
  */
 function modifyPageContentPostXsl($a_output, $a_mode)
 {
     global $lng;
     if ($this->getPage()->getPageConfig()->getEnableSelfAssessment()) {
         // #14154
         $q_ids = $this->getPage()->getQuestionIds();
         if (sizeof($q_ids)) {
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             foreach ($q_ids as $q_id) {
                 $q_gui = assQuestionGUI::_getQuestionGUI("", $q_id);
                 if (!$q_gui->object->isComplete()) {
                     $a_output = str_replace("{{{{{Question;il__qst_" . $q_id . "}}}}}", "<i>" . $lng->txt("cont_empty_question") . "</i>", $a_output);
                 }
             }
             // this exports the questions which is needed below
             $qhtml = $this->getQuestionJsOfPage($a_mode == "edit" ? true : false, $a_mode);
             require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
             $a_output = "<script>" . ilQuestionExporter::questionsJS($q_ids) . "</script>" . $a_output;
             if (!self::$initial_done) {
                 $a_output = "<script>var ScormApi=null; var questions = new Array();</script>" . $a_output;
                 self::$initial_done = true;
             }
         }
     } else {
         // set by T&A components
         $qhtml = $this->getPage()->getPageConfig()->getQuestionHTML();
     }
     if (is_array($qhtml)) {
         foreach ($qhtml as $k => $h) {
             $a_output = str_replace("{{{{{Question;il__qst_{$k}" . "}}}}}", " " . $h, $a_output);
         }
     }
     return $a_output;
 }
 /**
  * fill row 
  *
  * @access public
  * @param
  * @return
  */
 public function fillRow($data)
 {
     global $ilUser, $ilAccess;
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
     $class = strtolower(assQuestionGUI::_getGUIClassNameForId($data["question_id"]));
     $this->ctrl->setParameterByClass("ilpageobjectgui", "q_id", $data["question_id"]);
     $this->ctrl->setParameterByClass($class, "q_id", $data["question_id"]);
     $points = 0;
     if (!$this->confirmdelete) {
         $this->tpl->setCurrentBlock('checkbox');
         $this->tpl->setVariable('CB_QUESTION_ID', $data["question_id"]);
         $this->tpl->parseCurrentBlock();
         if ($this->getEditable()) {
             $this->tpl->setCurrentBlock("edit_link");
             $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
             $this->tpl->setVariable("LINK_EDIT", $this->ctrl->getLinkTargetByClass("ilpageobjectgui", "edit"));
             $this->tpl->parseCurrentBlock();
         }
         if ($data["complete"] == 0) {
             $this->tpl->setCurrentBlock("qpl_warning");
             $this->tpl->setVariable("IMAGE_WARNING", ilUtil::getImagePath("warning.png"));
             $this->tpl->setVariable("ALT_WARNING", $this->lng->txt("warning_question_not_complete"));
             $this->tpl->setVariable("TITLE_WARNING", $this->lng->txt("warning_question_not_complete"));
             $this->tpl->parseCurrentBlock();
         } else {
             $points = $data["points"];
         }
         $this->totalPoints += $points;
         foreach ($this->getSelectedColumns() as $c) {
             if (strcmp($c, 'points') == 0) {
                 $this->tpl->setCurrentBlock('points');
                 $this->tpl->setVariable("QUESTION_POINTS", $points);
                 $this->tpl->parseCurrentBlock();
             }
             if (strcmp($c, 'statistics') == 0) {
                 $this->tpl->setCurrentBlock('statistics');
                 $this->tpl->setVariable("LINK_ASSESSMENT", $this->ctrl->getLinkTargetByClass($class, "assessment"));
                 $this->tpl->setVariable("TXT_ASSESSMENT", $this->lng->txt("statistics"));
                 include_once "./Services/Utilities/classes/class.ilUtil.php";
                 $this->tpl->setVariable("IMG_ASSESSMENT", ilUtil::getImagePath("assessment.gif", "Modules/TestQuestionPool"));
                 $this->tpl->parseCurrentBlock();
             }
             if (strcmp($c, 'author') == 0) {
                 $this->tpl->setCurrentBlock('author');
                 $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]);
                 $this->tpl->parseCurrentBlock();
             }
             if (strcmp($c, 'created') == 0) {
                 $this->tpl->setCurrentBlock('created');
                 $this->tpl->setVariable('QUESTION_CREATED', ilDatePresentation::formatDate(new ilDateTime($data['created'], IL_CAL_UNIX)));
                 $this->tpl->parseCurrentBlock();
             }
             if (strcmp($c, 'tstamp') == 0) {
                 $this->tpl->setCurrentBlock('updated');
                 $this->tpl->setVariable('QUESTION_UPDATED', ilDatePresentation::formatDate(new ilDateTime($data['tstamp'], IL_CAL_UNIX)));
                 $this->tpl->parseCurrentBlock();
             }
         }
         $this->tpl->setCurrentBlock('preview');
         $this->tpl->setVariable("TXT_PREVIEW", $this->lng->txt("preview"));
         $this->tpl->setVariable("LINK_PREVIEW", $this->ctrl->getLinkTargetByClass("ilpageobjectgui", "preview"));
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock('hidden');
         $this->tpl->setVariable('HIDDEN_QUESTION_ID', $data["question_id"]);
         $this->tpl->parseCurrentBlock();
     }
     foreach ($this->getSelectedColumns() as $c) {
         if (strcmp($c, 'description') == 0) {
             $this->tpl->setCurrentBlock('description');
             $this->tpl->setVariable("QUESTION_COMMENT", strlen($data["description"]) ? $data["description"] : "&nbsp;");
             $this->tpl->parseCurrentBlock();
         }
         if (strcmp($c, 'type') == 0) {
             $this->tpl->setCurrentBlock('type');
             $this->tpl->setVariable("QUESTION_TYPE", assQuestion::_getQuestionTypeName($data["type_tag"]));
             $this->tpl->parseCurrentBlock();
         }
     }
     $this->tpl->setVariable('QUESTION_ID', $data["question_id"]);
     $this->tpl->setVariable("QUESTION_TITLE", $data["title"]);
 }
 function addBasicQuestionFormProperties(ilPropertyFormGUI $form)
 {
     parent::addBasicQuestionFormProperties($form);
     $form->getItemByPostVar('question')->setInitialRteWidth('100');
 }
 /**
  * Export HTML pages of SCO
  */
 function exportHTMLPageObjects($a_inst, $a_target_dir, &$expLog, $mode, $a_asset_type = "sco", $a_one_file = "", $a_sco_tpl = null)
 {
     global $tpl, $ilCtrl, $ilBench, $ilLog, $lng;
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
     include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php";
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $output = "";
     $tree = new ilTree($this->slm_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     // @todo
     // Why is that much HTML code in an application class?
     // Please extract all this HTML to a tpl.<t_name>.html file and use
     // placeholders and the template engine to insert data.
     //
     // There copy/paste code residenting in ilSCORM2004ScoGUI. This
     // should be merged.
     //
     // alex, 4 Apr 09
     //
     //		if ($a_one_file == "")
     //		{
     $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
     //		}
     //		else
     //		{
     //			$sco_tpl = $a_sco_tpl;
     //		}
     if ($mode != 'pdf' && $a_one_file == "") {
         include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
         $pg_exp = new ilCOPageHTMLExport($a_target_dir);
         $pg_exp->getPreparedMainTemplate($sco_tpl);
         // init and question lang vars
         $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->slm_id);
         $sco_tpl->setCurrentBlock("init");
         include_once "./Services/COPage/classes/class.ilPCQuestion.php";
         $sco_tpl->setVariable("TXT_INIT_CODE", ilPCQuestion::getJSTextInitCode($lk));
         $sco_tpl->parseCurrentBlock();
         // (additional) style sheets needed
         $styles = array("./css/yahoo/container.css", "./css/question_handling.css");
         foreach ($styles as $style) {
             $sco_tpl->setCurrentBlock("css_file");
             $sco_tpl->setVariable("CSS_FILE", $style);
             $sco_tpl->parseCurrentBlock();
         }
         // (additional) scripts needed
         $scripts = array("./js/scorm.js", "./js/pager.js", "./js/pure.js", "./js/questions_" . $this->getId() . ".js");
         foreach ($scripts as $script) {
             $sco_tpl->setCurrentBlock("js_file");
             $sco_tpl->setVariable("JS_FILE", $script);
             $sco_tpl->parseCurrentBlock();
         }
         if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset") {
             self::renderNavigation($sco_tpl, "./images/spacer.png", $lk);
         }
         $sco_tpl->touchBlock("finish");
     }
     // render head
     $sco_tpl->setCurrentBlock("head");
     $sco_tpl->setVariable("SCO_TITLE", $this->getTitle());
     $sco_tpl->parseCurrentBlock();
     $sco_tpl->touchBlock("tail");
     // meta page (meta info at SCO beginning)
     self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode);
     if ($a_one_file != "") {
         fputs($a_one_file, "<a name='sco" . $this->getId() . "'></a>");
         fputs($a_one_file, $sco_tpl->get("meta_page"));
     }
     //notify Question Exporter of new SCO
     require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
     ilQuestionExporter::indicateNewSco();
     // init export (this initialises glossary template)
     ilSCORM2004PageGUI::initExport();
     $terms = array();
     $terms = $this->getGlossaryTermIds();
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php";
     $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
     $sco_q_ids = array();
     foreach ($pages as $page) {
         //echo(print_r($page));
         $page_obj = new ilSCORM2004PageGUI($this->getType(), $page["obj_id"], 0, $this->slm_object->getId());
         $page_obj->setPresentationTitle($page["title"]);
         $page_obj->setOutputMode(IL_PAGE_OFFLINE);
         $page_obj->setStyleId($this->slm_object->getStyleSheetId());
         if (count($terms) > 1) {
             $page_obj->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $this);
         }
         $page_output = $page_obj->showPage("export");
         // collect media objects
         $mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false);
         foreach ($mob_ids as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
             $media_obj = new ilObjMediaObject($mob_id);
             if ($media_obj->hasFullscreenItem()) {
                 $media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject());
             }
         }
         // collect glossary items
         $int_links = $page_obj->getPageObject()->getInternalLinks(true);
         include_once "./Services/Link/classes/class.ilInternalLink.php";
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         if (is_array($int_links)) {
             foreach ($int_links as $k => $e) {
                 // glossary link
                 if ($e["Type"] == "GlossaryItem") {
                     $karr = explode(":", $k);
                     $tid = ilInternalLink::_extractObjIdOfTarget($karr[0]);
                     $dids = ilGlossaryDefinition::getDefinitionList($tid);
                     foreach ($dids as $did) {
                         include_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                         $def_pg = new ilGlossaryDefPage($did["id"]);
                         $def_pg->buildDom();
                         $mob_ids = $def_pg->collectMediaObjects(false);
                         foreach ($mob_ids as $mob_id) {
                             $this->mob_ids[$mob_id] = $mob_id;
                             //echo "<br>-$mob_id-";
                             $media_obj = new ilObjMediaObject($mob_id);
                             if ($media_obj->hasFullscreenItem()) {
                                 $media_obj->exportMediaFullscreen($a_target_dir, $def_pg);
                             }
                         }
                         include_once "./Services/COPage/classes/class.ilPCFileList.php";
                         $file_ids = ilPCFileList::collectFileItems($def_pg, $def_pg->getDomDoc());
                         foreach ($file_ids as $file_id) {
                             $this->file_ids[$file_id] = $file_id;
                         }
                     }
                 }
             }
         }
         //exit;
         // collect all file items
         include_once "./Services/COPage/classes/class.ilPCFileList.php";
         $file_ids = ilPCFileList::collectFileItems($page_obj->getSCORM2004Page(), $page_obj->getSCORM2004Page()->getDomDoc());
         foreach ($file_ids as $file_id) {
             $this->file_ids[$file_id] = $file_id;
         }
         if ($mode == 'pdf') {
             include_once "./Services/COPage/classes/class.ilPCQuestion.php";
             $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $q_id) {
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
                 $q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id);
                 $q_gui->outAdditionalOutput();
                 $html = $q_gui->getPreview(TRUE);
                 $page_output = preg_replace("/{{{{{Question;il__qst_" . $q_id . "}}}}}/i", $html, $page_output);
             }
             $sco_tpl->touchBlock("pdf_pg_break");
         }
         $sco_tpl->setCurrentBlock("page");
         $sco_tpl->setVariable("PAGE", $page_output);
         $sco_tpl->parseCurrentBlock();
         // get all question ids of the sco
         if ($a_one_file != "") {
             include_once "./Services/COPage/classes/class.ilPCQuestion.php";
             $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $i) {
                 if (!in_array($i, $sco_q_ids)) {
                     $sco_q_ids[] = $i;
                 }
             }
         }
     }
     // glossary
     if ($mode != 'pdf') {
         $sco_tpl->setVariable("GLOSSARY_HTML", ilSCORM2004PageGUI::getGlossaryHTML($this));
     }
     if ($a_one_file == "") {
         $output = $sco_tpl->get();
     } else {
         $output = $sco_tpl->get("page");
     }
     if ($mode == 'pdf') {
         $output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\\/div>/i", "<h2>\$1</h2>", $output);
     }
     //$output = preg_replace("/\.\/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output);
     $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_mob_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/files\\/file_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_file_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/Services\\/MediaObjects\\/flash_mp3_player/i", "./players", $output);
     //		$output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","./players",$output);
     $output = preg_replace("/file=..\\/..\\/..\\/.\\//i", "file=../", $output);
     if ($mode != 'pdf') {
         $output = preg_replace_callback("/href=\"&mob_id=(\\d+)&pg_id=(\\d+)\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         // this one is for fullscreen in glossary entries
         $output = preg_replace_callback("/href=\"fullscreen_(\\d+)\\.html\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output);
         //			$output = preg_replace("/&#123;/","",$output);
         //			$output = preg_replace("/&#125;/","",$output);
         $q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js');
         fputs(fopen($a_target_dir . '/js/questions_' . $this->getId() . '.js', 'w+'), ilQuestionExporter::questionsJS() . $q_handling);
         copy("./Modules/Scorm2004/templates/default/question_handling.css", $a_target_dir . '/css/question_handling.css');
         // hack to get the question js into the file and to display the correct answers
         if ($a_one_file != "") {
             $output = '<script type="text/javascript">' . ilQuestionExporter::questionsJS() . '</script>' . $output;
             if (count($sco_q_ids) > 0) {
                 $output .= '<script type="text/javascript">';
                 foreach ($sco_q_ids as $i) {
                     if ($i > 0) {
                         $output .= "ilias.questions.showCorrectAnswers(" . $i . "); \n";
                     }
                 }
                 $output .= '</script>';
             }
         }
         foreach (ilQuestionExporter::getMobs() as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
         }
     }
     $this->q_media = ilQuestionExporter::getFiles();
     //questions export end
     if ($a_one_file != "") {
         fputs($a_one_file, $output);
     } else {
         fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
     }
     $this->exportFileItems($a_target_dir, $expLog);
 }
 /**
  * Returns if the question type is allowed for adjustments in the global test administration.
  * 
  * @param assQuestionGUI $question_object
  * @return bool
  */
 protected function allowedInAdjustment(\assQuestionGUI $question_object)
 {
     $setting = new ilSetting('assessment');
     $types = explode(',', $setting->get('assessment_scoring_adjustment'));
     require_once './Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
     $type_def = array();
     foreach ($types as $type) {
         $type_def[$type] = ilObjQuestionPool::getQuestionTypeByTypeId($type);
     }
     $type = $question_object->getQuestionType();
     if (in_array($type, $type_def)) {
         return true;
     }
     return false;
 }
Beispiel #22
0
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilAccess, $ilNavigationHistory, $ilCtrl, $ilErr, $tpl, $lng, $ilTabs, $ilPluginAdmin, $ilDB, $tree, $ilias, $ilUser;
     if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
     }
     $cmd = $this->ctrl->getCmd("infoScreen");
     $cmdsDisabledDueToOfflineStatus = array('resumePlayer', 'resumePlayer', 'outUserResultsOverview', 'outUserListOfAnswerPasses');
     if (!$this->getCreationMode() && !$this->object->isOnline() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) {
         $cmd = 'infoScreen';
     }
     $next_class = $this->ctrl->getNextClass($this);
     $this->ctrl->setReturn($this, "infoScreen");
     if (method_exists($this->object, "getTestStyleLocation")) {
         $this->tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
     }
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"], "tst");
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             require_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $this->setLocator();
                 $this->tpl->getStandardTemplate();
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']);
                 $ret = $this->ctrl->forwardCommand($pp);
                 $this->tpl->show();
                 exit;
             }
         }
     }
     // elba hack for storing question id for inserting new question after
     if ($_REQUEST['prev_qid']) {
         global $___prev_question_id;
         $___prev_question_id = $_REQUEST['prev_qid'];
         $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
     }
     if (!$this->getCreationMode() && $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken()) {
         if (!$this->isValidRequestOnBrokenQuestionSetDepencies($next_class, $cmd)) {
             $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
         }
     }
     $this->determineObjectiveOrientedContainer();
     switch ($next_class) {
         case 'iltestexportgui':
             if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestExportGUI.php';
             $ilCtrl->forwardCommand(new ilTestExportGUI($this));
             break;
         case "ilinfoscreengui":
             $this->prepareOutput();
             $this->addHeaderAction();
             $this->infoScreen();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             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');
             $this->ctrl->forwardCommand($md_gui);
             break;
         case "iltestplayerfixedquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerFixedQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerFixedQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestplayerrandomquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerRandomQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerRandomQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestplayerdynamicquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerDynamicQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestevaluationgui":
             $this->forwardToEvaluationGUI();
             break;
         case "iltestevalobjectiveorientedgui":
             $this->forwardToEvalObjectiveOrientedGUI();
             break;
         case "iltestservicegui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
             $serviceGUI =& new ilTestServiceGUI($this->object);
             $this->ctrl->forwardCommand($serviceGUI);
             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);
             break;
         case "illearningprogressgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
             $this->ctrl->forwardCommand($new_gui);
             break;
         case "ilcertificategui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
             require_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
             $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object));
             $this->ctrl->forwardCommand($output_gui);
             break;
         case "iltestscoringgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Modules/Test/classes/class.ilTestScoringGUI.php";
             $output_gui = new ilTestScoringGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilmarkschemagui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
                 $this->ctrl->redirect($this, 'infoScreen');
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilMarkSchemaGUI.php';
             $mark_schema_gui = new ilMarkSchemaGUI($this->object);
             $this->ctrl->forwardCommand($mark_schema_gui);
             break;
         case 'iltestscoringbyquestionsgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once 'Modules/Test/classes/class.ilTestScoringByQuestionsGUI.php';
             $output_gui = new ilTestScoringByQuestionsGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilobjtestsettingsgeneralgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
             $gui = new ilObjTestSettingsGeneralGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $ilUser, $this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjtestsettingsscoringresultsgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
             $gui = new ilObjTestSettingsScoringResultsGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjtestdynamicquestionsetconfiggui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfigGUI.php';
             $gui = new ilObjTestDynamicQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestrandomquestionsetconfiggui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfigGUI.php';
             $gui = new ilTestRandomQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestquestionbrowsertablegui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
             $gui = new ilTestQuestionBrowserTableGUI($this->ctrl, $this->tpl, $ilTabs, $this->lng, $tree, $ilDB, $ilPluginAdmin, $this->object);
             $gui->setWriteAccess($ilAccess->checkAccess("write", "", $this->ref_id));
             $gui->init();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskilladministrationgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestSkillAdministrationGUI.php';
             $gui = new ilTestSkillAdministrationGUI($ilias, $this->ctrl, $ilAccess, $ilTabs, $this->tpl, $this->lng, $ilDB, $tree, $ilPluginAdmin, $this->object, $this->ref_id);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskillevaluationgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
             if ($this->object->isDynamicTest()) {
                 require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
                 $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
                 $dynamicQuestionSetConfig->loadFromDb();
                 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
                 $questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId());
                 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
             } else {
                 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
                 $questionList->setParentObjId($this->object->getId());
                 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
             }
             $questionList->load();
             require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
             $testSessionFactory = new ilTestSessionFactory($this->object);
             $testSession = $testSessionFactory->getSession();
             $testResults = $this->object->getTestResult($testSession->getActiveId(), $testSession->getPass(), true);
             require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
             $gui = new ilTestSkillEvaluationGUI($this->ctrl, $ilTabs, $this->tpl, $this->lng, $ilDB, $this->object->getTestId(), $this->object->getRefId(), $this->object->getId());
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $gui->setQuestionList($questionList);
             $gui->setTestSession($testSession);
             $gui->setTestResults($testResults);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjectcopygui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('tst');
             $this->ctrl->forwardCommand($cp);
             break;
         case 'ilrepositorysearchgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
             $rep_search =& new ilRepositorySearchGUI();
             $rep_search->setCallback($this, 'addParticipantsObject', array());
             // Set tabs
             $this->ctrl->setReturn($this, 'participants');
             $ret =& $this->ctrl->forwardCommand($rep_search);
             $this->tabs_gui->setTabActive('participants');
             break;
         case 'ilpageeditorgui':
         case 'iltestexpresspageobjectgui':
             require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
             $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
             $incompleteQuestionPurger->setOwnerId($ilUser->getId());
             $incompleteQuestionPurger->purge();
             $qid = $_REQUEST['q_id'];
             // :FIXME: does not work
             // $this->ctrl->saveParameterByClass(array('iltestexpresspageobjectgui', 'assorderingquestiongui', 'ilpageeditorgui', 'ilpcquestion', 'ilpcquestiongui'), 'test_express_mode');
             if (!$qid || $qid == 'Array') {
                 $questions = $this->object->getQuestionTitlesAndIndexes();
                 if (!is_array($questions)) {
                     $questions = array();
                 }
                 $keys = array_keys($questions);
                 $qid = $keys[0];
                 $_REQUEST['q_id'] = $qid;
                 $_GET['q_id'] = $qid;
                 $_POST['q_id'] = $qid;
             }
             $this->prepareOutput();
             if (!in_array($cmd, array('addQuestion', 'browseForQuestions'))) {
                 $this->buildPageViewToolbar($qid);
             }
             if (!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions'))) {
                 require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
                 $pageObject = new ilTestExpressPageObjectGUI(0);
                 $pageObject->test_object = $this->object;
                 $ret =& $this->ctrl->forwardCommand($pageObject);
                 break;
             }
             require_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();
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui = assQuestionGUI::_getQuestionGUI("", $qid);
             if (!$q_gui instanceof assQuestionGUI) {
                 $this->ctrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', '');
                 $this->ctrl->redirectByClass('iltestexpresspageobjectgui', $this->ctrl->getCmd());
             }
             $q_gui->outAdditionalOutput();
             $q_gui->object->setObjId($this->object->getId());
             $question = $q_gui->object;
             $this->ctrl->saveParameter($this, "q_id");
             #$this->lng->loadLanguageModule("content");
             $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view");
             $this->ctrl->setReturn($this, "questions");
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
             require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
             $page_gui = new ilTestExpressPageObjectGUI($qid);
             $page_gui->test_object = $this->object;
             $page_gui->setEditPreview(true);
             $page_gui->setEnabledTabs(false);
             if (strlen($this->ctrl->getCmd()) == 0) {
                 $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($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $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() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
             $ret =& $this->ctrl->forwardCommand($page_gui);
             global $ilTabs;
             $ilTabs->activateTab('assQuestions');
             $this->tpl->setContent($ret);
             break;
         case 'ilassquestionpreviewgui':
             $this->prepareOutput();
             $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();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionpagegui':
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
             //echo $_REQUEST['prev_qid'];
             if ($_REQUEST['prev_qid']) {
                 $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->prepareOutput();
             //global $___test_express_mode;
             //$___test_express_mode = true;
             $_GET['calling_test'] = $this->object->getRefId();
             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();
             require_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");
             $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);
             if (strlen($this->ctrl->getCmd()) == 0) {
                 $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($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $page_gui->setHeader($question->getTitle());
             $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
             $ret =& $this->ctrl->forwardCommand($page_gui);
             $this->tpl->setContent($ret);
             break;
         case 'ilassspecfeedbackpagegui':
             require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php";
             $pg_gui = new ilAssSpecFeedbackPageGUI((int) $_GET["feedback_id"]);
             $this->ctrl->forwardCommand($pg_gui);
             break;
         case 'ilassgenfeedbackpagegui':
             require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php";
             $pg_gui = new ilAssGenFeedbackPageGUI((int) $_GET["feedback_id"]);
             $this->ctrl->forwardCommand($pg_gui);
             break;
         case 'illocalunitconfigurationgui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             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']));
             $this->ctrl->forwardCommand($gui);
             break;
         case "ilcommonactiondispatchergui":
             require_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionhintsgui':
             $this->prepareSubGuiOutput();
             // 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 'ilassquestionfeedbackeditinggui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             // 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 'iltesttoplistgui':
             $this->prepareOutput();
             require_once './Modules/Test/classes/class.ilTestToplistGUI.php';
             $gui = new ilTestToplistGUI($this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilscoringadjustmentgui':
             $this->prepareOutput();
             require_once './Modules/Test/classes/class.ilScoringAdjustmentGUI.php';
             $gui = new ilScoringAdjustmentGUI($this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case '':
         case 'ilobjtestgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             if (strcmp($cmd, "properties") == 0 && $_GET["browse"]) {
                 $this->questionBrowser();
                 return;
             }
             if (strcmp($cmd, "properties") == 0 && ($_GET["up"] || $_GET["down"])) {
                 $this->questionsObject();
                 return;
             }
             $cmd .= "Object";
             $ret =& $this->{$cmd}();
             break;
         default:
             // elba hack for storing question id for inserting new question after
             if ($_REQUEST['prev_qid']) {
                 global $___prev_question_id;
                 $___prev_question_id = $_REQUEST['prev_qid'];
                 $this->ctrl->setParameterByClass('ilassquestionpagegui', 'prev_qid', $_REQUEST['prev_qid']);
                 $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->create_question_mode = true;
             $this->prepareOutput();
             $this->ctrl->setReturn($this, "questions");
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($_GET['sel_question_types'], $_GET["q_id"]);
             $q_gui->object->setObjId($this->object->getId());
             if (!$_GET['sel_question_types']) {
                 $qType = assQuestion::getQuestionTypeFromDb($_GET['q_id']);
             } else {
                 $qType = $_GET['sel_question_types'];
             }
             $this->ctrl->setParameterByClass($qType . "GUI", 'prev_qid', $_REQUEST['prev_qid']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'test_ref_id', $_REQUEST['ref_id']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'q_id', $_REQUEST['q_id']);
             if ($_REQUEST['test_express_mode']) {
                 $this->ctrl->setParameterByClass($qType . "GUI", 'test_express_mode', 1);
             }
             #global $___test_express_mode;
             #$___test_express_mode = true;
             if (!$q_gui->isSaveCommand()) {
                 $_GET['calling_test'] = $this->object->getRefId();
             }
             $q_gui->setQuestionTabs();
             #unset($___test_express_mode);
             $ret =& $this->ctrl->forwardCommand($q_gui);
             break;
     }
     if (!in_array(strtolower($_GET["baseClass"]), array('iladministrationgui', 'ilrepositorygui')) && $this->getCreationMode() != true) {
         $this->tpl->show();
     }
 }
 /**
  * Get question html for page
  */
 function getQuestionHtmlOfPage()
 {
     $q_ids = $this->getPageObject()->getQuestionIds();
     $html = array();
     if (count($q_ids) > 0) {
         foreach ($q_ids as $q_id) {
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id);
             $q_gui->outAdditionalOutput();
             $html[$q_id] = $q_gui->getPreview(TRUE);
         }
     }
     return $html;
 }
 /**
  * Set tabs
  */
 function setTabs()
 {
     if ($this->getSelfAssessmentMode()) {
         return;
     }
     global $ilTabs, $ilCtrl, $lng;
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     if ($this->content_obj != "") {
         $q_ref = $this->content_obj->getQuestionReference();
     }
     if ($q_ref != "") {
         $inst_id = ilInternalLink::_extractInstOfTarget($q_ref);
         if (!($inst_id > 0)) {
             $q_id = ilInternalLink::_extractObjIdOfTarget($q_ref);
         }
     }
     $ilTabs->addTarget("question", $ilCtrl->getLinkTarget($this, "edit"), array("editQuestion", "save", "cancel", "addSuggestedSolution", "cancelExplorer", "linkChilds", "removeSuggestedSolution", "addPair", "addTerm", "delete", "deleteTerms", "editMode", "upload", "saveEdit", "uploadingImage", "uploadingImagemap", "addArea", "deletearea", "saveShape", "back", "saveEdit", "changeGapType", "createGaps", "addItem", "addYesNo", "addTrueFalse", "toggleGraphicalAnswers", "setMediaMode"), "");
     if ($q_id > 0) {
         if (assQuestion::_getQuestionType($q_id) != "assTextQuestion") {
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
             $tabCommands = assQuestionGUI::getCommandsFromClassConstants('ilAssQuestionFeedbackEditingGUI');
             $tabLink = ilUtil::appendUrlParameterString($ilCtrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW), "q_id=" . (int) $q_id);
             $ilTabs->addTarget('feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), '');
         }
     }
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilCtrl, $lng;
     $cmd = $ilCtrl->getCmd();
     $next_class = $ilCtrl->getNextClass();
     //echo "-".$cmd."-".$next_class."-".$_GET["q_id"]."-";
     switch ($next_class) {
         default:
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui = assQuestionGUI::_getQuestionGUI($this->getQuestionType(), $this->getQuestionId());
             $q_gui->object->setSelfAssessmentEditingMode($this->getSelfAssessmentEditingMode());
             $q_gui->object->setDefaultNrOfTries($this->getDefaultNrOfTries());
             if (is_object($this->page_config)) {
                 $q_gui->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
             }
             $q_gui->object->setObjId((int) $this->getPoolObjId());
             for ($i = 0; $i < $this->new_id_listener_cnt; $i++) {
                 $object =& $this->new_id_listeners[$i]["object"];
                 $method = $this->new_id_listeners[$i]["method"];
                 $parameters = $this->new_id_listeners[$i]["parameters"];
                 $q_gui->addNewIdListener($object, $method, $parameters);
                 //var_dump($object);
                 //var_dump($method);
                 //var_dump($parameters);
             }
             //$q_gui->setQuestionTabs();
             $count = $q_gui->object->isInUse();
             if ($count > 0) {
                 global $rbacsystem;
                 if ($rbacsystem->checkAccess("write", $this->pool_ref_id)) {
                     ilUtil::sendInfo(sprintf($lng->txt("qpl_question_is_in_use"), $count));
                 }
             }
             $ilCtrl->setCmdClass(get_class($q_gui));
             $ret = $ilCtrl->forwardCommand($q_gui);
             break;
     }
     return $ret;
 }
 function addSuggestedSolution()
 {
     $_SESSION["subquestion_index"] = 0;
     if ($_POST["cmd"]["addSuggestedSolution"]) {
         if ($this->writePostData()) {
             ilUtil::sendInfo($this->getErrorMessage());
             $this->editQuestion();
             return;
         }
         if (!$this->checkInput()) {
             ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
             $this->editQuestion();
             return;
         }
     }
     $this->object->saveToDb();
     $this->ctrl->setParameter($this, "q_id", $this->object->getId());
     $this->tpl->setVariable("HEADER", $this->object->getTitle());
     $this->getQuestionTemplate();
     parent::addSuggestedSolution();
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilAccess, $ilNavigationHistory, $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);
     }
     $cmd = $this->ctrl->getCmd("properties");
     $cmdsDisabledDueToOfflineStatus = array('resume', 'start', 'outUserResultsOverview', 'outUserListOfAnswerPasses');
     if (!$this->getCreationMode() && !$this->object->isOnline() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) {
         $cmd = 'infoScreen';
     }
     $next_class = $this->ctrl->getNextClass($this);
     $this->ctrl->setReturn($this, "properties");
     if (method_exists($this->object, "getTestStyleLocation")) {
         $this->tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
     }
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"], "tst");
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             include_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $this->setLocator();
                 $this->tpl->getStandardTemplate();
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']);
                 $ret = $this->ctrl->forwardCommand($pp);
                 $this->tpl->show();
                 exit;
             }
         }
     }
     // elba hack for storing question id for inserting new question after
     if ($_REQUEST['prev_qid']) {
         global $___prev_question_id;
         $___prev_question_id = $_REQUEST['prev_qid'];
         $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
     }
     switch ($next_class) {
         case "ilinfoscreengui":
             $this->prepareOutput();
             $this->addHeaderAction();
             $this->infoScreen();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             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 "iltestoutputgui":
             include_once "./Modules/Test/classes/class.ilTestOutputGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $output_gui =& new ilTestOutputGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case "iltestevaluationgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once "./Modules/Test/classes/class.ilTestEvaluationGUI.php";
             $evaluation_gui =& new ilTestEvaluationGUI($this->object);
             $this->ctrl->forwardCommand($evaluation_gui);
             break;
         case "iltestservicegui":
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
             $serviceGUI =& new ilTestServiceGUI($this->object);
             $this->ctrl->forwardCommand($serviceGUI);
             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);
             break;
         case "illearningprogressgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY, $this->object->getRefId());
             $this->ctrl->forwardCommand($new_gui);
             break;
         case "ilcertificategui":
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
             include_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
             $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object));
             $this->ctrl->forwardCommand($output_gui);
             break;
         case "iltestscoringgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once "./Modules/Test/classes/class.ilTestScoringGUI.php";
             $output_gui = new ilTestScoringGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilobjectcopygui':
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('tst');
             $this->ctrl->forwardCommand($cp);
             break;
         case 'ilrepositorysearchgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
             $rep_search =& new ilRepositorySearchGUI();
             $rep_search->setCallback($this, 'addParticipantsObject', array());
             // Set tabs
             $this->ctrl->setReturn($this, 'participants');
             $ret =& $this->ctrl->forwardCommand($rep_search);
             $this->tabs_gui->setTabActive('participants');
             break;
         case 'ilpageeditorgui':
         case 'iltestexpresspageobjectgui':
             $qid = $_REQUEST['q_id'];
             // :FIXME: does not work
             // $this->ctrl->saveParameterByClass(array('iltestexpresspageobjectgui', 'assorderingquestiongui', 'ilpageeditorgui', 'ilpcquestion', 'ilpcquestiongui'), 'test_express_mode');
             if (!$qid || $qid == 'Array') {
                 $questions = $this->object->getQuestionTitlesAndIndexes();
                 if (!is_array($questions)) {
                     $questions = array();
                 }
                 $keys = array_keys($questions);
                 $qid = $keys[0];
                 $_REQUEST['q_id'] = $qid;
                 $_GET['q_id'] = $qid;
                 $_POST['q_id'] = $qid;
             }
             $this->prepareOutput();
             if (!in_array($cmd, array('addQuestion', 'browseForQuestions'))) {
                 $this->buildPageViewToolbar($qid);
             }
             if (!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions'))) {
                 include_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
                 $pageObject = new ilTestExpressPageObjectGUI("qpl", 0);
                 $pageObject->test_object = $this->object;
                 $ret =& $this->ctrl->forwardCommand($pageObject);
                 break;
             }
             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("", $qid);
             $q_gui->outAdditionalOutput();
             $q_gui->object->setObjId($this->object->getId());
             $question =& $q_gui->object;
             $this->ctrl->saveParameter($this, "q_id");
             #$this->lng->loadLanguageModule("content");
             $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view");
             $this->ctrl->setReturn($this, "questions");
             //$page =& new ilPageObject("qpl", $_GET["q_id"]);
             include_once "./Services/COPage/classes/class.ilPageObject.php";
             include_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
             $page_gui =& new ilTestExpressPageObjectGUI("qpl", $qid);
             $page_gui->test_object = $this->object;
             $page_gui->setEditPreview(true);
             $page_gui->setEnabledTabs(false);
             $page_gui->setEnabledInternalLinks(false);
             if (strlen($this->ctrl->getCmd()) == 0) {
                 $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($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $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);
             global $ilTabs;
             $ilTabs->activateTab('assQuestions');
             $this->tpl->setContent($ret);
             break;
         case 'ilpageobjectgui':
             include_once "./Services/COPage/classes/class.ilPageObjectGUI.php";
             //echo $_REQUEST['prev_qid'];
             if ($_REQUEST['prev_qid']) {
                 $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->prepareOutput();
             //global $___test_express_mode;
             //$___test_express_mode = true;
             $_GET['calling_test'] = $this->object->getRefId();
             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) {
                 $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($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $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);
             $this->tpl->setContent($ret);
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionhintsgui':
             $this->prepareSubGuiOutput();
             // 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 'iltesttoplistgui':
             $this->prepareOutput();
             require_once 'Modules/Test/classes/class.ilTestToplistGUI.php';
             $gui = new ilTestToplistGUI($this);
             $this->ctrl->forwardCommand($gui);
             break;
         case '':
         case 'ilobjtestgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             if (preg_match("/deleteqpl_\\d+/", $cmd)) {
                 $cmd = "randomQuestions";
             }
             if (strcmp($cmd, "properties") == 0 && $_GET["browse"]) {
                 $this->questionBrowser();
                 return;
             }
             if (strcmp($cmd, "properties") == 0 && ($_GET["up"] || $_GET["down"])) {
                 $this->questionsObject();
                 return;
             }
             $cmd .= "Object";
             $ret =& $this->{$cmd}();
             break;
         default:
             // elba hack for storing question id for inserting new question after
             if ($_REQUEST['prev_qid']) {
                 global $___prev_question_id;
                 $___prev_question_id = $_REQUEST['prev_qid'];
                 $this->ctrl->setParameterByClass('ilpageobjectgui', 'prev_qid', $_REQUEST['prev_qid']);
                 $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->create_question_mode = true;
             $this->prepareOutput();
             $this->ctrl->setReturn($this, "questions");
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($_GET['sel_question_types'], $_GET["q_id"]);
             $q_gui->object->setObjId($this->object->getId());
             if (!$_GET['sel_question_types']) {
                 $qType = assQuestion::getQuestionTypeFromDb($_GET['q_id']);
             } else {
                 $qType = $_GET['sel_question_types'];
             }
             $this->ctrl->setParameterByClass($qType . "GUI", 'prev_qid', $_REQUEST['prev_qid']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'test_ref_id', $_REQUEST['ref_id']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'q_id', $_REQUEST['q_id']);
             if ($_REQUEST['test_express_mode']) {
                 $this->ctrl->setParameterByClass($qType . "GUI", 'test_express_mode', 1);
             }
             #global $___test_express_mode;
             #$___test_express_mode = true;
             if (!$q_gui->isSaveCommand()) {
                 $_GET['calling_test'] = $this->object->getRefId();
             }
             $q_gui->setQuestionTabs();
             #unset($___test_express_mode);
             $ret =& $this->ctrl->forwardCommand($q_gui);
             break;
     }
     if (strtolower($_GET["baseClass"]) != "iladministrationgui" && $this->getCreationMode() != true) {
         $this->tpl->show();
     }
 }
 private function buildQuestionPage(assQuestionGUI $questionGUI)
 {
     $this->tpl->addCss('Services/COPage/css/content.css');
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
     $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
     $pageGUI->setOutputMode("presentation");
     $pageGUI->setRenderPageContainer(true);
     $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
     $questionGUI->object->setShuffle(false);
     // dirty, but works ^^
     $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
     $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
     $pageHTML = $pageGUI->presentation();
     $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
     return $pageHTML;
 }
 /**
  * Copy question from pool into page
  *
  * @param
  * @return
  */
 function copyPoolQuestionIntoPage($a_q_id, $a_hier_id)
 {
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
     $question = assQuestion::_instanciateQuestion($a_q_id);
     $duplicate_id = $question->copyObject(0, $question->getTitle());
     $duplicate = assQuestion::_instanciateQuestion($duplicate_id);
     $duplicate->setObjId(0);
     // we remove everything not supported by the non-tiny self
     // assessment question editor
     $q = $duplicate->getQuestion();
     // we try to save all latex tags
     $try = true;
     $ls = '<span class="latex">';
     $le = '</span>';
     while ($try) {
         // search position of start tag
         $pos1 = strpos($q, $ls);
         if (is_int($pos1)) {
             $pos2 = strpos($q, $le, $pos1);
             if (is_int($pos2)) {
                 // both found: replace end tag
                 $q = substr($q, 0, $pos2) . "[/tex]" . substr($q, $pos2 + 7);
                 $q = substr($q, 0, $pos1) . "[tex]" . substr($q, $pos1 + 20);
             } else {
                 $try = false;
             }
         } else {
             $try = false;
         }
     }
     $tags = assQuestionGUI::getSelfAssessmentTags();
     $tstr = "";
     foreach ($tags as $t) {
         $tstr .= "<" . $t . ">";
     }
     $q = ilUtil::secureString($q, true, $tstr);
     // self assessment uses nl2br, not p
     $duplicate->setQuestion($q);
     $duplicate->saveQuestionDataToDb();
     $this->q_node->set_attribute("QRef", "il__qst_" . $duplicate_id);
 }
 public function showSyncCmd()
 {
     $this->questionGUI->originalSyncForm('', 'true');
 }