4 include_once
'Modules/Test/classes/inc.AssessmentConstants.php';
5 include_once
'Modules/Test/classes/class.ilTestScoringGUI.php';
22 parent::__construct($a_object);
35 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
37 $this->ctrl->redirectByClass(
'ilobjtestgui',
'infoScreen');
40 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
43 $this->ctrl->redirectByClass(
'ilobjtestgui',
'infoScreen');
46 $cmd = $this->ctrl->getCmd(
'showManScoringByQuestionParticipantsTable');
47 $next_class = $this->ctrl->getNextClass($this);
50 $this->buildSubTabs(
'man_scoring_by_qst');
51 switch ($next_class) {
63 private function showManScoringByQuestionParticipantsTable($manPointsPost =
array())
69 global
$tpl, $ilAccess;
71 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
73 $this->ctrl->redirectByClass(
'ilobjtestgui',
'infoScreen');
76 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
79 include_once
'Services/YUI/classes/class.ilYuiUtil.php';
88 $tpl->addJavaScript(
"./Services/JavaScript/js/Basic.js");
89 $tpl->addJavaScript(
"./Services/Form/js/Form.js");
90 $tpl->addJavascript(
'./Services/UIComponent/Modal/js/Modal.js');
91 $tpl->addCss($this->
object->getTestStyleLocation(
"output"),
"screen");
93 $this->lng->toJSMap(
array(
'answer' => $this->lng->txt(
'answer')));
95 require_once
'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php';
98 $table->setManualScoringPointsPostData($manPointsPost);
100 $qst_id =
$table->getFilterItemByPostVar(
'question')->getValue();
101 $pass_id =
$table->getFilterItemByPostVar(
'pass')->getValue();
103 $table_data =
array();
105 $selected_questionData = null;
107 if (is_numeric($qst_id)) {
110 $selected_questionData =
$info;
112 if (in_array(
$type, $scoring)) {
113 $selected_questionData =
$info;
117 if ($selected_questionData && is_numeric($pass_id)) {
118 $data = $this->
object->getCompleteEvaluationData(
false);
120 foreach (
$data->getParticipants() as $active_id => $participant) {
121 $testResultData = $this->
object->getTestResult($active_id, $pass_id - 1);
122 foreach ($testResultData as $questionData) {
123 if (!isset($questionData[
'qid']) || $questionData[
'qid'] != $selected_questionData[
'question_id']) {
127 $table_data[] =
array(
128 'pass_id' => $pass_id - 1,
129 'active_id' => $active_id,
130 'qst_id' => $questionData[
'qid'],
133 'participant' => $participant,
138 $table->disable(
'header');
141 if ($selected_questionData) {
143 $table->setCurQuestionMaxPoints($maxpoints);
144 if ($maxpoints == 1) {
145 $maxpoints =
' (' . $maxpoints .
' ' . $this->lng->txt(
'point') .
')';
147 $maxpoints =
' (' . $maxpoints .
' ' . $this->lng->txt(
'points') .
')';
149 $table->setTitle($this->lng->txt(
'tst_man_scoring_by_qst') .
': ' . $selected_questionData[
'title'] . $maxpoints .
' [' . $this->lng->txt(
'question_id_short') .
': ' . $selected_questionData[
'question_id'] .
']');
151 $table->setTitle($this->lng->txt(
'tst_man_scoring_by_qst'));
154 $table->setData($table_data);
155 $tpl->setContent(
$table->getHTML());
158 public function saveManScoringByQuestion()
163 global $ilAccess,
$lng;
165 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
167 $this->ctrl->redirectByClass(
'ilobjtestgui',
'infoScreen');
170 if (!isset(
$_POST[
'scoring']) || !is_array(
$_POST[
'scoring'])) {
172 $this->showManScoringByQuestionParticipantsTable();
176 include_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
177 include_once
'Modules/Test/classes/class.ilObjTestAccess.php';
178 include_once
'Services/Tracking/classes/class.ilLPStatusWrapper.php';
180 $oneExceededMaxPoints =
false;
181 $manPointsPost =
array();
182 $skipParticipant =
array();
183 $maxPointsByQuestionId =
array();
184 foreach (
$_POST[
'scoring'] as
$pass => $active_ids) {
185 foreach ((
array) $active_ids as $active_id => $questions) {
187 if (!$this->
object->getTestResult($active_id,
$pass)) {
188 if (!isset($skipParticipant[
$pass])) {
192 $skipParticipant[
$pass][$active_id] =
true;
197 foreach ((
array) $questions as $qst_id => $reached_points) {
198 if (!isset($manPointsPost[
$pass])) {
202 if (!isset($manPointsPost[$pass][$active_id])) {
208 if ($reached_points > $maxPointsByQuestionId[$qst_id]) {
209 $oneExceededMaxPoints =
true;
212 $manPointsPost[
$pass][$active_id][$qst_id] = $reached_points;
217 if ($oneExceededMaxPoints) {
219 $this->showManScoringByQuestionParticipantsTable($manPointsPost);
223 $changed_one =
false;
224 $lastAndHopefullyCurrentQuestionId = null;
225 foreach (
$_POST[
'scoring'] as
$pass => $active_ids) {
226 foreach ((
array) $active_ids as $active_id => $questions) {
227 $update_participant =
false;
229 if ($skipParticipant[
$pass][$active_id]) {
233 foreach ((
array) $questions as $qst_id => $reached_points) {
238 $maxPointsByQuestionId[$qst_id],
241 $this->
object->areObligationsEnabled()
245 if ($update_participant) {
248 $lastAndHopefullyCurrentQuestionId = $qst_id;
260 if ($lastAndHopefullyCurrentQuestionId) {
262 $qTitle = $question->getTitle();
265 $this->lng->txt(
'tst_saved_manscoring_by_question_successfully'),
271 require_once
'./Modules/Test/classes/class.ilTestScoring.php';
273 $scorer->setPreserveManualScores(
true);
274 $scorer->recalculateSolutions();
277 $this->showManScoringByQuestionParticipantsTable();
285 require_once
'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php';
288 $table->writeFilterToSession();
289 $this->showManScoringByQuestionParticipantsTable();
297 require_once
'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php';
301 $this->showManScoringByQuestionParticipantsTable();
304 private function getAnswerDetail()
311 if (!$ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
315 $active_id =
$_GET[
'active_id'];
317 $question_id =
$_GET[
'qst_id'];
319 $data = $this->
object->getCompleteEvaluationData(
false);
320 $participant =
$data->getParticipant($active_id);
322 $question_gui = $this->
object->createQuestionGUI(
'', $question_id);
324 $tmp_tpl =
new ilTemplate(
'tpl.il_as_tst_correct_solution_output.html',
true,
true,
'Modules/Test');
325 $result_output = $question_gui->getSolutionOutput($active_id,
$pass,
false,
false,
false, $this->
object->getShowSolutionFeedback(),
false,
true);
326 $tmp_tpl->setVariable(
'TEXT_YOUR_SOLUTION', $this->lng->txt(
'answers_of') .
' ' . $participant->getName());
327 $maxpoints = $question_gui->object->getMaximumPoints();
329 $add_title =
' [' . $this->lng->txt(
'question_id_short') .
': ' . $question_id .
']';
331 if ($maxpoints == 1) {
332 $tmp_tpl->setVariable(
'QUESTION_TITLE', $this->
object->getQuestionTitle($question_gui->object->getTitle()) .
' (' . $maxpoints .
' ' . $this->lng->txt(
'point') .
')' . $add_title);
334 $tmp_tpl->setVariable(
'QUESTION_TITLE', $this->
object->getQuestionTitle($question_gui->object->getTitle()) .
' (' . $maxpoints .
' ' . $this->lng->txt(
'points') .
')' . $add_title);
336 $tmp_tpl->setVariable(
'SOLUTION_OUTPUT', $result_output);
337 $tmp_tpl->setVariable(
'RECEIVED_POINTS', sprintf($this->lng->txt(
'part_received_a_of_b_points'), $question_gui->object->getReachedPoints($active_id,
$pass), $maxpoints));
339 echo $tmp_tpl->get();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _getParticipantId($active_id)
Get user id for active id.
ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
executeCommand()
execute command
applyManScoringByQuestionFilter()
static _getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
static _getQuestionInfo($question_id)
Returns question information from the database.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static initOverlay(ilTemplate $a_main_tpl=null)
Init YUI Overlay module.
getCommand($cmd)
Retrieves the ilCtrl command.
static _mananuallyScoreableQuestionTypesExists()
Returns the fact wether manually scoreable question types exist or not.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
static _instantiateQuestion($question_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
resetManScoringByQuestionFilter()
Create new PHPExcel object
obj_idprivate
static _getManualScoring()
Retrieve the manual scoring settings.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
__construct(ilObjTest $a_object)
if(strpos($jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
if(empty($password)) $table
static _getReachedPoints($active_id, $question_id, $pass=null)
Returns the points, a learner has reached answering the question.
static initPanel($a_resize=false, ilTemplate $a_main_tpl=null)
Init yui panel.
ilTestScoringByQuestionsGUI
static _setReachedPoints($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
Sets the points, a learner has reached answering the question Additionally objective results are upda...