protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions) { global $ilDB, $ilPluginAdmin; $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails'); $table_gui->initFilter(); require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php'; $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin); $questionList->setParentObjIdsFilter(array($this->object->getId())); $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES); foreach ($table_gui->getFilterItems() as $item) { if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') { $v = $item->getValue(); if (is_array($v) && count($v) && !(int) $v[0]) { continue; } $taxId = substr($item->getPostVar(), strlen('tax_')); $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst'); } elseif ($item->getValue() !== false) { $questionList->addFieldFilter($item->getPostVar(), $item->getValue()); } } $questionList->load(); $filteredTestResult = array(); $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions); foreach ($resultData as $resultItemKey => $resultItemValue) { if ($resultItemKey === 'test' || $resultItemKey === 'pass') { continue; } if (!$questionList->isInList($resultItemValue['qid'])) { continue; } $filteredTestResult[] = $resultItemValue; } return $filteredTestResult; }
private function initTestResultData($activeId, $pass) { $testResults = $this->testOBJ->getTestResult($activeId, $pass, true); foreach ($testResults as $key => $result) { if ($key === 'pass' || $key === 'test') { continue; } $this->reachedPointsByQuestion[$result['qid']] = $result['reached']; } }
/** * @param $userdata * @param $active_id */ public function recalculatePasses($userdata, $active_id) { require_once './Modules/Test/classes/class.ilTestEvaluationGUI.php'; // Below! require_once './Modules/Test/classes/class.ilTestPDFGenerator.php'; require_once './Modules/Test/classes/class.ilTestArchiver.php'; $passes = $userdata->getPasses(); foreach ($passes as $pass => $passdata) { if (is_object($passdata)) { $this->recalculatePass($passdata, $active_id, $pass); if ($this->test->getEnableArchiving()) { // requires out of the loop! $test_evaluation_gui = new ilTestEvaluationGUI($this->test); $result_array = $this->test->getTestResult($active_id, $pass); $overview = $test_evaluation_gui->getPassListOfAnswers($result_array, $active_id, $pass, true, false, false, true); $filename = ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->test->getId() . '-' . $active_id . '-' . $pass . '.pdf'; ilTestPDFGenerator::generatePDF($overview, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $archiver = new ilTestArchiver($this->test->getId()); $archiver->handInTestResult($active_id, $pass, $filename); unlink($filename); } } } }
public function show() { require_once 'class.ilTestEvaluationGUI.php'; require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php'; global $ilUser; $template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test"); $this->ilCtrl->setParameter($this, "skipfinalstatement", 1); $template->setVariable("FORMACTION", $this->ilCtrl->getFormAction($this->testOutputGUI, 'redirectBack') . '&reviewed=1'); $template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous")); if ($this->test->getListOfQuestionsEnd()) { $template->setVariable("CANCEL_CMD", 'outQuestionSummary'); } else { $template->setVariable("CANCEL_CMD", 'backFromSummary'); } $active = $this->test->getActiveIdOfUser($ilUser->getId()); $testevaluationgui = new ilTestEvaluationGUI($this->test); $results = $this->test->getTestResult($active, $this->testSession->getPass()); $results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $this->testSession->getPass(), false, false, false, false); if ($this->test->getShowExamviewPdf()) { $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export")); global $ilSetting; $inst_id = $ilSetting->get('inst_id', null); $path = ilUtil::getWebspaceDir() . '/assessment/' . $this->testOutputGUI->object->getId() . '/exam_pdf'; if (!is_dir($path)) { ilUtil::makeDirParents($path); } $filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $this->testSession->getPass() . '.pdf'; require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $template->setVariable("PDF_FILE_LOCATION", $filename); } else { $template->setCurrentBlock('prevent_double_form_subm'); $template->touchBlock('prevent_double_form_subm'); $template->parseCurrentBlock(); } if ($this->test->getShowExamviewHtml()) { if ($this->test->getListOfQuestionsEnd()) { $template->setVariable("CANCEL_CMD_BOTTOM", 'outQuestionSummary'); } else { $template->setVariable("CANCEL_CMD_BOTTOM", 'backFromSummary'); } $template->setVariable("BUTTON_CONTINUE_BOTTOM", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_BACK_BOTTOM", $this->lng->txt("btn_previous")); $template->setVariable('HTML_REVIEW', $results_output); } $this->tpl->setVariable($this->getContentBlockName(), $template->get()); }
/** * Output of the pass overview for a test called by a test participant * * @access public */ function getResultsOfUserOutput($active_id, $pass, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE) { global $ilias, $tpl; include_once "./Services/UICore/classes/class.ilTemplate.php"; $template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test"); $user_id = $this->object->_getUserIdFromActiveId($active_id); $uname = $this->object->userLookupFullName($user_id, TRUE); if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) { if (is_null($pass)) { $pass = $_GET["pass"]; } } $statement = $this->getFinalStatement($active_id); $user_data = $this->getResultsUserdata($active_id, TRUE); if (!is_null($pass)) { $result_array =& $this->object->getTestResult($active_id, $pass); $command_solution_details = ""; if ($show_pass_details) { $detailsoverview = $this->getPassDetailsOverview($result_array, $active_id, $pass, "iltestservicegui", "getResultsOfUserOutput", $command_solution_details); } $user_id = $this->object->_getUserIdFromActiveId($active_id); $showAllAnswers = TRUE; if ($this->object->isExecutable($user_id)) { $showAllAnswers = FALSE; } if ($show_answers) { $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points); } $template->setVariable("LIST_OF_ANSWERS", $list_of_answers); //$template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1)); $template->setVariable("PASS_DETAILS", $detailsoverview); $signature = $this->getResultsSignature(); $template->setVariable("SIGNATURE", $signature); } $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname)); $template->setVariable("USER_DATA", $user_data); $template->setVariable("USER_MARK", $statement["mark"]); if (strlen($statement["markects"])) { $template->setVariable("USER_MARK_ECTS", $statement["markects"]); } $template->parseCurrentBlock(); return $template->get(); }
/** * Returns the list of answers of a users test pass and offers a scoring option * * @access public * @param integer $active_id Active ID of the active user * @param integer $pass Test pass * @return string HTML code of the list of answers */ public function getManScoringQuestionGuiList($activeId, $pass) { include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php"; $manScoringQuestionTypes = ilObjAssessmentFolder::_getManualScoring(); $testResultData = $this->object->getTestResult($activeId, $pass); $manScoringQuestionGuiList = array(); foreach ($testResultData as $questionData) { if (!isset($questionData['qid'])) { continue; } if (!isset($questionData['type'])) { throw new ilTestException('no question type given!'); } $questionGUI = $this->object->createQuestionGUI("", $questionData['qid']); if (!in_array($questionGUI->object->getQuestionTypeID(), $manScoringQuestionTypes)) { continue; } $manScoringQuestionGuiList[$questionData['qid']] = $questionGUI; } return $manScoringQuestionGuiList; }
public function getVirtualSequenceUserResults(ilTestVirtualSequence $virtualSequence) { $resultsByPass = array(); foreach ($virtualSequence->getUniquePasses() as $pass) { $results = $this->object->getTestResult($virtualSequence->getActiveId(), $pass, false, true, true); $resultsByPass[$pass] = $results; } $virtualPassResults = array(); foreach ($virtualSequence->getQuestionsPassMap() as $questionId => $pass) { foreach ($resultsByPass[$pass] as $key => $questionResult) { if ($key === 'test' || $key === 'pass') { continue; } if ($questionResult['qid'] == $questionId) { $questionResult['pass'] = $pass; $virtualPassResults[$questionId] = $questionResult; break; } } } return $virtualPassResults; }
/** * 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(); } }
private function hideCorrectAnsweredQuestions(ilObjTest $testOBJ, $activeId, $pass) { if ($activeId > 0) { $result = $testOBJ->getTestResult($activeId, $pass, TRUE); foreach ($result as $sequence => $question) { if (is_numeric($sequence)) { if ($question['reached'] == $question['max']) { $this->hideQuestion($question['qid']); } } } $this->saveToDb(); } }
/** * Output of the pass overview for a test called by a test participant * * @param ilTestSession|ilTestSessionDynamicQuestionSet $testSession * @param integer $active_id * @param integer $pass * @param boolean $show_pass_details * @param boolean $show_answers * @param boolean $show_question_only * @param boolean $show_reached_points * @access public */ function getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE) { global $ilias, $tpl; include_once "./Services/UICore/classes/class.ilTemplate.php"; $template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test"); if ($this->participantData instanceof ilTestParticipantData) { $user_id = $this->participantData->getUserIdByActiveId($active_id); $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false); } else { $user_id = $this->object->_getUserIdFromActiveId($active_id); $uname = $this->object->userLookupFullName($user_id, TRUE); } if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) { if (is_null($pass)) { $pass = $_GET["pass"]; } } $user_data = $this->getResultsUserdata($testSession, $active_id, TRUE); if (!is_null($pass)) { $result_array =& $this->object->getTestResult($active_id, $pass); $command_solution_details = ""; if ($show_pass_details) { $detailsoverview = $this->getPassDetailsOverview($result_array, $active_id, $pass, $targetGUI, "getResultsOfUserOutput", $command_solution_details, $show_answers); } $user_id = $this->object->_getUserIdFromActiveId($active_id); $showAllAnswers = TRUE; if ($this->object->isExecutable($testSession, $user_id)) { $showAllAnswers = FALSE; } if ($show_answers) { $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, $_SESSION['tst_results_show_best_solutions'], $showAllAnswers, $show_question_only, $show_reached_points, $show_pass_details); } $template->setVariable("LIST_OF_ANSWERS", $list_of_answers); //$template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1)); $template->setVariable("PASS_DETAILS", $detailsoverview); $signature = $this->getResultsSignature(); $template->setVariable("SIGNATURE", $signature); if ($this->object->isShowExamIdInTestResultsEnabled()) { $template->setCurrentBlock('exam_id_footer'); $template->setVariable('EXAM_ID_VAL', $this->object->lookupExamId($testSession->getActiveId(), $pass)); $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id')); $template->parseCurrentBlock(); } } $template->setCurrentBlock('participant_back_anchor'); $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar"); $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top')); $template->parseCurrentBlock(); $template->setCurrentBlock('participant_block_id'); $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}"); $template->parseCurrentBlock(); $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname)); $template->setVariable("USER_DATA", $user_data); if ($this->isGradingMessageRequired()) { $template->setCurrentBlock('grading_message'); $template->setVariable('GRADING_MESSAGE', $this->getGradingMessage($active_id)); $template->parseCurrentBlock(); } $template->parseCurrentBlock(); return $template->get(); }