/** * creates and returns an instance of a test sequence * that corresponds to the current test mode and given active/pass * * @param integer $activeId * @param integer $pass * @return ilTestSequenceFixedQuestionSet|ilTestSequenceRandomQuestionSet|ilTestSequenceDynamicQuestionSet */ public function getSequenceByActiveIdAndPass($activeId, $pass) { if ($this->testSequences[$activeId][$pass] === null) { switch ($this->testOBJ->getQuestionSetType()) { case ilObjTest::QUESTION_SET_TYPE_FIXED: require_once 'Modules/Test/classes/class.ilTestSequenceFixedQuestionSet.php'; $this->testSequences[$activeId][$pass] = new ilTestSequenceFixedQuestionSet($activeId, $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_RANDOM: require_once 'Modules/Test/classes/class.ilTestSequenceRandomQuestionSet.php'; $this->testSequences[$activeId][$pass] = new ilTestSequenceRandomQuestionSet($activeId, $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_DYNAMIC: require_once 'Modules/Test/classes/class.ilTestSequenceDynamicQuestionSet.php'; require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSet.php'; $questionSet = new ilTestDynamicQuestionSet($this->db, $this->lng, $this->pluginAdmin, $this->testOBJ); $this->testSequences[$activeId][$pass] = new ilTestSequenceDynamicQuestionSet($this->db, $questionSet, $activeId); #$this->testSequence->setPreventCheckedQuestionsFromComingUpEnabled( # $this->testOBJ->isInstantFeedbackAnswerFixationEnabled() #); // checked questions now has to come up any time, so they can be set to unchecked right at this moment break; } } return $this->testSequences[$activeId][$pass]; }
function getQuestionsSubTabs() { global $ilTabs, $ilCtrl; $ilTabs->activateTab('assQuestions'); $a_cmd = $ilCtrl->getCmd(); if (!$this->object->isRandomTest()) { #if (in_array($this->object->getEnabledViewMode(), array('both', 'express'))) { $questions_per_page = $a_cmd == 'questions_per_page' || $a_cmd == 'removeQuestions' && $_REQUEST['test_express_mode'] ? true : false; $this->tabs_gui->addSubTabTarget("questions_per_page_view", $this->ctrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'showPage'), "", "", "", $questions_per_page); #} } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($this->object->getTemplate(), ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); if (!in_array('questions', $template->getHiddenTabs())) { // questions subtab $ilTabs->addSubTabTarget("edit_test_questions", $this->ctrl->getLinkTarget($this, 'questions'), array("questions", "createQuestion", "randomselect", "back", "createRandomSelection", "cancelRandomSelect", "insertRandomSelection", "removeQuestions", "moveQuestions", "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions", "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion", "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode"), ""); if (in_array($a_cmd, array('questions', 'createQuestion')) || $a_cmd == 'removeQuestions' && !$_REQUEST['test_express_mode']) { $this->tabs_gui->activateSubTab('edit_test_questions'); } } #} // print view subtab if (!$this->object->isRandomTest()) { $ilTabs->addSubTabTarget("print_view", $this->ctrl->getLinkTarget($this, 'print'), "print", "", "", $this->ctrl->getCmd() == 'print'); $ilTabs->addSubTabTarget('review_view', $this->ctrl->getLinkTarget($this, 'review'), 'review', '', '', $this->ctrl->getCmd() == 'review'); } }
/** * creates and returns an instance of a test sequence * that corresponds to the current test mode and given pass * * @param ilTestSession|ilTestSessionDynamicQuestionSet $testSession * @param integer $pass * @return ilTestSequence|ilTestSequenceDynamicQuestionSet */ public function getSequenceByPass($testSession, $pass) { if ($this->testSequence === null) { switch ($this->testOBJ->getQuestionSetType()) { case ilObjTest::QUESTION_SET_TYPE_FIXED: require_once 'Modules/Test/classes/class.ilTestSequence.php'; $this->testSequence = new ilTestSequence($testSession->getActiveId(), $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_RANDOM: require_once 'Modules/Test/classes/class.ilTestSequenceRandomQuestionSet.php'; $this->testSequence = new ilTestSequenceRandomQuestionSet($testSession->getActiveId(), $pass, $this->testOBJ->isRandomTest()); break; case ilObjTest::QUESTION_SET_TYPE_DYNAMIC: require_once 'Modules/Test/classes/class.ilTestSequenceDynamicQuestionSet.php'; require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSet.php'; $questionSet = new ilTestDynamicQuestionSet($this->db, $this->lng, $this->pluginAdmin, $this->testOBJ); $this->testSequence = new ilTestSequenceDynamicQuestionSet($this->db, $questionSet, $testSession->getActiveId()); break; } } return $this->testSequence; }
private function buildAssignmentConfigurationInPoolHintMessage() { switch (true) { case $this->testOBJ->isRandomTest(): $testMode = $this->lng->txt('tst_question_set_type_random'); break; case $this->testOBJ->isDynamicTest(): $testMode = $this->lng->txt('tst_question_set_type_dynamic'); break; default: return ''; } return sprintf($this->lng->txt('tst_qst_skl_config_in_pool_hint_msg'), $testMode); }
public function buildVirtualSequence(ilTestSession $testSession) { global $ilDB, $lng, $ilPluginAdmin; require_once 'Modules/Test/classes/class.ilTestVirtualSequence.php'; $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object); if ($this->object->isRandomTest()) { require_once 'Modules/Test/classes/class.ilTestVirtualSequenceRandomQuestionSet.php'; $virtualSequence = new ilTestVirtualSequenceRandomQuestionSet($ilDB, $this->object, $testSequenceFactory); } else { require_once 'Modules/Test/classes/class.ilTestVirtualSequence.php'; $virtualSequence = new ilTestVirtualSequence($ilDB, $this->object, $testSequenceFactory); } $virtualSequence->setActiveId($testSession->getActiveId()); $virtualSequence->init(); return $virtualSequence; }
/** * Exports the evaluation data to the CSV file format * * Exports the evaluation data to the CSV file format * * @param string $filtertext Filter text for the user data * @param boolean $passedonly TRUE if only passed user datasets should be exported, FALSE otherwise * @access public */ function exportToCSV($deliver = TRUE, $filterby = "", $filtertext = "", $passedonly = FALSE) { global $ilLog; if (strcmp($this->mode, "aggregated") == 0) { return $this->aggregatedResultsToCSV($deliver); } $rows = array(); $datarow = array(); $col = 1; if ($this->test_obj->getAnonymity()) { array_push($datarow, $this->lng->txt("counter")); $col++; } else { array_push($datarow, $this->lng->txt("name")); $col++; array_push($datarow, $this->lng->txt("login")); $col++; } $additionalFields = $this->test_obj->getEvaluationAdditionalFields(); if (count($additionalFields)) { foreach ($additionalFields as $fieldname) { array_push($datarow, $this->lng->txt($fieldname)); $col++; } } array_push($datarow, $this->lng->txt("tst_stat_result_resultspoints")); $col++; array_push($datarow, $this->lng->txt("maximum_points")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_resultsmarks")); $col++; if ($this->test_obj->getECTSOutput()) { array_push($datarow, $this->lng->txt("ects_grade")); $col++; } array_push($datarow, $this->lng->txt("tst_stat_result_qworkedthrough")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_qmax")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_pworkedthrough")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_timeofwork")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_atimeofwork")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_firstvisit")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_lastvisit")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_mark_median")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_rank_participant")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_rank_median")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_total_participants")); $col++; array_push($datarow, $this->lng->txt("tst_stat_result_median")); $col++; array_push($datarow, $this->lng->txt("scored_pass")); $col++; array_push($datarow, $this->lng->txt("pass")); $col++; $data =& $this->test_obj->getCompleteEvaluationData(TRUE, $filterby, $filtertext); $headerrow = $datarow; $counter = 1; foreach ($data->getParticipants() as $active_id => $userdata) { $datarow = $headerrow; $remove = FALSE; if ($passedonly) { if ($data->getParticipant($active_id)->getPassed() == FALSE) { $remove = TRUE; } } if (!$remove) { $datarow2 = array(); if ($this->test_obj->getAnonymity()) { array_push($datarow2, $counter); } else { array_push($datarow2, $data->getParticipant($active_id)->getName()); array_push($datarow2, $data->getParticipant($active_id)->getLogin()); } if (count($additionalFields)) { $userfields = ilObjUser::_lookupFields($userdata->getUserID()); foreach ($additionalFields as $fieldname) { if (strcmp($fieldname, "gender") == 0) { array_push($datarow2, $this->lng->txt("gender_" . $userfields[$fieldname])); } else { array_push($datarow2, $userfields[$fieldname]); } } } array_push($datarow2, $data->getParticipant($active_id)->getReached()); array_push($datarow2, $data->getParticipant($active_id)->getMaxpoints()); array_push($datarow2, $data->getParticipant($active_id)->getMark()); if ($this->test_obj->getECTSOutput()) { array_push($datarow2, $data->getParticipant($active_id)->getECTSMark()); } array_push($datarow2, $data->getParticipant($active_id)->getQuestionsWorkedThrough()); array_push($datarow2, $data->getParticipant($active_id)->getNumberOfQuestions()); array_push($datarow2, $data->getParticipant($active_id)->getQuestionsWorkedThroughInPercent() / 100.0); $time = $data->getParticipant($active_id)->getTimeOfWork(); $time_seconds = $time; $time_hours = floor($time_seconds / 3600); $time_seconds -= $time_hours * 3600; $time_minutes = floor($time_seconds / 60); $time_seconds -= $time_minutes * 60; array_push($datarow2, sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds)); $time = $data->getParticipant($active_id)->getQuestionsWorkedThrough() ? $data->getParticipant($active_id)->getTimeOfWork() / $data->getParticipant($active_id)->getQuestionsWorkedThrough() : 0; $time_seconds = $time; $time_hours = floor($time_seconds / 3600); $time_seconds -= $time_hours * 3600; $time_minutes = floor($time_seconds / 60); $time_seconds -= $time_minutes * 60; array_push($datarow2, sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds)); $fv = $data->getParticipant($active_id)->getFirstVisit(); $lv = $data->getParticipant($active_id)->getLastVisit(); foreach (array($fv, $lv) as $ts) { if ($ts) { $visit = ilFormat::formatDate(date('Y-m-d H:i:s', $ts), "datetime", false, false); array_push($datarow2, $visit); } else { array_push($datarow2, ""); } } $median = $data->getStatistics()->getStatistics()->median(); $pct = $data->getParticipant($active_id)->getMaxpoints() ? $median / $data->getParticipant($active_id)->getMaxpoints() * 100.0 : 0; $mark = $this->test_obj->mark_schema->getMatchingMark($pct); $mark_short_name = ""; if (is_object($mark)) { $mark_short_name = $mark->getShortName(); } array_push($datarow2, $mark_short_name); array_push($datarow2, $data->getStatistics()->getStatistics()->rank($data->getParticipant($active_id)->getReached())); array_push($datarow2, $data->getStatistics()->getStatistics()->rank_median()); array_push($datarow2, $data->getStatistics()->getStatistics()->count()); array_push($datarow2, $median); if ($this->test_obj->getPassScoring() == SCORE_BEST_PASS) { array_push($datarow2, $data->getParticipant($active_id)->getBestPass() + 1); } else { array_push($datarow2, $data->getParticipant($active_id)->getLastPass() + 1); } for ($pass = 0; $pass <= $data->getParticipant($active_id)->getLastPass(); $pass++) { $finishdate = $this->test_obj->getPassFinishDate($active_id, $pass); if ($finishdate > 0) { if ($pass > 0) { for ($i = 1; $i < $col - 1; $i++) { array_push($datarow2, ""); array_push($datarow, ""); } array_push($datarow, ""); } array_push($datarow2, $pass + 1); if (is_object($data->getParticipant($active_id)) && is_array($data->getParticipant($active_id)->getQuestions($pass))) { foreach ($data->getParticipant($active_id)->getQuestions($pass) as $question) { $question_data = $data->getParticipant($active_id)->getPass($pass)->getAnsweredQuestionByQuestionId($question["id"]); array_push($datarow2, $question_data["reached"]); array_push($datarow, preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"]))); } } if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions() || $counter == 1 && $pass == 0) { array_push($rows, $datarow); } $datarow = array(); array_push($rows, $datarow2); $datarow2 = array(); } } $counter++; } } $csv = ""; $separator = ";"; foreach ($rows as $evalrow) { $csvrow =& $this->test_obj->processCSVRow($evalrow, TRUE, $separator); $csv .= join($csvrow, $separator) . "\n"; } if ($deliver) { ilUtil::deliverData($csv, ilUtil::getASCIIFilename($this->test_obj->getTitle() . "_results.csv")); exit; } else { return $csv; } }
private function isRandomTestSettingSwitched($random_test) { return $random_test != $this->object->isRandomTest(); }
/** * Returns the pass overview for a given active ID * * @return string HTML code of the pass overview * @access public * * @deprecated */ public function getPassOverview(ilTestSession $testSession, $targetclass = "", $targetcommand = "", $short = FALSE, $hide_details = FALSE) { $active_id = $testSession->getActiveId(); require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php'; require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php'; $table = new ilTestPassOverviewTableGUI($this, '', $short ? ilTestPassOverviewTableGUI::CONTEXT_SHORT : ilTestPassOverviewTableGUI::CONTEXT_LONG, isset($_GET['pdf']) && $_GET['pdf'] == 1); $considerHiddenQuestions = true; if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { $considerHiddenQuestions = false; $table->setObjectiveOrientedPresentationEnabled(true); require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php'; $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession); } $table->init(); $data = array(); $counted_pass = $this->object->_getResultPass($active_id); $reached_pass = $this->object->_getPass($active_id); require_once 'Modules/Test/classes/class.ilTestPassesSelector.php'; $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object); $testPassesSelector->setActiveId($active_id); $lastFinishedPass = $this->testSessionFactory->getSession($active_id)->getLastFinishedPass(); $testPassesSelector->setLastFinishedPass($lastFinishedPass); foreach ($testPassesSelector->getReportablePasses() as $pass) { $row = array(); $considerOptionalQuestions = true; if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass); $testSequence->loadFromDb(); $testSequence->loadQuestions(); if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) { $considerOptionalQuestions = false; } $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions); $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions); $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence); $objectivesList->loadObjectivesTitles(); $row['objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions()); } if (!$short) { $result_array =& $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions); if (!$result_array['pass']['total_max_points']) { $percentage = 0; } else { $percentage = $result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points'] * 100; } $total_max = $result_array['pass']['total_max_points']; $total_reached = $result_array['pass']['total_reached_points']; $total_requested_hints = $result_array['pass']['total_requested_hints']; } if (!$hide_details) { if (strlen($targetclass) && strlen($targetcommand)) { $this->ctrl->setParameterByClass($targetclass, 'active_id', $active_id); $this->ctrl->setParameterByClass($targetclass, 'pass', $pass); $aslgui = new ilAdvancedSelectionListGUI(); $aslgui->setListTitle($this->lng->txt('actions')); $aslgui->setId($pass); $aslgui->addItem($this->lng->txt('tst_pass_details'), 'tst_pass_details', $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand)); if ($this->object->isPassDeletionAllowed() && $pass != $counted_pass) { $aslgui->addItem($this->lng->txt('delete'), 'tst_pass_delete', $this->ctrl->getLinkTargetByClass($targetclass, 'confirmDeletePass')); } $row['pass_details'] = $aslgui->getHTML(); } } if (!$short) { if ($pass == $counted_pass) { $row['scored'] = '⊗'; } else { $row['scored'] = ''; } } $row['pass'] = $pass + 1; $row['date'] = $this->object->getPassFinishDate($active_id, $pass); if (!$short) { $row['answered'] = $result_array['pass']['num_workedthrough'] . ' ' . strtolower($this->lng->txt('of')) . ' ' . (count($result_array) - 2); if ($this->object->isOfferingQuestionHintsEnabled()) { $row['hints'] = $total_requested_hints; } $row['reached'] = $total_reached . ' ' . strtolower($this->lng->txt('of')) . ' ' . $total_max; $row['percentage'] = $percentage; } $data[] = $row; } $table->setData($data); return $table->getHTML(); }