/** * creates and returns an instance of a test sequence * that corresponds to the current test mode * * @param integer $activeId * @return ilTestSession|ilTestSessionDynamicQuestionSet */ public function getSession($activeId = null) { global $ilUser; if (self::$testSession === null) { switch ($this->testOBJ->getQuestionSetType()) { case ilObjTest::QUESTION_SET_TYPE_FIXED: case ilObjTest::QUESTION_SET_TYPE_RANDOM: global $ilUser; require_once 'Modules/Test/classes/class.ilTestSession.php'; self::$testSession = new ilTestSession(); break; case ilObjTest::QUESTION_SET_TYPE_DYNAMIC: require_once 'Modules/Test/classes/class.ilTestSessionDynamicQuestionSet.php'; self::$testSession = new ilTestSessionDynamicQuestionSet(); break; } self::$testSession->setRefId($this->testOBJ->getRefId()); self::$testSession->setTestId($this->testOBJ->getTestId()); if ($activeId) { self::$testSession->loadFromDb($activeId); } else { self::$testSession->loadTestSession($this->testOBJ->getTestId(), $ilUser->getId(), $_SESSION["tst_access_code"][$this->testOBJ->getTestId()]); } } return self::$testSession; }
public function __construct(ilDB $db, ilObjTest $testOBJ) { $this->db = $db; $this->testOBJ = $testOBJ; $this->skillQuestionAssignmentList = new ilTestSkillQuestionAssignmentList($this->db); $this->skillQuestionAssignmentList->setTestId($this->testOBJ->getTestId()); $this->skillLevelThresholdList = new ilTestSkillLevelThresholdList($this->db); $this->skillLevelThresholdList->setTestId($this->testOBJ->getTestId()); $this->questions = array(); $this->maxPointsByQuestion = array(); }
private function getQuestionIdsForSourcePoolDefinitionIds(ilTestRandomQuestionSetSourcePoolDefinition $definition) { $this->stagingPoolQuestionList->resetQuestionList(); $this->stagingPoolQuestionList->setTestObjId($this->testOBJ->getId()); $this->stagingPoolQuestionList->setTestId($this->testOBJ->getTestId()); $this->stagingPoolQuestionList->setPoolId($definition->getPoolId()); if ($this->hasTaxonomyFilter($definition)) { $this->stagingPoolQuestionList->addTaxonomyFilter($definition->getMappedFilterTaxId(), array($definition->getMappedFilterTaxNodeId())); } $this->stagingPoolQuestionList->loadQuestions(); return $this->stagingPoolQuestionList->getQuestions(); }
private function stageQuestionsFromSourcePool($sourcePoolId) { $questionIdMapping = array(); $query = 'SELECT question_id FROM qpl_questions WHERE obj_fi = %s AND complete = %s AND original_id IS NULL'; $res = $this->db->queryF($query, array('integer', 'text'), array($sourcePoolId, 1)); while ($row = $this->db->fetchAssoc($res)) { $question = assQuestion::_instanciateQuestion($row['question_id']); $duplicateId = $question->duplicate(true, null, null, null, $this->testOBJ->getId()); $nextId = $this->db->nextId('tst_rnd_cpy'); $this->db->insert('tst_rnd_cpy', array('copy_id' => array('integer', $nextId), 'tst_fi' => array('integer', $this->testOBJ->getTestId()), 'qst_fi' => array('integer', $duplicateId), 'qpl_fi' => array('integer', $sourcePoolId))); $questionIdMapping[$row['question_id']] = $duplicateId; } return $questionIdMapping; }
private function buildSkillQuestionAssignmentList() { require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignmentList.php'; $assignmentList = new ilTestSkillQuestionAssignmentList($this->db); $assignmentList->setTestId($this->testOBJ->getTestId()); return $assignmentList; }
public function executeCommand() { if ($this->isAccessDenied()) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } $nextClass = $this->ctrl->getNextClass(); $this->manageTabs($nextClass); switch ($nextClass) { case 'ilassquestionskillassignmentsgui': $questionContainerId = $this->getQuestionContainerId(); require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php'; $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin); $questionList->setParentObjId($questionContainerId); $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter()); $questionList->load(); $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db); $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired()); $gui->setQuestionContainerId($questionContainerId); $gui->setQuestionList($questionList); if ($this->testOBJ->isFixedTest()) { $gui->setQuestionOrderSequence($this->testOBJ->getQuestions()); } else { $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage()); } $this->ctrl->forwardCommand($gui); break; case 'iltestskilllevelthresholdsgui': $gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ->getTestId()); $gui->setQuestionAssignmentColumnsEnabled(!$this->testOBJ->isRandomTest()); $gui->setQuestionContainerId($this->getQuestionContainerId()); $this->ctrl->forwardCommand($gui); break; } }
/** * @return bool */ public function savedDefinitionsExist() { $query = "SELECT COUNT(*) cnt FROM tst_rnd_quest_set_qpls WHERE test_fi = %s"; $res = $this->db->queryF($query, array('integer'), array($this->testOBJ->getTestId())); $row = $this->db->fetchAssoc($res); return $row['cnt'] > 0; }
private function areSkillLevelThresholdsMissing() { if ($this->object->isDynamicTest()) { $questionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig(); $questionContainerId = $questionSetConfig->getSourceQuestionPoolId(); } else { $questionContainerId = $this->object->getId(); } global $ilDB; require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php'; require_once 'Modules/Test/classes/class.ilTestSkillLevelThreshold.php'; $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB); $assignmentList->setParentObjId($questionContainerId); $assignmentList->loadFromDb(); foreach ($assignmentList->getUniqueAssignedSkills() as $data) { foreach ($data['skill']->getLevelData() as $level) { $treshold = new ilTestSkillLevelThreshold($ilDB); $treshold->setTestId($this->object->getTestId()); $treshold->setSkillBaseId($data['skill_base_id']); $treshold->setSkillTrefId($data['skill_tref_id']); $treshold->setSkillLevelId($level['id']); if (!$treshold->dbRecordExists()) { return true; } } } return false; }
private function buildSkillLevelThresholdList() { require_once 'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php'; $thresholdList = new ilTestSkillLevelThresholdList($this->db); $thresholdList->setTestId($this->testOBJ->getTestId()); return $thresholdList; }
/** * builds the question set config form and initialises the fields * with the config currently saved in database * * @return ilPropertyFormGUI $form */ private function buildForm() { $this->questionSetConfig->loadFromDb($this->testOBJ->getTestId()); require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setId("tst_form_dynamic_question_set_config"); $form->setTitle($this->lng->txt('tst_form_dynamic_question_set_config')); $form->setTableWidth("100%"); $hiddenInputTaxSelectOptAsyncUrl = new ilHiddenInputGUI('taxSelectOptAsyncUrl'); $hiddenInputTaxSelectOptAsyncUrl->setValue($this->ctrl->getLinkTarget($this, self::CMD_GET_TAXONOMY_OPTIONS_ASYNC, '', true)); $form->addItem($hiddenInputTaxSelectOptAsyncUrl); if ($this->testOBJ->participantDataExist()) { $pool = new ilNonEditableValueGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_title'); $pool->setValue($this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree)); $pool->setDisabled(true); $form->addItem($pool); } else { $poolInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_id'); $poolInput->setOptions($this->buildQuestionPoolSelectInputOptionArray($this->testOBJ->getAvailableQuestionpools(true, false, false, true, true))); $poolInput->setValue($this->questionSetConfig->getSourceQuestionPoolId()); $poolInput->setRequired(true); $form->addItem($poolInput); } $questionOderingInput = new ilRadioGroupInputGUI($this->lng->txt('tst_input_dynamic_question_set_question_ordering'), 'question_ordering'); $questionOderingInput->setValue($this->questionSetConfig->getOrderingTaxonomyId() ? self::QUESTION_ORDERING_TYPE_TAXONOMY : self::QUESTION_ORDERING_TYPE_UPDATE_DATE); $optionOrderByDate = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_date'), self::QUESTION_ORDERING_TYPE_UPDATE_DATE, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_date_desc')); $questionOderingInput->addOption($optionOrderByDate); $optionOrderByTax = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_tax'), self::QUESTION_ORDERING_TYPE_TAXONOMY, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_tax_desc')); $orderTaxInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_ordering_tax'), 'ordering_tax'); $orderTaxInput->setInfo($this->lng->txt('tst_input_dynamic_question_set_ordering_tax_description')); $orderTaxInput->setValue($this->questionSetConfig->getOrderingTaxonomyId()); $orderTaxInput->setRequired(true); $orderTaxInput->setOptions($this->buildTaxonomySelectInputOptionArray($this->questionSetConfig->getSourceQuestionPoolId())); $optionOrderByTax->addSubItem($orderTaxInput); $questionOderingInput->addOption($optionOrderByTax); $form->addItem($questionOderingInput); $taxFilterInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dynamic_question_set_taxonomie_filter_enabled'), 'tax_filter_enabled'); $taxFilterInput->setValue(1); $taxFilterInput->setChecked($this->questionSetConfig->isTaxonomyFilterEnabled()); $form->addItem($taxFilterInput); $answStatusFilterInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dyn_quest_set_answer_status_filter_enabled'), 'answer_status_filter_enabled'); $answStatusFilterInput->setValue(1); $answStatusFilterInput->setChecked($this->questionSetConfig->isAnswerStatusFilterEnabled()); $form->addItem($answStatusFilterInput); $previousQuestionsListInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dyn_quest_set_prev_quest_list_enabled'), 'prev_quest_list_enabled'); $previousQuestionsListInput->setValue(1); $previousQuestionsListInput->setChecked($this->questionSetConfig->isPreviousQuestionsListEnabled()); $form->addItem($previousQuestionsListInput); if ($this->testOBJ->participantDataExist()) { $questionOderingInput->setDisabled(true); $taxFilterInput->setDisabled(true); $answStatusFilterInput->setDisabled(true); $previousQuestionsListInput->setDisabled(true); } else { $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt('save')); } return $form; }
public function saveToDb() { if ($this->getId()) { $this->updateDbRecord($this->testOBJ->getTestId()); } else { $this->insertDbRecord($this->testOBJ->getTestId()); } }
public function save() { $this->questionSetConfig->setPoolsWithHomogeneousScoredQuestionsRequired($this->getItemByPostVar('quest_points_equal_per_pool')->getChecked()); switch ($this->getItemByPostVar('quest_amount_cfg_mode')->getValue()) { case ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST: $this->questionSetConfig->setQuestionAmountConfigurationMode($this->getItemByPostVar('quest_amount_cfg_mode')->getValue()); $this->questionSetConfig->setQuestionAmountPerTest($this->getItemByPostVar('quest_amount_per_test')->getValue()); break; case ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL: $this->questionSetConfig->setQuestionAmountConfigurationMode($this->getItemByPostVar('quest_amount_cfg_mode')->getValue()); $this->questionSetConfig->setQuestionAmountPerTest(null); break; } return $this->questionSetConfig->saveToDb($this->testOBJ->getTestId()); }
protected function questionsObject() { /** @var $ilAccess ilAccessHandler */ global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirect($this, "infoScreen"); } if ($_GET['browse']) { exit('Browse??'); return $this->object->questionbrowser(); } if ($_GET["eqid"] && $_GET["eqpl"]) { $this->ctrl->setParameter($this, 'q_id', $_GET["eqid"]); $this->ctrl->setParameter($this, 'qpl_id', $_GET["eqpl"]); $this->ctrl->redirect($this, 'adjustscoringfortest'); } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test"); $this->tpl->setCurrentBlock("adm_content"); include_once "./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php"; $checked_move = is_array($_SESSION['tst_qst_move_' . $this->object->getTestId()]) && count($_SESSION['tst_qst_move_' . $this->object->getTestId()]); $table_gui = new ilTestQuestionsTableGUI($this, 'showquestionlist', $ilAccess->checkAccess("write", "", $this->ref_id) ? true : false, $checked_move, 0); $data = $this->object->getTestQuestions(); // @TODO Ask object for random test. if (!$data) { $this->object->getPotentialRandomTestQuestions(); } $filtered_data = array(); foreach ($data as $question) { $question_object = assQuestion::instantiateQuestionGUI($question['question_id']); if ($this->supportsAdjustment($question_object) && $this->allowedInAdjustment($question_object)) { $filtered_data[] = $question; } } $table_gui->setData($filtered_data); $table_gui->clearActionButtons(); $table_gui->clearCommandButtons(); $table_gui->multi = array(); $table_gui->setRowTemplate('tpl.il_as_tst_adjust_questions_row.html', 'Modules/Test'); $table_gui->header_commands = array(); $table_gui->setSelectAllCheckbox(null); $this->tpl->setVariable('QUESTIONBROWSER', $table_gui->getHTML()); $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this, 'showquestionlist')); $this->tpl->parseCurrentBlock(); }
/** * Returns an output of the solution to an answer compared to the correct solution * * @param integer $question_id Database ID of the question * @param integer $active_id Active ID of the active user * @param integer $pass Test pass * @return string HTML code of the correct solution comparison * @access public */ function getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList = null) { global $ilUser; $test_id = $this->object->getTestId(); $question_gui = $this->object->createQuestionGUI("", $question_id); $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE, "Modules/Test"); $show_question_only = $this->object->getShowSolutionAnswersOnly() ? TRUE : FALSE; $result_output = $question_gui->getSolutionOutput($active_id, $pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, FALSE, TRUE); $best_output = $question_gui->getSolutionOutput($active_id, $pass, FALSE, FALSE, $show_question_only, FALSE, TRUE, FALSE, FALSE); if ($this->object->getShowSolutionFeedback() && $_GET['cmd'] != 'outCorrectSolution') { $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput($active_id, $pass); if (strlen($specificAnswerFeedback)) { $template->setCurrentBlock("outline_specific_feedback"); $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback); $template->parseCurrentBlock(); } } if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) { $template->setCurrentBlock("best_solution"); $template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is")); $template->setVariable("BEST_OUTPUT", $best_output); $template->parseCurrentBlock(); } $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was")); $maxpoints = $question_gui->object->getMaximumPoints(); if ($maxpoints == 1) { $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")"); } else { $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")"); } if ($objectivesList !== null) { $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': '; $objectives .= $objectivesList->getQuestionRelatedObjectiveTitle($question_gui->object->getId()); $template->setVariable('OBJECTIVES', $objectives); } $template->setVariable("SOLUTION_OUTPUT", $result_output); $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints)); $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back")); return $template->get(); }
/** * build xml export file */ function buildExportFileXML() { global $ilBench; $ilBench->start("TestExport", "buildExportFile"); include_once "./Services/Xml/classes/class.ilXmlWriter.php"; $this->xml = new ilXmlWriter(); // set dtd definition $this->xml->xmlSetDtdDef("<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">"); // set generated comment $this->xml->xmlSetGenCmt("Export of ILIAS Test " . $this->test_obj->getId() . " of installation " . $this->inst . "."); // set xml header $this->xml->xmlHeader(); // create directories $this->test_obj->createExportDirectory(); include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::makeDir($this->export_dir . "/" . $this->subdir); ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects"); // get Log File $expDir = $this->test_obj->getExportDirectory(); include_once "./Services/Logging/classes/class.ilLog.php"; $expLog = new ilLog($expDir, "export.log"); $expLog->delete(); $expLog->setLogFormat(""); $expLog->write(date("[y-m-d H:i:s] ") . "Start Export"); // write qti file $qti_file = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->qti_filename, "w"); fwrite($qti_file, $this->test_obj->toXML()); fclose($qti_file); // get xml content $ilBench->start("TestExport", "buildExportFile_getXML"); $this->test_obj->exportPagesXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog); $ilBench->stop("TestExport", "buildExportFile_getXML"); // dump xml document to screen (only for debugging reasons) /* echo "<PRE>"; echo htmlentities($this->xml->xmlDumpMem($format)); echo "</PRE>"; */ // dump xml document to file $ilBench->start("TestExport", "buildExportFile_dumpToFile"); $this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false); $ilBench->stop("TestExport", "buildExportFile_dumpToFile"); if (@file_exists("./Modules/Test/classes/class.ilTestResultsToXML.php")) { // dump results xml document to file include_once "./Modules/Test/classes/class.ilTestResultsToXML.php"; $resultwriter = new ilTestResultsToXML($this->test_obj->getTestId(), $this->test_obj->getAnonymity()); $ilBench->start("TestExport", "buildExportFile_results"); $resultwriter->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->resultsfile, false); $ilBench->stop("TestExport", "buildExportFile_results"); } // add media objects which were added with tiny mce $ilBench->start("QuestionpoolExport", "buildExportFile_saveAdditionalMobs"); $this->exportXHTMLMediaObjects($this->export_dir . "/" . $this->subdir); $ilBench->stop("QuestionpoolExport", "buildExportFile_saveAdditionalMobs"); // zip the file $ilBench->start("TestExport", "buildExportFile_zipFile"); ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip"); $ilBench->stop("TestExport", "buildExportFile_zipFile"); // destroy writer object $this->xml->_XmlWriter; $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export"); $ilBench->stop("TestExport", "buildExportFile"); return $this->export_dir . "/" . $this->subdir . ".zip"; }
/** * removes all question set config related data for cloned/copied test * * @param ilObjTest $cloneTestOBJ */ public function cloneQuestionSetRelatedData($cloneTestOBJ) { $this->loadFromDb(); $this->cloneToDbForTestId($cloneTestOBJ->getTestId()); }
/** * save question */ function saveReturn() { global $ilUser; $old_id = $_GET["q_id"]; $result = $this->writePostData(); if ($result == 0) { $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType()); $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType()); $this->object->saveToDb(); $originalexists = $this->object->_questionExistsInPool($this->object->original_id); include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, "originalSyncForm"); return; } elseif ($_GET["calling_test"]) { require_once 'Modules/Test/classes/class.ilObjTest.php'; $test = new ilObjTest($_GET["calling_test"]); #var_dump(assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())); $q_id = $this->object->getId(); if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) { global $tree, $ilDB, $ilPluginAdmin; include_once "./Modules/Test/classes/class.ilObjTest.php"; $_GET["ref_id"] = $_GET["calling_test"]; $test = new ilObjTest($_GET["calling_test"], true); require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php'; $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test); $new_id = $test->insertQuestion($testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId()); $q_id = $new_id; if (isset($_REQUEST['prev_qid'])) { $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']); } $this->ctrl->setParameter($this, 'q_id', $new_id); $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']); #$this->ctrl->setParameter($this, 'test_ref_id', false); } ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); if ($_REQUEST['test_express_mode']) { ilUtil::redirect(ilTestExpressPage::getReturnToPageLink($q_id)); } else { ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["calling_test"]); } } else { if ($this->object->getId() != $old_id) { $this->callNewIdListeners($this->object->getId()); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions"); } if (strcmp($_SESSION["info"], "") != 0) { ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true); } else { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); } $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions"); } } }
/** * show information screen */ function infoScreen($session_lock = "") { global $ilAccess; global $ilUser; // Disabled if ($_GET['crs_show_result']) { $this->object->hideCorrectAnsweredQuestions(); } else { if ($this->object->getTestSequence()->hasHiddenQuestions()) { $this->object->getTestSequence()->clearHiddenQuestions(); $this->object->getTestSequence()->saveToDb(); } } if ($_GET['createRandomSolutions']) { $this->object->createRandomSolutions($_GET['createRandomSolutions']); } if (!$ilAccess->checkAccess("visible", "", $this->ref_id)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE); } include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); $seq = $this->object->getTestSession()->getLastSequence(); include_once "./Modules/Test/classes/class.ilTestOutputGUI.php"; $output_gui =& new ilTestOutputGUI($this->object); $this->ctrl->setParameter($output_gui, "sequence", $seq); $info->setFormAction($this->ctrl->getFormAction($output_gui)); if (strlen($session_lock)) { $info->addHiddenElement("lock", $session_lock); } else { $info->addHiddenElement("lock", md5($_COOKIE['PHPSESSID'] . time())); } $online_access = false; if ($this->object->getFixedParticipants()) { include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId()); if ($online_access_result === true) { $online_access = true; } else { ilUtil::sendInfo($online_access_result); } } if ($this->object->isOnline() && $this->object->isComplete()) { if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) { $executable = $this->object->isExecutable($ilUser->getId(), $allowPassIncrease = TRUE); if ($executable["executable"]) { if ($this->object->areObligationsEnabled() && $this->object->hasObligations($this->object->getTestId())) { ilUtil::sendInfo($GLOBALS['lng']->txt('tst_test_contains_obligatory_questions')); } if ($this->object->getTestSession()->getActiveId() > 0) { // resume test $resume_text = $this->lng->txt("tst_resume_test"); if ($seq < 1 || $seq == $this->object->getTestSequence()->getFirstSequence()) { $resume_text = $this->object->getStartTestLabel($this->object->getTestSession()->getActiveId()); } //$info->addFormButton("resume", $resume_text); $big_button[] = array('resume', $resume_text); } else { // start new test //$info->addFormButton("start", $this->object->getStartTestLabel($this->object->getTestSession()->getActiveId())); $big_button[] = array("start", $this->object->getStartTestLabel($this->object->getTestSession()->getActiveId())); } } else { ilUtil::sendInfo($executable["errormessage"]); } if ($this->object->getTestSession()->getActiveId() > 0) { // test results button if ($this->object->canShowTestResults($ilUser->getId())) { //$info->addFormButton("outUserResultsOverview", $this->lng->txt("tst_show_results")); $big_button[] = array("outUserResultsOverview", $this->lng->txt("tst_show_results")); if ($this->object->getHighscoreEnabled()) { // Can also compare results then $big_button[] = array("outResultsToplist", $this->lng->txt("tst_show_toplist")); } } } } if ($this->object->getTestSession()->getActiveId() > 0) { if ($this->object->canShowSolutionPrintview($ilUser->getId())) { //$info->addFormButton("outUserListOfAnswerPasses", $this->lng->txt("tst_list_of_answers_show")); $big_button[] = array("outUserListOfAnswerPasses", $this->lng->txt("tst_list_of_answers_show")); } } } if (!$this->object->isOnline()) { $message = $this->lng->txt("test_is_offline"); if ($ilAccess->checkAccess("write", "", $this->ref_id)) { $message .= "<br /><a href=\"" . $this->ctrl->getLinkTarget($this, "properties") . "\">" . $this->lng->txt("test_edit_settings") . "</a>"; } ilUtil::sendInfo($message); } if ($this->object->getShowInfo()) { $info->enablePrivateNotes(); } /* if (strlen($this->object->getIntroduction())) { $info->addSection($this->lng->txt("tst_introduction")); $info->addProperty("", $this->object->prepareTextareaOutput($this->object->getIntroduction())); } * */ if ($big_button) { $out = '<div class="il_ButtonGroup il_BigButton">'; foreach ($big_button as $button) { $out .= '<input type="submit" class="submit il_BigButton" name="cmd[' . $button[0] . ']" value="' . $button[1] . '" />'; } $out .= '</div>'; $big_button = $out; } if (strlen($this->object->getIntroduction())) { $introduction = $this->object->getIntroduction(); $info->addSection($this->lng->txt("tst_introduction")); $info->addProperty("", $this->object->prepareTextareaOutput($this->object->getIntroduction()) . $big_button . "<br />" . $info->getHiddenToggleButton()); } else { $info->addSection(""); $info->addProperty("", $big_button . $info->getHiddenToggleButton()); } $info->addSection($this->lng->txt("tst_general_properties")); if ($this->object->getShowInfo()) { $info->addProperty($this->lng->txt("author"), $this->object->getAuthor()); $info->addProperty($this->lng->txt("title"), $this->object->getTitle()); } if ($this->object->isOnline() && $this->object->isComplete()) { if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) { if ($this->object->getShowInfo() || !$this->object->getForceJS()) { // use javascript $checked_javascript = false; if ($this->object->getJavaScriptOutput()) { $checked_javascript = true; } if ($this->object->getForceJS()) { $info->addProperty($this->lng->txt("tst_test_output"), $this->lng->txt("tst_use_javascript")); } else { $info->addPropertyCheckbox($this->lng->txt("tst_test_output"), "chb_javascript", 1, $this->lng->txt("tst_use_javascript"), $checked_javascript); } } // hide previous results if (!$this->object->isRandomTest()) { if ($this->object->getNrOfTries() != 1) { if ($this->object->getUsePreviousAnswers() == 0) { if ($this->object->getShowInfo()) { $info->addProperty($this->lng->txt("tst_use_previous_answers"), $this->lng->txt("tst_dont_use_previous_answers")); } } else { $use_previous_answers = FALSE; if ($ilUser->prefs["tst_use_previous_answers"]) { $checked_previous_answers = TRUE; } $info->addPropertyCheckbox($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers", 1, $this->lng->txt("tst_use_previous_answers_user"), $checked_previous_answers); } } } if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID) { $info->addPropertyTextinput($this->lng->txt("enter_anonymous_code"), "anonymous_id", "", 8, "setAnonymousId", $this->lng->txt("submit")); } } } $info->hideFurtherSections(false); if ($this->object->getShowInfo()) { $info->addSection($this->lng->txt("tst_sequence_properties")); $info->addProperty($this->lng->txt("tst_sequence"), $this->lng->txt($this->object->getSequenceSettings() == TEST_FIXED_SEQUENCE ? "tst_sequence_fixed" : "tst_sequence_postpone")); $info->addSection($this->lng->txt("tst_heading_scoring")); $info->addProperty($this->lng->txt("tst_text_count_system"), $this->lng->txt($this->object->getCountSystem() == COUNT_PARTIAL_SOLUTIONS ? "tst_count_partial_solutions" : "tst_count_correct_solutions")); $info->addProperty($this->lng->txt("tst_score_mcmr_questions"), $this->lng->txt($this->object->getMCScoring() == SCORE_ZERO_POINTS_WHEN_UNANSWERED ? "tst_score_mcmr_zero_points_when_unanswered" : "tst_score_mcmr_use_scoring_system")); if ($this->object->isRandomTest()) { $info->addProperty($this->lng->txt("tst_pass_scoring"), $this->lng->txt($this->object->getPassScoring() == SCORE_BEST_PASS ? "tst_pass_best_pass" : "tst_pass_last_pass")); } $info->addSection($this->lng->txt("tst_score_reporting")); $score_reporting_text = ""; switch ($this->object->getScoreReporting()) { case REPORT_AFTER_TEST: $score_reporting_text = $this->lng->txt("tst_report_after_test"); break; case REPORT_ALWAYS: $score_reporting_text = $this->lng->txt("tst_report_after_first_question"); break; case REPORT_AFTER_DATE: $score_reporting_text = $this->lng->txt("tst_report_after_date"); break; case 4: $score_reporting_text = $this->lng->txt("tst_report_never"); break; } $info->addProperty($this->lng->txt("tst_score_reporting"), $score_reporting_text); $reporting_date = $this->object->getReportingDate(); if ($reporting_date) { #preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $reporting_date, $matches); #$txt_reporting_date = date($this->lng->text["lang_dateformat"] . " " . $this->lng->text["lang_timeformat"], mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1])); #$info->addProperty($this->lng->txt("tst_score_reporting_date"), $txt_reporting_date); $info->addProperty($this->lng->txt('tst_score_reporting_date'), ilDatePresentation::formatDate(new ilDateTime($reporting_date, IL_CAL_TIMESTAMP))); } $info->addSection($this->lng->txt("tst_session_settings")); $info->addProperty($this->lng->txt("tst_nr_of_tries"), $this->object->getNrOfTries() == 0 ? $this->lng->txt("unlimited") : $this->object->getNrOfTries()); if ($this->object->getNrOfTries() != 1) { $info->addProperty($this->lng->txt("tst_nr_of_tries_of_user"), $this->object->getTestSession()->getPass() == false ? $this->lng->txt("tst_no_tries") : $this->object->getTestSession()->getPass()); } if ($this->object->getEnableProcessingTime()) { $info->addProperty($this->lng->txt("tst_processing_time"), $this->object->getProcessingTime()); } if (strlen($this->object->getAllowedUsers()) && $this->object->getAllowedUsersTimeGap()) { $info->addProperty($this->lng->txt("tst_allowed_users"), $this->object->getAllowedUsers()); } $starting_time = $this->object->getStartingTime(); if ($starting_time) { $info->addProperty($this->lng->txt("tst_starting_time"), ilDatePresentation::formatDate(new ilDateTime($starting_time, IL_CAL_TIMESTAMP))); } $ending_time = $this->object->getEndingTime(); if ($ending_time) { $info->addProperty($this->lng->txt("tst_ending_time"), ilDatePresentation::formatDate(new ilDateTime($ending_time, IL_CAL_TIMESTAMP))); } $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType()); // forward the command if ($_GET['crs_show_result'] and !$this->object->getTestSequence()->getFirstSequence()) { #ilUtil::sendInfo($this->lng->txt('crs_all_questions_answered_successfully')); } } $this->ctrl->forwardCommand($info); }
/** * @param $userId * @return string */ private function buildCacheKey($userId) { return "{$this->testOBJ->getTestId()}::{$userId}"; }
/** * removes all question set config related data for cloned/copied test * * @param ilObjTest $cloneTestOBJ */ public function cloneQuestionSetRelatedData($cloneTestOBJ) { // clone general config $this->loadFromDb(); $this->cloneToDbForTestId($cloneTestOBJ->getTestId()); // clone source pool definitions (selection rules) $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ); $sourcePoolDefinitionList->loadDefinitions(); $sourcePoolDefinitionList->cloneDefinitionsForTestId($cloneTestOBJ->getTestId()); // build new question stage for cloned test $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($cloneTestOBJ); $stagingPool = $this->buildStagingPoolBuilder($cloneTestOBJ); $sourcePoolDefinitionList->loadDefinitions(); $stagingPool->rebuild($sourcePoolDefinitionList); $sourcePoolDefinitionList->saveDefinitions(); $this->updateLastQuestionSyncTimestampForTestId($cloneTestOBJ->getTestId(), time()); }
protected function buildSessionKey() { return 'tst_password_' . $this->testOBJ->getTestId(); }
/** * removes all question set config related data for cloned/copied test * * @param ilObjTest $cloneTestOBJ */ public function cloneQuestionSetRelatedData($cloneTestOBJ) { $this->loadFromDb(); $this->saveToDbByTestId($cloneTestOBJ->getTestId()); $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList(); $sourcePoolDefinitionList->loadDefinitions(); $sourcePoolDefinitionList->saveDefinitionsByTestId($cloneTestOBJ->getTestId()); // TODO: implement cloning of staging pool and taxonomies (wasn't implemented all the time ^^) }
/** * show information screen */ function infoScreen($session_lock = "") { /** * @var $ilAccess ilAccessHandler * @var $ilUser ilObjUser * @var $ilToolbar ilToolbarGUI */ global $ilAccess, $ilUser, $ilToolbar; require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php'; require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php'; require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php'; $testQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig(); $testSession = $this->testSessionFactory->getSession(); $testSequence = $this->testSequenceFactory->getSequence($testSession); $testSequence->loadFromDb(); $testSequence->loadQuestions($testQuestionSetConfig, new ilTestDynamicQuestionSetFilterSelection()); $testPlayerGUI = $this->testPlayerFactory->getPlayerGUI(); if ($_GET['createRandomSolutions']) { $this->object->createRandomSolutions($_GET['createRandomSolutions']); } if (!$ilAccess->checkAccess("read", "", $this->ref_id)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE); } include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); if ($this->isCommandClassAnyInfoScreenChild()) { return $this->ctrl->forwardCommand($info); } $this->ctrl->setParameter($testPlayerGUI, "sequence", $testSession->getLastSequence()); $info->setFormAction($this->ctrl->getFormAction($testPlayerGUI)); if (strlen($session_lock)) { $info->addHiddenElement("lock", $session_lock); } else { $info->addHiddenElement("lock", md5($_COOKIE['PHPSESSID'] . time())); } $online_access = false; if ($this->object->getFixedParticipants()) { include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId()); if ($online_access_result === true) { $online_access = true; } else { ilUtil::sendInfo($online_access_result); } } $enter_anonymous_code = false; if ($this->object->isOnline() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) { if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) { $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE); if ($executable["executable"]) { if ($this->object->areObligationsEnabled() && $this->object->hasObligations($this->object->getTestId())) { ilUtil::sendInfo($GLOBALS['lng']->txt('tst_test_contains_obligatory_questions')); } if ($testSession->getActiveId() > 0) { // resume test require_once 'Modules/Test/classes/class.ilTestPassesSelector.php'; $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object); $testPassesSelector->setActiveId($testSession->getActiveId()); $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass()); $closedPasses = $testPassesSelector->getReportablePasses(); $existingPasses = $testPassesSelector->getExistingPasses(); if ($existingPasses > $closedPasses) { $btn = ilSubmitButton::getInstance(); $btn->setCaption('tst_resume_test'); $btn->setCommand('resumePlayer'); $btn->setPrimary(true); $big_button[] = $btn; } else { $btn = ilSubmitButton::getInstance(); $btn->setCaption($this->object->getStartTestLabel($testSession->getActiveId()), false); $btn->setCommand('startPlayer'); $btn->setPrimary(true); $big_button[] = $btn; } } else { // start new test $btn = ilSubmitButton::getInstance(); $btn->setCaption($this->object->getStartTestLabel($testSession->getActiveId()), false); $btn->setCommand('startPlayer'); $btn->setPrimary(true); $big_button[] = $btn; } } else { ilUtil::sendInfo($executable["errormessage"]); } if ($testSession->getActiveId() > 0) { // test results button require_once 'Modules/Test/classes/class.ilTestPassesSelector.php'; $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object); $testPassesSelector->setActiveId($testSession->getActiveId()); $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass()); if ($this->object->canShowTestResults($testSession, $ilUser->getId()) && count($testPassesSelector->getReportablePasses())) { $btn = ilLinkButton::getInstance(); $btn->setCaption('tst_show_results'); $btn->setUrl($this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserResultsOverview')); $btn->setPrimary(false); $big_button[] = $btn; if ($this->object->getHighscoreEnabled()) { // Can also compare results then $btn = ilSubmitButton::getInstance(); $btn->setCaption('tst_show_toplist'); $btn->setCommand('outResultsToplist'); $btn->setPrimary(false); $big_button[] = $btn; } if ($this->object->isSkillServiceToBeConsidered()) { require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php'; $btn = ilLinkButton::getInstance(); $btn->setCaption('tst_show_comp_results'); $btn->setUrl($this->ctrl->getLinkTargetByClass('ilTestSkillEvaluationGUI', ilTestSkillEvaluationGUI::CMD_SHOW)); $btn->setPrimary(false); $big_button[] = $btn; } } } } if ($testSession->getActiveId() > 0) { if ($this->object->canShowSolutionPrintview($ilUser->getId())) { $btn = ilSubmitButton::getInstance(); $btn->setCaption('tst_list_of_answers_show'); $btn->setCommand('outUserListOfAnswerPasses'); $btn->setPrimary(false); $big_button[] = $btn; } } if ($this->isDeleteDynamicTestResultsButtonRequired($testSession, $testSequence)) { $this->populateDeleteDynamicTestResultsButton($testSession, $big_button); } if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID) { $enter_anonymous_code = true; } } if (!$this->object->isOnline() && !$testQuestionSetConfig->areDepenciesBroken()) { $message = $this->lng->txt("test_is_offline"); if ($ilAccess->checkAccess("write", "", $this->ref_id)) { $message .= "<br /><a href=\"" . $this->ctrl->getLinkTargetByClass('ilobjtestsettingsgeneralgui') . "\">" . $this->lng->txt("test_edit_settings") . "</a>"; } ilUtil::sendInfo($message); } if ($ilAccess->checkAccess("write", "", $this->ref_id)) { $testQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig(); if ($testQuestionSetConfig->areDepenciesBroken()) { ilUtil::sendFailure($testQuestionSetConfig->getDepenciesBrokenMessage($this->lng)); $big_button = array(); $enter_anonymous_code = false; } elseif ($testQuestionSetConfig->areDepenciesInVulnerableState()) { ilUtil::sendInfo($testQuestionSetConfig->getDepenciesInVulnerableStateMessage($this->lng)); } } if ($this->object->getShowInfo()) { $info->enablePrivateNotes(); } if ($big_button || $enter_anonymous_code) { $ilToolbar->setFormAction($this->ctrl->getFormAction($testPlayerGUI)); foreach ($big_button as $button) { $ilToolbar->addButtonInstance($button); } if ($enter_anonymous_code) { if ($big_button) { $ilToolbar->addSeparator(); } require_once 'Services/Form/classes/class.ilTextInputGUI.php'; $anonymous_id = new ilTextInputGUI($this->lng->txt('enter_anonymous_code'), 'anonymous_id'); $anonymous_id->setSize(8); $ilToolbar->addInputItem($anonymous_id, true); $ilToolbar->addFormButton($this->lng->txt('submit'), 'setAnonymousId'); } $ilToolbar->setCloseFormTag(false); $info->setOpenFormTag(false); } if (strlen($this->object->getIntroduction())) { $info->addSection($this->lng->txt("tst_introduction")); $info->addProperty("", $this->object->prepareTextareaOutput($this->object->getIntroduction(), true) . $info->getHiddenToggleButton()); } else { $info->addSection(""); $info->addProperty("", $info->getHiddenToggleButton()); } $info->addSection($this->lng->txt("tst_general_properties")); if ($this->object->getShowInfo()) { $info->addProperty($this->lng->txt("author"), $this->object->getAuthor()); $info->addProperty($this->lng->txt("title"), $this->object->getTitle()); } if ($this->object->isOnline() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) { if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) { if ($this->object->getShowInfo() || !$this->object->getForceJS()) { // use javascript $checked_javascript = false; if ($this->object->getJavaScriptOutput()) { $checked_javascript = true; } } // hide previous results if (!$this->object->isRandomTest()) { if ($this->object->getNrOfTries() != 1) { if ($this->object->getUsePreviousAnswers() == 0) { if ($this->object->getShowInfo()) { $info->addProperty($this->lng->txt("tst_use_previous_answers"), $this->lng->txt("tst_dont_use_previous_answers")); } } else { $use_previous_answers = FALSE; if ($ilUser->prefs["tst_use_previous_answers"]) { $checked_previous_answers = TRUE; } $info->addPropertyCheckbox($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers", 1, $this->lng->txt("tst_use_previous_answers_user"), $checked_previous_answers); } } } } } $info->hideFurtherSections(false); if ($this->object->getShowInfo()) { $info->addSection($this->lng->txt("tst_sequence_properties")); $info->addProperty($this->lng->txt("tst_sequence"), $this->lng->txt($this->object->getSequenceSettings() == TEST_FIXED_SEQUENCE ? "tst_sequence_fixed" : "tst_sequence_postpone")); $info->addSection($this->lng->txt("tst_heading_scoring")); $info->addProperty($this->lng->txt("tst_text_count_system"), $this->lng->txt($this->object->getCountSystem() == COUNT_PARTIAL_SOLUTIONS ? "tst_count_partial_solutions" : "tst_count_correct_solutions")); $info->addProperty($this->lng->txt("tst_score_mcmr_questions"), $this->lng->txt($this->object->getMCScoring() == SCORE_ZERO_POINTS_WHEN_UNANSWERED ? "tst_score_mcmr_zero_points_when_unanswered" : "tst_score_mcmr_use_scoring_system")); if ($this->object->isRandomTest()) { $info->addProperty($this->lng->txt("tst_pass_scoring"), $this->lng->txt($this->object->getPassScoring() == SCORE_BEST_PASS ? "tst_pass_best_pass" : "tst_pass_last_pass")); } $info->addSection($this->lng->txt("tst_score_reporting")); $score_reporting_text = ""; switch ($this->object->getScoreReporting()) { case REPORT_AFTER_TEST: $score_reporting_text = $this->lng->txt("tst_report_after_test"); break; case REPORT_ALWAYS: $score_reporting_text = $this->lng->txt("tst_report_after_first_question"); break; case REPORT_AFTER_DATE: $score_reporting_text = $this->lng->txt("tst_report_after_date"); break; case 4: $score_reporting_text = $this->lng->txt("tst_report_never"); break; } $info->addProperty($this->lng->txt("tst_score_reporting"), $score_reporting_text); $reporting_date = $this->object->getReportingDate(); if ($reporting_date) { #preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $reporting_date, $matches); #$txt_reporting_date = date($this->lng->text["lang_dateformat"] . " " . $this->lng->text["lang_timeformat"], mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1])); #$info->addProperty($this->lng->txt("tst_score_reporting_date"), $txt_reporting_date); $info->addProperty($this->lng->txt('tst_score_reporting_date'), ilDatePresentation::formatDate(new ilDateTime($reporting_date, IL_CAL_TIMESTAMP))); } $info->addSection($this->lng->txt("tst_session_settings")); $info->addProperty($this->lng->txt("tst_nr_of_tries"), $this->object->getNrOfTries() == 0 ? $this->lng->txt("unlimited") : $this->object->getNrOfTries()); if ($this->object->getNrOfTries() != 1) { $info->addProperty($this->lng->txt("tst_nr_of_tries_of_user"), $testSession->getPass() == false ? $this->lng->txt("tst_no_tries") : $testSession->getPass()); } if ($this->object->getEnableProcessingTime()) { $info->addProperty($this->lng->txt("tst_processing_time"), $this->object->getProcessingTime()); } if (strlen($this->object->getAllowedUsers()) && $this->object->getAllowedUsersTimeGap()) { $info->addProperty($this->lng->txt("tst_allowed_users"), $this->object->getAllowedUsers()); } $starting_time = $this->object->getStartingTime(); if ($starting_time && $this->object->isStartingTimeEnabled()) { $info->addProperty($this->lng->txt("tst_starting_time"), ilDatePresentation::formatDate(new ilDateTime($starting_time, IL_CAL_TIMESTAMP))); } $ending_time = $this->object->getEndingTime(); if ($ending_time && $this->object->isEndingTimeEnabled()) { $info->addProperty($this->lng->txt("tst_ending_time"), ilDatePresentation::formatDate(new ilDateTime($ending_time, IL_CAL_TIMESTAMP))); } $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType()); // forward the command } $this->ctrl->forwardCommand($info); }