protected function getTestSequence($activeId, $pass) { $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass); $testSequence->loadFromDb(); $testSequence->loadQuestions(); $testSequence->setConsiderHiddenQuestionsEnabled(true); $testSequence->setConsiderOptionalQuestionsEnabled(true); return $testSequence; }
/** * Creates an output of the solution of an answer compared to the correct solution * * @access public */ protected function outCorrectSolution() { if (!$this->object->getShowSolutionDetails()) { ilUtil::sendInfo($this->lng->txt("no_permission"), true); $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); } $testSession = $this->testSessionFactory->getSession(); $activeId = $testSession->getActiveId(); if (!($activeId > 0)) { $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); } $this->ctrl->saveParameter($this, "pass"); $pass = (int) $_GET['pass']; $questionId = (int) $_GET['evaluation']; if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass); $testSequence->loadFromDb(); $testSequence->loadQuestions(); require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php'; $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession); $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence); $objectivesList->loadObjectivesTitles(); } else { $objectivesList = null; } global $ilTabs; if ($this instanceof ilTestEvalObjectiveOrientedGUI) { $ilTabs->setBackTarget($this->lng->txt("tst_back_to_virtual_pass"), $this->ctrl->getLinkTarget($this, 'showVirtualPass')); } else { $ilTabs->setBackTarget($this->lng->txt("tst_back_to_pass_details"), $this->ctrl->getLinkTarget($this, 'outUserPassDetails')); } include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print"); if ($this->object->getShowSolutionAnswersOnly()) { $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print"); } $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList); $this->tpl->setContent($solution); }
public static function isParticipantsLastPassActive($testRefId, $userId) { global $ilDB, $lng, $ilPluginAdmin; /* @var ilObjTest $testOBJ */ $testOBJ = ilObjectFactory::getInstanceByRefId($testRefId, false); $activeId = $testOBJ->getActiveIdOfUser($userId); require_once 'Modules/Test/classes/class.ilTestSessionFactory.php'; $testSessionFactory = new ilTestSessionFactory($testOBJ); // Added temporarily bugfix smeyer $testSessionFactory->reset(); require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php'; $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $testOBJ); $testSession = $testSessionFactory->getSession($activeId); $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $testSession->getPass()); $testSequence->loadFromDb(); return $testSequence->hasSequence(); }