4 include_once
'Modules/Test/classes/inc.AssessmentConstants.php';
5 include_once
'Modules/Test/classes/class.ilTestScoringGUI.php';
33 return 'showManScoringByQuestionParticipantsTable';
41 return 'man_scoring_by_qst';
51 $tpl = $DIC->ui()->mainTemplate();
52 $ilAccess = $DIC->access();
57 false == $ilAccess->checkAccess(
"write",
"", $this->ref_id) &&
58 false == $ilAccess->checkAccess(
"man_scoring_access",
"", $this->ref_id)
61 $this->ctrl->redirectByClass(
'ilobjtestgui',
'infoScreen');
74 $tpl->addJavaScript(
"./Services/JavaScript/js/Basic.js");
75 $tpl->addJavaScript(
"./Services/Form/js/Form.js");
76 $tpl->addJavascript(
'./Services/UIComponent/Modal/js/Modal.js');
77 $this->lng->toJSMap([
'answer' => $this->lng->txt(
'answer')]);
80 $table->setManualScoringPointsPostData($manPointsPost);
82 $qst_id = $table->getFilterItemByPostVar(
'question')->getValue();
83 $passNr = $table->getFilterItemByPostVar(
'pass')->getValue();
84 $finalized_filter = $table->getFilterItemByPostVar(
'finalize_evaluation')->getValue();
85 $answered_filter = $table->getFilterItemByPostVar(
'only_answered')->getChecked();
87 $selected_questionData = null;
88 $complete_feedback = $this->
object->getCompleteManualFeedback($qst_id);
90 if (is_numeric($qst_id)) {
92 $selected_questionData = $info;
95 if ($selected_questionData && is_numeric($passNr)) {
96 $data = $this->
object->getCompleteEvaluationData(
false);
97 $participants =
$data->getParticipants();
106 $participant = $participants[$active_id];
107 $testResultData = $this->
object->getTestResult($active_id, $passNr - 1);
109 foreach ($testResultData as $questionData) {
112 if (isset($complete_feedback[$active_id][$passNr - 1][$qst_id])) {
113 $feedback = $complete_feedback[$active_id][$passNr - 1][$qst_id];
116 if (
false == isset($feedback[
'finalized_evaluation'])) {
117 $feedback[
'finalized_evaluation'] =
"";
121 ($finalized_filter != self::ONLY_FINALIZED || $feedback[
'finalized_evaluation'] == 1) &&
122 ($finalized_filter != self::EXCEPT_FINALIZED || $feedback[
'finalized_evaluation'] != 1);
124 $check_answered = ($answered_filter ==
false || $questionData[
'answered']);
127 isset($questionData[
'qid']) &&
128 $questionData[
'qid'] == $selected_questionData[
'question_id'] &&
133 'pass_id' => $passNr - 1,
134 'active_id' => $active_id,
135 'qst_id' => $questionData[
'qid'],
138 'name' => $participant->getName()
144 $table->disable(
'header');
147 $table->setTitle($this->lng->txt(
'tst_man_scoring_by_qst'));
149 if ($selected_questionData) {
151 $table->setCurQuestionMaxPoints($maxpoints);
152 $maxpoints =
' (' . $maxpoints .
' ' . $this->lng->txt(
'points') .
')';
153 if ($maxpoints == 1) {
154 $maxpoints =
' (' . $maxpoints .
' ' . $this->lng->txt(
'point') .
')';
158 $this->lng->txt(
'tst_man_scoring_by_qst') .
': ' . $selected_questionData[
'title'] . $maxpoints .
159 ' [' . $this->lng->txt(
'question_id_short') .
': ' . $selected_questionData[
'question_id'] .
']' 163 $table->setData($table_data);
164 $tpl->setContent($table->getHTML());
173 $ilAccess = $DIC->access();
176 false == $ilAccess->checkAccess(
"write",
"", $this->ref_id) &&
177 false == $ilAccess->checkAccess(
"man_scoring_access",
"", $this->ref_id)
180 echo $this->lng->txt(
'cannot_edit_test');
185 $this->ctrl->redirectByClass(
'ilobjtestgui',
'infoScreen');
188 if (
false == isset(
$_POST[
'scoring']) ||
false == is_array(
$_POST[
'scoring'])) {
195 $activeData = current(
$_POST[
'scoring']);
198 $skipParticipant = [];
199 $maxPointsByQuestionId = [];
208 $questions = $activeData[$active_id];
211 if (!$this->object->getTestResult($active_id,
$pass)) {
212 if (
false == isset($skipParticipant[
$pass])) {
213 $skipParticipant[
$pass] = [];
215 $skipParticipant[
$pass][$active_id] =
true;
220 foreach ((array) $questions as $qst_id => $reached_points) {
221 if (
false == isset($manPointsPost[
$pass])) {
222 $manPointsPost[
$pass] = [];
224 if (
false == isset($manPointsPost[$pass][$active_id])) {
225 $manPointsPost[
$pass][$active_id] = [];
237 if (isset($current_feedback_info[
'finalized_evaluation']) && $current_feedback_info[
'finalized_evaluation'] === 1) {
239 $feedback_text = $current_feedback_info[
'feedback'];
243 $manPointsPost[
$pass][$active_id][$qst_id] = $reached_points;
245 if ($reached_points > $maxPointsByQuestionId[$qst_id]) {
253 $changed_one =
false;
254 $lastAndHopefullyCurrentQuestionId = null;
257 $questions = $activeData[$active_id];
258 $update_participant =
false;
260 if (
false == $skipParticipant[
$pass][$active_id]) {
261 foreach ((array) $questions as $qst_id => $reached_points) {
266 if ($reached_points != $old_points) {
271 $maxPointsByQuestionId[$qst_id],
274 $this->object->areObligationsEnabled()
279 if ($update_participant) {
281 $this->object->getId(),
287 $lastAndHopefullyCurrentQuestionId = $qst_id;
291 $correction_feedback = [];
292 $correction_points = 0;
297 if ($lastAndHopefullyCurrentQuestionId) {
299 $qTitle = $question->getTitle();
303 $this->lng->txt(
'tst_saved_manscoring_by_question_successfully'),
308 ilUtil::sendSuccess($msg,
true);
310 if (isset($active_id)) {
311 $correction_feedback = $this->
object->getSingleManualFeedback($active_id, $qst_id,
$pass);
316 if ($ajax && is_array($correction_feedback)) {
318 $correction_feedback[
'finalized_on_date'] =
'';
320 if (strlen($correction_feedback[
'finalized_tstamp']) > 0) {
322 $correction_feedback[
'finalized_on_date'] = $time->get(
IL_CAL_DATETIME);
325 if (!$correction_feedback[
'feedback']) {
326 $correction_feedback[
'feedback'] = [];
328 if ($correction_feedback[
'finalized_evaluation'] == 1) {
329 $correction_feedback[
'finalized_evaluation'] = $this->lng->txt(
'yes');
331 $correction_feedback[
'finalized_evaluation'] = $this->lng->txt(
'no');
333 echo json_encode([
'feedback' => $correction_feedback,
'points' => $correction_points,
"translation" => [
'yes' => $this->lng->txt(
'yes'),
'no' => $this->lng->txt(
'no')]]);
346 $table->resetOffset();
347 $table->writeFilterToSession();
357 $table->resetOffset();
358 $table->resetFilter();
364 $active_id = (int)
$_GET[
'active_id'];
366 $question_id = (int)
$_GET[
'qst_id'];
368 if (!$this->
getTestAccess()->checkScoreParticipantsAccessForActiveId($active_id)) {
372 $data = $this->
object->getCompleteEvaluationData(
false);
373 $participant =
$data->getParticipant($active_id);
374 $question_gui = $this->
object->createQuestionGUI(
'', $question_id);
375 $tmp_tpl =
new ilTemplate(
'tpl.il_as_tst_correct_solution_output.html',
true,
true,
'Modules/Test');
376 if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id,
$pass)) {
377 $question_gui->setUseIntermediateSolution(
true);
378 $aresult_output = $question_gui->getSolutionOutput($active_id,
$pass,
false,
false,
true,
false,
false,
true);
379 $question_gui->setUseIntermediateSolution(
false);
380 $tmp_tpl->setVariable(
'TEXT_ASOLUTION_OUTPUT', $this->lng->txt(
'autosavecontent'));
381 $tmp_tpl->setVariable(
'ASOLUTION_OUTPUT', $aresult_output);
383 $result_output = $question_gui->getSolutionOutput(
389 $this->object->getShowSolutionFeedback(),
393 $max_points = $question_gui->object->getMaximumPoints();
400 $question_gui->object->getReachedPoints($active_id,
$pass),
404 $tmp_tpl->setVariable(
'TEXT_YOUR_SOLUTION', $this->lng->txt(
'answers_of') .
' ' . $participant->getName());
406 if ($this->object->getShowSolutionSuggested() && strlen($suggested_solution) > 0) {
407 $tmp_tpl->setVariable(
'TEXT_SOLUTION_HINT', $this->lng->txt(
"solution_hint"));
411 $tmp_tpl->setVariable(
'TEXT_SOLUTION_OUTPUT', $this->lng->txt(
'question'));
412 $tmp_tpl->setVariable(
'TEXT_RECEIVED_POINTS', $this->lng->txt(
'scoring'));
413 $add_title =
' [' . $this->lng->txt(
'question_id_short') .
': ' . $question_id .
']';
414 $question_title = $this->
object->getQuestionTitle($question_gui->object->getTitle());
415 $lng = $this->lng->txt(
'points');
416 if ($max_points == 1) {
417 $lng = $this->lng->txt(
'point');
420 $tmp_tpl->setVariable(
422 $question_title .
' (' . $max_points .
' ' .
$lng .
')' . $add_title
424 $tmp_tpl->setVariable(
'SOLUTION_OUTPUT', $result_output);
426 $tmp_tpl->setVariable(
429 $this->lng->txt(
'part_received_a_of_b_points'),
430 $question_gui->object->getReachedPoints($active_id,
$pass),
435 echo $tmp_tpl->get();
454 $ilAccess = $DIC->access();
456 $tmp_tpl->setVariable(
457 'TEXT_YOUR_SOLUTION',
458 $this->lng->txt(
'answers_of') .
' ' . $participant->getName()
462 $this->object->anonymity == 1 ||
463 ($this->object->getAnonymity() == 2 && !$ilAccess->checkAccess(
'write',
'', $this->object->getRefId()))
465 $tmp_tpl->setVariable(
466 'TEXT_YOUR_SOLUTION',
467 $this->lng->txt(
'answers_of') .
' ' . $this->lng->txt(
'anonymous')
480 $add_title =
' [' . $this->lng->txt(
'question_id_short') .
': ' . $question_id .
']';
481 $question_title = $this->
object->getQuestionTitle($title);
482 $lng = $this->lng->txt(
'points');
483 if ($max_points == 1) {
484 $lng = $this->lng->txt(
'point');
487 $tmp_tpl->setVariable(
489 $question_title .
' (' . $max_points .
' ' .
$lng .
')' . $add_title
504 $ilCtrl = $DIC->ctrl();
505 $post_var =
'[' .
$pass .
'][' . $active_id .
'][' . $question_id .
']';
506 $scoring_post_var =
'scoring' . $post_var;
509 $feedback = $this->
object->getSingleManualFeedback($active_id, $question_id,
$pass);
511 $form->setFormAction($ilCtrl->getFormAction($this,
'showManScoringByQuestionParticipantsTable'));
512 $form->setTitle($this->lng->txt(
'manscoring'));
514 if (isset($feedback[
'finalized_evaluation']) && $feedback[
'finalized_evaluation'] == 1) {
517 $scoring_post_var = $scoring_post_var .
'_disabled';
518 $hidden_points->setValue($reached_points);
519 $form->addItem($hidden_points);
523 if (array_key_exists(
'feedback', $feedback)) {
524 $feedback_text = $feedback[
'feedback'];
528 $feedback_input =
new ilNonEditableValueGUI($this->lng->txt(
'set_manual_feedback'),
'm_feedback' . $post_var,
true);
531 $feedback_input =
new ilTextAreaInputGUI($this->lng->txt(
'set_manual_feedback'),
'm_feedback' . $post_var);
533 $feedback_input->
setValue($feedback_text);
534 $form->addItem($feedback_input);
536 $reached_points_form =
new ilNumberInputGUI($this->lng->txt(
'tst_change_points_for_question'), $scoring_post_var);
538 $reached_points_form->setSize(5);
539 $reached_points_form->setMaxValue($max_points,
true);
540 $reached_points_form->setMinValue(0);
541 $reached_points_form->setDisabled($disable);
542 $reached_points_form->setValue($reached_points);
543 $reached_points_form->setClientSideValidation(
true);
544 $form->addItem($reached_points_form);
547 $hidden_points->setValue($max_points);
548 $form->addItem($hidden_points);
551 $hidden_points_name->setValue(
'scoring' . $post_var);
552 $form->addItem($hidden_points_name);
555 $hidden_feedback_name->setValue(
'm_feedback' . $post_var);
556 $form->addItem($hidden_feedback_name);
559 $post_id =
'__' .
$pass .
'____' . $active_id .
'____' . $question_id .
'__';
560 $hidden_feedback_id->setValue(
'm_feedback' . $post_id);
561 $form->addItem($hidden_feedback_id);
563 $evaluated =
new ilCheckboxInputGUI($this->lng->txt(
'finalized_evaluation'),
'evaluated' . $post_var);
564 if (isset($feedback[
'finalized_evaluation']) && $feedback[
'finalized_evaluation'] == 1) {
567 $form->addItem($evaluated);
569 $form->addCommandButton(
'checkConstraintsBeforeSaving', $this->lng->txt(
'save'));
573 $tmp_tpl->setVariable(
577 $tmp_tpl->setVariable(
579 $this->ctrl->getLinkTarget($this,
'checkConstraintsBeforeSaving',
'',
true,
false)
581 $tmp_tpl->setVariable(
582 'INFO_TEXT_MAX_POINTS_EXCEEDS',
583 sprintf($this->lng->txt(
'tst_manscoring_maxpoints_exceeded_input_alert'), $max_points)
595 $tmp_tpl->setVariable(
599 $tmp_tpl->setVariable(
602 $this->lng->txt(
'part_received_a_of_b_points'),
611 $feedback =
$_POST[
'feedback'];
612 if ($feedback === null || $feedback ===
'') {
613 $feedback =
$_POST[
'm_feedback'];
616 if ($feedback === null || $feedback ===
'') {
621 $feedback[$pass][$active_id][$qst_id],
637 $evaluated = (int)
$_POST[
'evaluated'][
$pass][$active_id][$qst_id];
638 if ($evaluated === 1) {
642 $this->
object->saveManualFeedback($active_id, $qst_id,
$pass, $feedback, $evaluated, $is_single_feedback);
654 isset(
$_POST[$post_value][
$pass][$active_id][$qst_id]) &&
655 strlen(
$_POST[$post_value][
$pass][$active_id][$qst_id]) > 0
showManScoringByQuestionParticipantsTable($manPointsPost=array())
static _getParticipantId($active_id)
Get user id for active id.
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI
static _lookupFullname($a_user_id)
Lookup Full Name.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
if(strpos($jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
const TAB_ID_MANUAL_SCORING
setValue($a_value)
Set Value.
appendUserNameToModal($tmp_tpl, $participant)
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
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.
appendFormToModal($tmp_tpl, $pass, $active_id, $question_id, $max_points)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
doesValueExistsInPostArray($post_value, $active_id, $qst_id, $pass)
appendSolutionAndPointsToModal($tmp_tpl, $result_output, $reached_points, $max_points)
static _getCurrentGUI(ilObjTest $a_test_obj=null)
Get the GUI that is used for the currently available selector (other GUI instances may exist for conf...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
appendQuestionTitleToModal($tmp_tpl, $question_id, $max_points, $title)
static _instantiateQuestion($question_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
checkConstraintsBeforeSaving()
saveFinalization($active_id, $qst_id, $pass, $feedback, $is_single_feedback)
static _getSuggestedSolutionOutput($question_id)
Returns the output of the suggested solution.
resetManScoringByQuestionFilter()
static initOverlay(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Overlay module.
This class represents a non editable value in a property form.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static getScoreParticipantsUserFilter($refId)
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
saveManScoringByQuestion($ajax=false)
__construct(ilObjTest $a_object)
static _getReachedPoints($active_id, $question_id, $pass=null)
Returns the points, a learner has reached answering the question.
retrieveFeedback(int $active_id, int $qst_id, int $pass)
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...
static getSingleManualFeedback($active_id, $question_id, $pass)
Retrieves the manual feedback for a question in a test.