public function saveOrderAndObligationsObject() { 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"); } global $ilCtrl; $orders = $obligations = array(); foreach ($_REQUEST['order'] as $qId => $order) { $id = (int) str_replace('q_', '', $qId); $orders[$id] = $order; } if ($this->object->areObligationsEnabled() && isset($_REQUEST['obligatory']) && is_array($_REQUEST['obligatory'])) { foreach ($_REQUEST['obligatory'] as $qId => $obligation) { $id = (int) str_replace('q_', '', $qId); if (ilObjTest::isQuestionObligationPossible($id)) { $obligations[$id] = $obligation; } } } $this->object->setQuestionOrderAndObligations($orders, $obligations); $ilCtrl->redirect($this, 'questions'); }
/** * Returns the final statement for a user * * @param array An array containing the information on reached points, max points etc. ("test" key of ilObjTest::getTestResult) * @return string HTML code of the final statement * @access public */ function getFinalStatement($active_id) { $test_data_array = $this->object->getResultsForActiveId($active_id); $obligationsAnswered = $test_data_array['obligations_answered']; if (!$test_data_array["max_points"]) { $percentage = 0; } else { $percentage = $test_data_array["reached_points"] / $test_data_array["max_points"] * 100; } $total_max = $test_data_array["max_points"]; $total_reached = $test_data_array["reached_points"]; $result_percentage = $percentage; $result_total_reached = $total_reached; $result_total_max = $total_max; $mark = ""; $markects = ""; $mark_obj = $this->object->mark_schema->getMatchingMark($result_percentage); if ($mark_obj) { require_once './Modules/Test/classes/class.ilTestFinalMarkLangVarBuilder.php'; $langVarBuilder = new ilTestFinalMarkLangVarBuilder($mark_obj->getPassed(), $obligationsAnswered, $this->object->areObligationsEnabled()); $mark = $this->lng->txt($langVarBuilder->build()); $mark = str_replace("[mark]", $mark_obj->getOfficialName(), $mark); $mark = str_replace("[markshort]", $mark_obj->getShortName(), $mark); $mark = str_replace("[percentage]", sprintf("%.2f", $result_percentage), $mark); $mark = str_replace("[reached]", $result_total_reached, $mark); $mark = str_replace("[max]", $result_total_max, $mark); } if ($this->object->ects_output) { $passed_array =& $this->object->getTotalPointsPassedArray(); $ects_mark = $this->object->getECTSGrade($passed_array, $result_total_reached, $result_total_max); $markects = $this->lng->txt("mark_tst_ects"); $markects = str_replace("[markects]", $this->lng->txt("ects_grade_" . strtolower($ects_mark)), $markects); } return array("mark" => $mark, "markects" => $markects); }
public function build() { $this->initTemplate(); $this->loadResultData(); if ($this->testOBJ->isShowGradingStatusEnabled()) { $this->populateGradingStatus(); } if ($this->testOBJ->areObligationsEnabled()) { $this->populateObligationsStatus(); } if ($this->testOBJ->isShowGradingMarkEnabled()) { $this->populateGradingMark(); } if ($this->testOBJ->getECTSOutput()) { $this->populateEctsGrade(); } }
protected function isGradingMessageRequired() { if ($this->object->isShowGradingStatusEnabled()) { return true; } if ($this->object->isShowGradingMarkEnabled()) { return true; } if ($this->object->areObligationsEnabled()) { return true; } return false; }
protected function isGradingMessageRequired() { if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { return false; } if ($this->object->isShowGradingStatusEnabled()) { return true; } if ($this->object->isShowGradingMarkEnabled()) { return true; } if ($this->object->areObligationsEnabled()) { return true; } return false; }