/**
  * show fullscreen view
  */
 function fullscreenObject()
 {
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
     $page_gui = new ilAssQuestionPageGUI($_GET["pg_id"]);
     $page_gui->showMediaFullscreen();
 }
Exemplo n.º 2
0
 /**
  * output question page
  */
 function outQuestionPage($a_temp_var, $a_postponed = false, $active_id = "", $html = "")
 {
     $this->lng->loadLanguageModule("content");
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
     $page_gui = new ilAssQuestionPageGUI($this->object->getId());
     $page_gui->setOutputMode("presentation");
     $page_gui->setTemplateTargetVar($a_temp_var);
     if (strlen($html)) {
         $page_gui->setQuestionHTML(array($this->object->getId() => $html));
     }
     $page_gui->setPresentationTitle($this->questionHeaderBlockBuilder->getHTML());
     return $page_gui->presentation();
 }
 function &executeCommand()
 {
     global $ilCtrl, $ilTabs, $ilUser, $lng;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     switch ($next_class) {
         case 'ilobjquestionpoolgui':
             $nodeParts = explode(':', $_GET['cmdNode']);
             $params = array('ref_id' => $_GET['ref_id'], 'calling_test' => $_GET['ref_id'], 'q_id' => $_GET['q_id'], 'cmd' => $_GET['cmd'], 'cmdClass' => $_GET['cmdClass'], 'cmdNode' => $nodeParts[count($nodeParts) - 2] . ':' . $nodeParts[count($nodeParts) - 1], 'baseClass' => 'ilObjQuestionPoolGUI', 'test_express_mode' => '1');
             ilUtil::redirect('ilias.php?' . http_build_query($params, null, '&'));
             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);
             $this->ctrl->saveParameterByClass('ilpageeditorgui', 'q_mode');
             $ret =& $this->ctrl->forwardCommand($page_editor);
             break;
         case '':
         case 'iltestexpresspageobjectgui':
             include_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             if ($cmd == 'view') {
                 $cmd = 'showPage';
             }
             $q_gui =& assQuestionGUI::_getQuestionGUI('', $_REQUEST["q_id"]);
             if ($q_gui->object) {
                 $obj = ilObjectFactory::getInstanceByRefId($_REQUEST['ref_id']);
                 $q_gui->object->setObjId($obj->getId());
             }
             $cmds = array('handleToolbarCommand', 'addQuestion', 'questions', 'insertQuestions', 'browseForQuestions', 'filterAvailableQuestions', 'resetfilterAvailableQuestions');
             if (in_array($cmd, $cmds)) {
                 return $this->{$cmd}();
             } elseif ($q_gui->object) {
                 $total = $this->test_object->evalTotalPersons();
                 $this->setOutputMode($total == 0 ? IL_PAGE_EDIT : IL_PAGE_PREVIEW);
                 if ($total != 0) {
                     $link = $ilCtrl->getLinkTargetByClass('ilobjtestgui', "participants");
                     $link = "<a href=\"" . $link . "\">" . $lng->txt("test_has_datasets_warning_page_view_link") . "</a>";
                     ilUtil::sendInfo($lng->txt("test_has_datasets_warning_page_view") . " " . $link);
                 }
                 if (in_array($cmd, array('view', 'showPage')) || $cmd == 'edit' && $this->test_object->evalTotalPersons()) {
                     return $this->showPage();
                 }
                 return parent::executeCommand();
             }
             break;
         default:
             $qtype = $_REQUEST['qtype'];
             $type = ilObjQuestionPool::getQuestionTypeByTypeId($qtype);
             if (!$_GET['q_id']) {
                 $q_gui = $this->addPageOfQuestions(preg_replace('/(.*?)gui/i', '$1', $_GET['sel_question_types']));
                 $q_gui->setQuestionTabs();
                 $ret = $this->ctrl->forwardCommand($q_gui);
                 break;
             }
             $this->ctrl->setReturn($this, "questions");
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($type, $_GET["q_id"]);
             if ($q_gui->object) {
                 $obj = ilObjectFactory::getInstanceByRefId($_GET['ref_id']);
                 $q_gui->object->setObjId($obj->getId());
             }
             $this->ctrl->saveParameterByClass('ilpageeditorgui', 'q_id');
             $this->ctrl->saveParameterByClass('ilpageeditorgui', 'q_mode');
             $q_gui->setQuestionTabs();
             $ret =& $this->ctrl->forwardCommand($q_gui);
             break;
     }
 }
 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;
 }
Exemplo n.º 5
0
 /**
  * output question page
  */
 function outQuestionPage($a_temp_var, $a_postponed = false, $active_id = "", $html = "")
 {
     $postponed = "";
     if ($a_postponed) {
         $postponed = " (" . $this->lng->txt("postponed") . ")";
     }
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
     $this->lng->loadLanguageModule("content");
     $page_gui = new ilAssQuestionPageGUI($this->object->getId());
     $page_gui->setTemplateTargetVar($a_temp_var);
     if (strlen($html)) {
         $page_gui->setQuestionHTML(array($this->object->getId() => $html));
     }
     $page_gui->setOutputMode("presentation");
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     $title_output = ilObjTest::_getTitleOutput($active_id);
     if ($this->object->areObligationsToBeConsidered() && ilObjTest::isQuestionObligatory($this->object->getId())) {
         $obligatoryString = ' *';
     } else {
         $obligatoryString = '';
     }
     switch ($title_output) {
         case 1:
             $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount()) . " - " . $this->object->getTitle() . $postponed . $obligatoryString);
             break;
         case 2:
             $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount()) . $postponed . $obligatoryString);
             break;
         case 0:
         default:
             $maxpoints = $this->object->getMaximumPoints();
             if ($maxpoints == 1) {
                 $maxpoints = " (" . $maxpoints . " " . $this->lng->txt("point") . ")";
             } else {
                 $maxpoints = " (" . $maxpoints . " " . $this->lng->txt("points") . ")";
             }
             $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount()) . " - " . $this->object->getTitle() . $postponed . $maxpoints . $obligatoryString);
             break;
     }
     $presentation = $page_gui->presentation();
     if (strlen($maxpoints)) {
         $presentation = str_replace($maxpoints, "<em>{$maxpoints}</em>", $presentation);
     }
     // bugfix for non XHTML conform img tags in ILIAS Learning Module Editor
     $presentation = preg_replace("/src=\".\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $presentation);
     return $presentation;
 }
Exemplo n.º 6
0
 /**
  * output question page
  */
 function outQuestionPage($a_temp_var, $a_postponed = false, $active_id = "", $html = "")
 {
     $postponed = "";
     if ($a_postponed) {
         $postponed = " (" . $this->lng->txt("postponed") . ")";
     }
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
     $this->lng->loadLanguageModule("content");
     $page_gui = new ilAssQuestionPageGUI($this->object->getId());
     $page_gui->setTemplateTargetVar($a_temp_var);
     if (strlen($html)) {
         $page_gui->setQuestionHTML(array($this->object->getId() => $html));
     }
     $page_gui->setOutputMode("presentation");
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     $title_output = ilObjTest::_getTitleOutput($active_id);
     if ($this->object->areObligationsToBeConsidered() && ilObjTest::isQuestionObligatory($this->object->getId())) {
         $obligatoryString = '([-_-])';
     } else {
         $obligatoryString = '';
     }
     switch ($title_output) {
         case 1:
             $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount()) . " - " . $this->object->getTitle() . $postponed . $obligatoryString);
             break;
         case 2:
             $page_gui->setPresentationTitle(sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount()) . $postponed . $obligatoryString);
             break;
         case 0:
         default:
             if (!is_null($this->questionHeaderBlockBuilder)) {
                 $questionBlockHeader = $this->questionHeaderBlockBuilder->getHTML();
             } else {
                 $maxpoints = $this->object->getMaximumPoints();
                 if ($maxpoints == 1) {
                     $maxpoints = " (" . $maxpoints . " " . $this->lng->txt("point") . ")";
                 } else {
                     $maxpoints = " (" . $maxpoints . " " . $this->lng->txt("points") . ")";
                 }
                 $questionBlockHeader = sprintf($this->lng->txt("tst_position"), $this->getSequenceNumber(), $this->getQuestionCount()) . " - " . $this->object->getTitle() . $postponed . $maxpoints . $obligatoryString;
             }
             $page_gui->setPresentationTitle($questionBlockHeader);
             break;
     }
     $presentation = $page_gui->presentation();
     if (strlen($maxpoints)) {
         $presentation = str_replace($maxpoints, "<em>{$maxpoints}</em>", $presentation);
     }
     if (strlen($obligatoryString)) {
         $replacement = '<br><span class="obligatory" style="font-size:small">' . $this->lng->txt("tst_you_have_to_answer_this_question") . '</span>';
         $presentation = str_replace($obligatoryString, $replacement, $presentation);
     }
     $presentation = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $presentation);
     return $presentation;
 }
 private function populateSolutionOutput(ilTemplate $tpl)
 {
     // FOR WHAT EXACTLY IS THIS USEFUL?
     $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
     $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
     $pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
     $pageGUI->setEditPreview(true);
     $pageGUI->setEnabledTabs(false);
     // FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
     if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) {
         $this->ctrl->setCmdClass(get_class($pageGUI));
         $this->ctrl->setCmd('preview');
     }
     $this->questionGUI->setPreviewSession($this->previewSession);
     $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0)));
     //$pageGUI->setHeader($this->questionOBJ->getTitle()); // NO ADDITIONAL HEADER
     //$pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
     //$pageGUI->setTemplateTargetVar("ADM_CONTENT"); // NOT REQUIRED, OR IS?
     $tpl->setCurrentBlock('solution_output');
     $tpl->setVariable('SOLUTION_OUTPUT', $pageGUI->preview());
     $tpl->parseCurrentBlock();
 }