ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTestScoringByQuestionsGUI Class Reference

ilTestScoringByQuestionsGUI More...

+ Inheritance diagram for ilTestScoringByQuestionsGUI:
+ Collaboration diagram for ilTestScoringByQuestionsGUI:

Public Member Functions

 __construct (ilObjTest $a_object)
 
 checkConstraintsBeforeSaving ()
 
- Public Member Functions inherited from ilTestServiceGUI
 isContextResultPresentation ()
 
 setContextResultPresentation ($contextResultPresentation)
 
 __construct (ilObjTest $a_object)
 The constructor takes the test object reference as parameter. More...
 
 setParticipantData ($participantData)
 
 getParticipantData ()
 
 getPassOverviewTableData (ilTestSession $testSession, $passes, $withResults)
 
 setObjectiveOrientedContainer (ilTestObjectiveOrientedContainer $objectiveOrientedContainer)
 
 getObjectiveOrientedContainer ()
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 Retrieves the ilCtrl command. More...
 
 buildPassOverviewTableGUI ($targetGUI)
 
 getPassListOfAnswers (&$result_array, $active_id, $pass, $show_solutions=false, $only_answered_questions=false, $show_question_only=false, $show_reached_points=false, $anchorNav=false, ilTestQuestionRelatedObjectivesList $objectivesList=null, ilTestResultHeaderLabelBuilder $testResultHeaderLabelBuilder=null)
 Returns the list of answers of a users test pass. More...
 
 getPassListOfAnswersWithScoring (&$result_array, $active_id, $pass, $show_solutions=false)
 Returns the list of answers of a users test pass and offers a scoring option. More...
 
 getResultsSignature ()
 Returns HTML code for a signature field. More...
 
 getAdditionalUsrDataHtmlAndPopulateWindowTitle ($testSession, $active_id, $overwrite_anonymity=false)
 Returns the user data for a test results output. More...
 
 getCorrectSolutionOutput ($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
 Returns an output of the solution to an answer compared to the correct solution. More...
 
 getResultsOfUserOutput ($testSession, $active_id, $pass, $targetGUI, $show_pass_details=true, $show_answers=true, $show_question_only=false, $show_reached_points=false)
 Output of the pass overview for a test called by a test participant. More...
 
 getResultsHeadUserAndPass ($active_id, $pass)
 Returns the user and pass data for a test results output. More...
 
 getQuestionResultForTestUsers ($question_id, $test_id)
 Creates a HTML representation for the results of a given question in a test. More...
 
 populatePassFinishDate ($tpl, $passFinishDate)
 
 populateExamId (ilTemplate $tpl, int $activeId, int $pass)
 
- Public Member Functions inherited from ilTestScoringGUI
 __construct (ilObjTest $a_object)
 ilTestScoringGUI constructor More...
 
 getTestAccess ()
 
 setTestAccess ($testAccess)
 
 executeCommand ()
 execute command More...
 

Data Fields

const ONLY_FINALIZED = 1
 
const EXCEPT_FINALIZED = 2
 
- Data Fields inherited from ilTestServiceGUI
 $object = null
 
 $service = null
 
 $lng
 
 $tpl
 
 $ctrl
 
 $ilias
 
 $tree
 
 $ref_id
 
- Data Fields inherited from ilTestScoringGUI
const PART_FILTER_ACTIVE_ONLY = 1
 
const PART_FILTER_INACTIVE_ONLY = 2
 
const PART_FILTER_ALL_USERS = 3
 
const PART_FILTER_MANSCORING_DONE = 4
 
const PART_FILTER_MANSCORING_NONE = 5
 

Protected Member Functions

 getDefaultCommand ()
 
 getActiveSubTabId ()
 
 showManScoringByQuestionParticipantsTable ($manPointsPost=array())
 
 saveManScoringByQuestion ($ajax=false)
 
 applyManScoringByQuestionFilter ()
 
 resetManScoringByQuestionFilter ()
 
 getAnswerDetail ()
 
 saveFeedback ($active_id, $qst_id, $pass, $is_single_feedback)
 
 saveFinalization ($active_id, $qst_id, $pass, $feedback, $is_single_feedback)
 
 doesValueExistsInPostArray ($post_value, $active_id, $qst_id, $pass)
 
- Protected Member Functions inherited from ilTestServiceGUI
 isPdfDeliveryRequest ()
 
 buildQuestionAnswerShuffler (string $question_id, string $active_id, string $active_pass)
 
 buildFixedShufflerSeedFromBasicSeed (string $basic_seed)
 
 getPassDetailsOverviewTableGUI ($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
 
 buildPassDetailsOverviewTableGUI ($targetGUI, $targetCMD)
 
 isGradingMessageRequired ()
 
 getGradingMessageBuilder ($activeId)
 
 buildQuestionRelatedObjectivesList (ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
 
 getFilteredTestResult ($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
 
 populateContent ($content)
 
 buildUserTestResultsToolbarGUI ()
 
 outCorrectSolutionCmd ()
 
 outCorrectSolution ()
 Creates an output of the solution of an answer compared to the correct solution. More...
 
 getDefaultCommand ()
 
 getActiveSubTabId ()
 

Private Member Functions

 appendUserNameToModal ($tmp_tpl, $participant)
 
 appendQuestionTitleToModal ($tmp_tpl, $question_id, $max_points, $title)
 
 appendFormToModal ($tmp_tpl, $pass, $active_id, $question_id, $max_points)
 
 appendSolutionAndPointsToModal ($tmp_tpl, $result_output, $reached_points, $max_points)
 

Additional Inherited Members

- Protected Attributes inherited from ilTestServiceGUI
const FIXED_SHUFFLER_SEED_MIN_LENGTH = 8
 
 $db
 
 $tabs
 
 $objCache
 
 $testSessionFactory = null
 
 $testSequenceFactory = null
 
 $participantData
 
- Protected Attributes inherited from ilTestScoringGUI
 $testAccess
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestScoringByQuestionsGUI::__construct ( ilObjTest  $a_object)
Parameters
ilObjTest$a_object

Reimplemented from ilTestScoringGUI.

Definition at line 23 of file class.ilTestScoringByQuestionsGUI.php.

24 {
25 parent::__construct($a_object);
26 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ appendFormToModal()

ilTestScoringByQuestionsGUI::appendFormToModal (   $tmp_tpl,
  $pass,
  $active_id,
  $question_id,
  $max_points 
)
private
Parameters
ilTemplate$tmp_tpl
$pass
$active_id
$question_id
$max_points

Definition at line 480 of file class.ilTestScoringByQuestionsGUI.php.

481 {
482 global $DIC;
483
484 $ilCtrl = $DIC->ctrl();
485 $post_var = '[' . $pass . '][' . $active_id . '][' . $question_id . ']';
486 $scoring_post_var = 'scoring' . $post_var;
487 $reached_points = assQuestion::_getReachedPoints($active_id, $question_id, $pass);
488 $form = new ilPropertyFormGUI();
489 $feedback = $this->object->getSingleManualFeedback($active_id, $question_id, $pass);
490 $disable = false;
491 $form->setFormAction($ilCtrl->getFormAction($this, 'showManScoringByQuestionParticipantsTable'));
492 $form->setTitle($this->lng->txt('manscoring'));
493
494 if (isset($feedback['finalized_evaluation']) && $feedback['finalized_evaluation'] == 1) {
495 $disable = true;
496 $hidden_points = new ilHiddenInputGUI($scoring_post_var);
497 $scoring_post_var = $scoring_post_var . '_disabled';
498 $hidden_points->setValue($reached_points);
499 $form->addItem($hidden_points);
500 }
501
502 $tmp_tpl->setVariable('TINYMCE_ACTIVE', ilObjAdvancedEditing::_getRichTextEditor());
503 $text_area = new ilTextAreaInputGUI($this->lng->txt('set_manual_feedback'), 'm_feedback' . $post_var);
504 $feedback_text = '';
505 if (array_key_exists('feedback', $feedback)) {
506 $feedback_text = $feedback['feedback'];
507 }
508 $text_area->setDisabled($disable);
509 $text_area->setValue($feedback_text);
510 $form->addItem($text_area);
511
512 $reached_points_form = new ilNumberInputGUI($this->lng->txt('tst_change_points_for_question'), $scoring_post_var);
513 $reached_points_form->allowDecimals(true);
514 $reached_points_form->setSize(5);
515 $reached_points_form->setMaxValue($max_points, true);
516 $reached_points_form->setMinValue(0);
517 $reached_points_form->setDisabled($disable);
518 $reached_points_form->setValue($reached_points);
519 $form->addItem($reached_points_form);
520
521 $hidden_points = new ilHiddenInputGUI('qst_max_points');
522 $hidden_points->setValue($max_points);
523 $form->addItem($hidden_points);
524
525 $hidden_points_name = new ilHiddenInputGUI('qst_hidden_points_name');
526 $hidden_points_name->setValue('scoring' . $post_var);
527 $form->addItem($hidden_points_name);
528
529 $hidden_feedback_name = new ilHiddenInputGUI('qst_hidden_feedback_name');
530 $hidden_feedback_name->setValue('m_feedback' . $post_var);
531 $form->addItem($hidden_feedback_name);
532
533 $hidden_feedback_id = new ilHiddenInputGUI('qst_hidden_feedback_id');
534 $post_id = '__' . $pass . '____' . $active_id . '____' . $question_id . '__';
535 $hidden_feedback_id->setValue('m_feedback' . $post_id);
536 $form->addItem($hidden_feedback_id);
537
538 $evaluated = new ilCheckboxInputGUI($this->lng->txt('finalized_evaluation'), 'evaluated' . $post_var);
539 if (isset($feedback['finalized_evaluation']) && $feedback['finalized_evaluation'] == 1) {
540 $evaluated->setChecked(true);
541 }
542 $form->addItem($evaluated);
543
544 $form->addCommandButton('checkConstraintsBeforeSaving', $this->lng->txt('save'));
545
546 $tmp_tpl->setVariable(
547 'MANUAL_FEEDBACK',
548 $form->getHTML()
549 );
550 $tmp_tpl->setVariable(
551 'MODAL_AJAX_URL',
552 $this->ctrl->getLinkTarget($this, 'checkConstraintsBeforeSaving', '', true, false)
553 );
554 $tmp_tpl->setVariable(
555 'INFO_TEXT_MAX_POINTS_EXCEEDS',
556 sprintf($this->lng->txt('tst_manscoring_maxpoints_exceeded_input_alert'), $max_points)
557 );
558 }
static _getReachedPoints($active_id, $question_id, $pass=null)
Returns the points, a learner has reached answering the question.
This class represents a checkbox property in a property form.
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
This class represents a property form user interface.
This class represents a text area property in a property form.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, $ilCtrl, $pass, assQuestion\_getReachedPoints(), and ilObjAdvancedEditing\_getRichTextEditor().

Referenced by getAnswerDetail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendQuestionTitleToModal()

ilTestScoringByQuestionsGUI::appendQuestionTitleToModal (   $tmp_tpl,
  $question_id,
  $max_points,
  $title 
)
private
Parameters
ilTemplate$tmp_tpl
$question_id
$max_points
$title

Definition at line 458 of file class.ilTestScoringByQuestionsGUI.php.

459 {
460 $add_title = ' [' . $this->lng->txt('question_id_short') . ': ' . $question_id . ']';
461 $question_title = $this->object->getQuestionTitle($title);
462 $lng = $this->lng->txt('points');
463 if ($max_points == 1) {
464 $lng = $this->lng->txt('point');
465 }
466
467 $tmp_tpl->setVariable(
468 'QUESTION_TITLE',
469 $question_title . ' (' . $max_points . ' ' . $lng . ')' . $add_title
470 );
471 }

References ilTestServiceGUI\$lng.

Referenced by getAnswerDetail().

+ Here is the caller graph for this function:

◆ appendSolutionAndPointsToModal()

ilTestScoringByQuestionsGUI::appendSolutionAndPointsToModal (   $tmp_tpl,
  $result_output,
  $reached_points,
  $max_points 
)
private
Parameters
ilTemplate$tmp_tpl
$result_output
$reached_points
$max_points

Definition at line 566 of file class.ilTestScoringByQuestionsGUI.php.

567 {
568 $tmp_tpl->setVariable(
569 'SOLUTION_OUTPUT',
570 $result_output
571 );
572 $tmp_tpl->setVariable(
573 'RECEIVED_POINTS',
574 sprintf(
575 $this->lng->txt('part_received_a_of_b_points'),
576 $reached_points,
577 $max_points
578 )
579 );
580 }

Referenced by getAnswerDetail().

+ Here is the caller graph for this function:

◆ appendUserNameToModal()

ilTestScoringByQuestionsGUI::appendUserNameToModal (   $tmp_tpl,
  $participant 
)
private
Parameters
ilTemplate$tmp_tpl
$participant

Definition at line 431 of file class.ilTestScoringByQuestionsGUI.php.

432 {
433 global $DIC;
434 $ilAccess = $DIC->access();
435
436 $tmp_tpl->setVariable(
437 'TEXT_YOUR_SOLUTION',
438 $this->lng->txt('answers_of') . ' ' . $participant->getName()
439 );
440
441 if (
442 $this->object->anonymity == 1 ||
443 ($this->object->getAnonymity() == 2 && !$ilAccess->checkAccess('write', '', $this->object->getRefId()))
444 ) {
445 $tmp_tpl->setVariable(
446 'TEXT_YOUR_SOLUTION',
447 $this->lng->txt('answers_of') . ' ' . $this->lng->txt('anonymous')
448 );
449 }
450 }

References $DIC.

Referenced by getAnswerDetail().

+ Here is the caller graph for this function:

◆ applyManScoringByQuestionFilter()

ilTestScoringByQuestionsGUI::applyManScoringByQuestionFilter ( )
protected

Definition at line 323 of file class.ilTestScoringByQuestionsGUI.php.

324 {
326 $table->resetOffset();
327 $table->writeFilterToSession();
329 }
showManScoringByQuestionParticipantsTable($manPointsPost=array())

References showManScoringByQuestionParticipantsTable().

+ Here is the call graph for this function:

◆ checkConstraintsBeforeSaving()

ilTestScoringByQuestionsGUI::checkConstraintsBeforeSaving ( )

Definition at line 422 of file class.ilTestScoringByQuestionsGUI.php.

423 {
424 $this->saveManScoringByQuestion(true);
425 }

References saveManScoringByQuestion().

+ Here is the call graph for this function:

◆ doesValueExistsInPostArray()

ilTestScoringByQuestionsGUI::doesValueExistsInPostArray (   $post_value,
  $active_id,
  $qst_id,
  $pass 
)
protected
Parameters
$post_value
$active_id
$qst_id
$pass
Returns
bool

Definition at line 623 of file class.ilTestScoringByQuestionsGUI.php.

624 {
625 return (
626 isset($_POST[$post_value][$pass][$active_id][$qst_id]) &&
627 strlen($_POST[$post_value][$pass][$active_id][$qst_id]) > 0
628 );
629 }
$_POST["username"]

References $_POST, and $pass.

Referenced by saveFeedback(), and saveFinalization().

+ Here is the caller graph for this function:

◆ getActiveSubTabId()

ilTestScoringByQuestionsGUI::getActiveSubTabId ( )
protected
Returns
string

Reimplemented from ilTestScoringGUI.

Definition at line 39 of file class.ilTestScoringByQuestionsGUI.php.

40 {
41 return 'man_scoring_by_qst';
42 }

◆ getAnswerDetail()

ilTestScoringByQuestionsGUI::getAnswerDetail ( )
protected

Definition at line 342 of file class.ilTestScoringByQuestionsGUI.php.

343 {
344 $active_id = (int) $_GET['active_id'];
345 $pass = (int) $_GET['pass_id'];
346 $question_id = (int) $_GET['qst_id'];
347
348 if (!$this->getTestAccess()->checkScoreParticipantsAccessForActiveId($active_id)) {
349 exit; // illegal ajax call
350 }
351
352 $data = $this->object->getCompleteEvaluationData(false);
353 $participant = $data->getParticipant($active_id);
354 $question_gui = $this->object->createQuestionGUI('', $question_id);
355 $tmp_tpl = new ilTemplate('tpl.il_as_tst_correct_solution_output.html', true, true, 'Modules/Test');
356 if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
357 $question_gui->setUseIntermediateSolution(true);
358 $aresult_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, true, false, false, true);
359 $question_gui->setUseIntermediateSolution(false);
360 $tmp_tpl->setVariable('TEXT_ASOLUTION_OUTPUT', $this->lng->txt('autosavecontent'));
361 $tmp_tpl->setVariable('ASOLUTION_OUTPUT', $aresult_output);
362 }
363 $result_output = $question_gui->getSolutionOutput(
364 $active_id,
365 $pass,
366 false,
367 false,
368 false,
369 $this->object->getShowSolutionFeedback(),
370 false,
371 true
372 );
373 $max_points = $question_gui->object->getMaximumPoints();
374
375 $this->appendUserNameToModal($tmp_tpl, $participant);
376 $this->appendQuestionTitleToModal($tmp_tpl, $question_id, $max_points, $question_gui->object->getTitle());
378 $tmp_tpl,
379 $result_output,
380 $question_gui->object->getReachedPoints($active_id, $pass),
381 $max_points
382 );
383 $this->appendFormToModal($tmp_tpl, $pass, $active_id, $question_id, $max_points);
384 $tmp_tpl->setVariable('TEXT_YOUR_SOLUTION', $this->lng->txt('answers_of') . ' ' . $participant->getName());
385 $suggested_solution = assQuestion::_getSuggestedSolutionOutput($question_id);
386 if ($this->object->getShowSolutionSuggested() && strlen($suggested_solution) > 0) {
387 $tmp_tpl->setVariable('TEXT_SOLUTION_HINT', $this->lng->txt("solution_hint"));
388 $tmp_tpl->setVariable("SOLUTION_HINT", assQuestion::_getSuggestedSolutionOutput($question_id));
389 }
390
391 $tmp_tpl->setVariable('TEXT_SOLUTION_OUTPUT', $this->lng->txt('question'));
392 $tmp_tpl->setVariable('TEXT_RECEIVED_POINTS', $this->lng->txt('scoring'));
393 $add_title = ' [' . $this->lng->txt('question_id_short') . ': ' . $question_id . ']';
394 $question_title = $this->object->getQuestionTitle($question_gui->object->getTitle());
395 $lng = $this->lng->txt('points');
396 if ($max_points == 1) {
397 $lng = $this->lng->txt('point');
398 }
399
400 $tmp_tpl->setVariable(
401 'QUESTION_TITLE',
402 $question_title . ' (' . $max_points . ' ' . $lng . ')' . $add_title
403 );
404 $tmp_tpl->setVariable('SOLUTION_OUTPUT', $result_output);
405
406 $tmp_tpl->setVariable(
407 'RECEIVED_POINTS',
408 sprintf(
409 $this->lng->txt('part_received_a_of_b_points'),
410 $question_gui->object->getReachedPoints($active_id, $pass),
411 $max_points
412 )
413 );
414
415 echo $tmp_tpl->get();
416 exit();
417 }
$_GET["client_id"]
static _getSuggestedSolutionOutput($question_id)
Returns the output of the suggested solution.
special template class to simplify handling of ITX/PEAR
appendQuestionTitleToModal($tmp_tpl, $question_id, $max_points, $title)
appendFormToModal($tmp_tpl, $pass, $active_id, $question_id, $max_points)
appendSolutionAndPointsToModal($tmp_tpl, $result_output, $reached_points, $max_points)
exit
Definition: login.php:29
$data
Definition: storeScorm.php:23

References $_GET, $data, ilTestServiceGUI\$lng, $pass, assQuestion\_getSuggestedSolutionOutput(), appendFormToModal(), appendQuestionTitleToModal(), appendSolutionAndPointsToModal(), appendUserNameToModal(), exit, and ilTestScoringGUI\getTestAccess().

+ Here is the call graph for this function:

◆ getDefaultCommand()

ilTestScoringByQuestionsGUI::getDefaultCommand ( )
protected
Returns
string

Reimplemented from ilTestScoringGUI.

Definition at line 31 of file class.ilTestScoringByQuestionsGUI.php.

32 {
33 return 'showManScoringByQuestionParticipantsTable';
34 }

◆ resetManScoringByQuestionFilter()

ilTestScoringByQuestionsGUI::resetManScoringByQuestionFilter ( )
protected

Definition at line 334 of file class.ilTestScoringByQuestionsGUI.php.

335 {
337 $table->resetOffset();
338 $table->resetFilter();
340 }

References showManScoringByQuestionParticipantsTable().

+ Here is the call graph for this function:

◆ saveFeedback()

ilTestScoringByQuestionsGUI::saveFeedback (   $active_id,
  $qst_id,
  $pass,
  $is_single_feedback 
)
protected
Parameters
$active_id
$qst_id
$pass
$is_single_feedback

Definition at line 588 of file class.ilTestScoringByQuestionsGUI.php.

589 {
590 $feedback = null;
591 if ($this->doesValueExistsInPostArray('feedback', $active_id, $qst_id, $pass)) {
592 $feedback = ilUtil::stripSlashes($_POST['feedback'][$pass][$active_id][$qst_id]);
593 } elseif ($this->doesValueExistsInPostArray('m_feedback', $active_id, $qst_id, $pass)) {
594 $feedback = ilUtil::stripSlashes($_POST['m_feedback'][$pass][$active_id][$qst_id]);
595 }
596 $this->saveFinalization($active_id, $qst_id, $pass, $feedback, $is_single_feedback);
597 }
saveFinalization($active_id, $qst_id, $pass, $feedback, $is_single_feedback)
doesValueExistsInPostArray($post_value, $active_id, $qst_id, $pass)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, $pass, doesValueExistsInPostArray(), saveFinalization(), and ilUtil\stripSlashes().

Referenced by saveManScoringByQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFinalization()

ilTestScoringByQuestionsGUI::saveFinalization (   $active_id,
  $qst_id,
  $pass,
  $feedback,
  $is_single_feedback 
)
protected
Parameters
$active_id
$qst_id
$pass
$feedback

Definition at line 605 of file class.ilTestScoringByQuestionsGUI.php.

606 {
607 $evaluated = false;
608 if ($this->doesValueExistsInPostArray('evaluated', $active_id, $qst_id, $pass)) {
609 $evaluated = (int) $_POST['evaluated'][$pass][$active_id][$qst_id];
610 if ($evaluated === 1) {
611 $evaluated = true;
612 }
613 }
614 $this->object->saveManualFeedback($active_id, $qst_id, $pass, $feedback, $evaluated, $is_single_feedback);
615 }

References $_POST, $pass, and doesValueExistsInPostArray().

Referenced by saveFeedback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveManScoringByQuestion()

ilTestScoringByQuestionsGUI::saveManScoringByQuestion (   $ajax = false)
protected
Parameters
bool$ajax

Definition at line 168 of file class.ilTestScoringByQuestionsGUI.php.

169 {
170 global $DIC;
171 $ilAccess = $DIC->access();
172
173 if (
174 false == $ilAccess->checkAccess("write", "", $this->ref_id) &&
175 false == $ilAccess->checkAccess("man_scoring_access", "", $this->ref_id)
176 ) {
177 if ($ajax) {
178 echo $this->lng->txt('cannot_edit_test');
179 exit();
180 }
181
182 ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
183 $this->ctrl->redirectByClass('ilobjtestgui', 'infoScreen');
184 }
185
186 if (false == isset($_POST['scoring']) || false == is_array($_POST['scoring'])) {
187 ilUtil::sendFailure($this->lng->txt('tst_save_manscoring_failed_unknown'));
189 return;
190 }
191
192 $pass = key($_POST['scoring']);
193 $activeData = current($_POST['scoring']);
194 $participantData = new ilTestParticipantData($DIC->database(), $DIC->language());
195 $oneExceededMaxPoints = false;
196 $manPointsPost = [];
197 $skipParticipant = [];
198 $maxPointsByQuestionId = [];
199
200 $participantData->setActiveIdsFilter(array_keys($activeData));
201 $participantData->setParticipantAccessFilter(
203 );
204 $participantData->load($this->object->getTestId());
205
206 foreach ($participantData->getActiveIds() as $active_id) {
207 $questions = $activeData[$active_id];
208
209 // check for existing test result data
210 if (!$this->object->getTestResult($active_id, $pass)) {
211 if (false == isset($skipParticipant[$pass])) {
212 $skipParticipant[$pass] = [];
213 }
214 $skipParticipant[$pass][$active_id] = true;
215
216 continue;
217 }
218
219 foreach ((array) $questions as $qst_id => $reached_points) {
220 $this->saveFeedback($active_id, $qst_id, $pass, $ajax);
221
222 if (false == isset($manPointsPost[$pass])) {
223 $manPointsPost[$pass] = [];
224 }
225 if (false == isset($manPointsPost[$pass][$active_id])) {
226 $manPointsPost[$pass][$active_id] = [];
227 }
228 $maxPointsByQuestionId[$qst_id] = assQuestion::_getMaximumPoints($qst_id);
229 $manPointsPost[$pass][$active_id][$qst_id] = $reached_points;
230 if ($reached_points > $maxPointsByQuestionId[$qst_id]) {
231 $oneExceededMaxPoints = true;
232 }
233 }
234 }
235
236 if ($oneExceededMaxPoints) {
237 ilUtil::sendFailure(sprintf($this->lng->txt('tst_save_manscoring_failed'), $pass + 1));
238 $this->showManScoringByQuestionParticipantsTable($manPointsPost);
239 return;
240 }
241
242 $changed_one = false;
243 $lastAndHopefullyCurrentQuestionId = null;
244
245 foreach ($participantData->getActiveIds() as $active_id) {
246 $questions = $activeData[$active_id];
247 $update_participant = false;
248
249 if (false == $skipParticipant[$pass][$active_id]) {
250 foreach ((array) $questions as $qst_id => $reached_points) {
251 $this->saveFeedback($active_id, $qst_id, $pass, $ajax);
252 $update_participant = assQuestion::_setReachedPoints(
253 $active_id,
254 $qst_id,
255 $reached_points,
256 $maxPointsByQuestionId[$qst_id],
257 $pass,
258 1,
259 $this->object->areObligationsEnabled()
260 );
261 }
262
263 if ($update_participant) {
264 $changed_one = true;
265 $lastAndHopefullyCurrentQuestionId = $qst_id;
266
268 $this->object->getId(),
270 );
271 }
272 }
273 }
274
275 $correction_feedback = [];
276 $correction_points = 0;
277
278 if ($changed_one) {
279 $qTitle = '';
280
281 if ($lastAndHopefullyCurrentQuestionId) {
282 $question = assQuestion::_instantiateQuestion($lastAndHopefullyCurrentQuestionId);
283 $qTitle = $question->getTitle();
284 }
285
286 $msg = sprintf(
287 $this->lng->txt('tst_saved_manscoring_by_question_successfully'),
288 $qTitle,
289 $pass + 1
290 );
291
292 ilUtil::sendSuccess($msg, true);
293
294 if (isset($active_id)) {
295 $correction_feedback = $this->object->getSingleManualFeedback($active_id, $qst_id, $pass);
296 $correction_points = assQuestion::_getReachedPoints($active_id, $qst_id, $pass);
297 }
298 }
299
300 if ($ajax && is_array($correction_feedback)) {
301 $correction_feedback['finalized_by'] = ilObjUser::_lookupFullname($correction_feedback['finalized_by_usr_id']);
302 $correction_feedback['finalized_on_date'] = '';
303
304 if (strlen($correction_feedback['finalized_tstamp']) > 0) {
305 $time = new ilDateTime($correction_feedback['finalized_tstamp'], IL_CAL_UNIX);
306 $correction_feedback['finalized_on_date'] = $time->get(IL_CAL_DATETIME);
307 }
308
309 if (!$correction_feedback['feedback']) {
310 $correction_feedback['feedback'] = [];
311 }
312
313 echo json_encode([ 'feedback' => $correction_feedback, 'points' => $correction_points, "translation" => ['yes' => $this->lng->txt('yes'), 'no' => $this->lng->txt('no')]]);
314 exit();
315 } else {
317 }
318 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
static _instantiateQuestion($question_id)
static _getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
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...
@classDescription Date and time handling
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _getParticipantId($active_id)
Get user id for active id.
static _lookupFullname($a_user_id)
Lookup Full Name.
saveFeedback($active_id, $qst_id, $pass, $is_single_feedback)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_POST, $DIC, ilTestServiceGUI\$participantData, $pass, assQuestion\_getMaximumPoints(), ilObjTestAccess\_getParticipantId(), assQuestion\_getReachedPoints(), assQuestion\_instantiateQuestion(), ilObjUser\_lookupFullname(), assQuestion\_setReachedPoints(), ilLPStatusWrapper\_updateStatus(), exit, ilTestParticipantAccessFilter\getScoreParticipantsUserFilter(), IL_CAL_DATETIME, IL_CAL_UNIX, saveFeedback(), ilUtil\sendFailure(), ilUtil\sendInfo(), and showManScoringByQuestionParticipantsTable().

Referenced by checkConstraintsBeforeSaving().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showManScoringByQuestionParticipantsTable()

ilTestScoringByQuestionsGUI::showManScoringByQuestionParticipantsTable (   $manPointsPost = array())
protected
Parameters
array$manPointsPost

Definition at line 47 of file class.ilTestScoringByQuestionsGUI.php.

48 {
49 global $DIC;
50
51 $tpl = $DIC->ui()->mainTemplate();
52 $ilAccess = $DIC->access();
53
55
56 if (
57 false == $ilAccess->checkAccess("write", "", $this->ref_id) &&
58 false == $ilAccess->checkAccess("man_scoring_access", "", $this->ref_id)
59 ) {
60 ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
61 $this->ctrl->redirectByClass('ilobjtestgui', 'infoScreen');
62 }
63
67
68 $mathJaxSetting = new ilSetting('MathJax');
69
70 if ($mathJaxSetting->get("enable")) {
71 $tpl->addJavaScript($mathJaxSetting->get("path_to_mathjax"));
72 }
73
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 $tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
78 $this->lng->toJSMap(['answer' => $this->lng->txt('answer')]);
79
81 $table->setManualScoringPointsPostData($manPointsPost);
82
83 $qst_id = $table->getFilterItemByPostVar('question')->getValue();
84 $passNr = $table->getFilterItemByPostVar('pass')->getValue();
85 $finalized_filter = $table->getFilterItemByPostVar('finalize_evaluation')->getValue();
86 $table_data = [];
87 $selected_questionData = null;
88 $complete_feedback = $this->object->getCompleteManualFeedback($qst_id);
89
90 if (is_numeric($qst_id)) {
91 $info = assQuestion::_getQuestionInfo($qst_id);
92 $selected_questionData = $info;
93 }
94
95 if ($selected_questionData && is_numeric($passNr)) {
96 $data = $this->object->getCompleteEvaluationData(false);
97 $participants = $data->getParticipants();
98 $participantData = new ilTestParticipantData($DIC->database(), $DIC->language());
99 $participantData->setActiveIdsFilter(array_keys($data->getParticipants()));
100 $participantData->setParticipantAccessFilter(
102 );
103 $participantData->load($this->object->getTestId());
104
105 foreach ($participantData->getActiveIds() as $active_id) {
106 $participant = $participants[$active_id];
107 $testResultData = $this->object->getTestResult($active_id, $passNr - 1);
108
109 foreach ($testResultData as $questionData) {
110 $feedback = [];
111
112 if (isset($complete_feedback[$active_id][$passNr - 1][$qst_id])) {
113 $feedback = $complete_feedback[$active_id][$passNr - 1][$qst_id];
114 }
115
116 if (false == isset($feedback['finalized_evaluation'])) {
117 $feedback['finalized_evaluation'] = "";
118 }
119
120 $check_filter =
121 ($finalized_filter != self::ONLY_FINALIZED || $feedback['finalized_evaluation'] == 1) &&
122 ($finalized_filter != self::EXCEPT_FINALIZED || $feedback['finalized_evaluation'] != 1);
123
124 if (
125 isset($questionData['qid']) &&
126 $questionData['qid'] == $selected_questionData['question_id'] &&
127 $check_filter
128 ) {
129 $table_data[] = [
130 'pass_id' => $passNr - 1,
131 'active_id' => $active_id,
132 'qst_id' => $questionData['qid'],
133 'reached_points' => assQuestion::_getReachedPoints($active_id, $questionData['qid'], $passNr - 1),
134 'maximum_points' => assQuestion::_getMaximumPoints($questionData['qid']),
135 'participant' => $participant,
136 'feedback' => $feedback,
137 ];
138 }
139 }
140 }
141 } else {
142 $table->disable('header');
143 }
144
145 $table->setTitle($this->lng->txt('tst_man_scoring_by_qst'));
146
147 if ($selected_questionData) {
148 $maxpoints = assQuestion::_getMaximumPoints($selected_questionData['question_id']);
149 $table->setCurQuestionMaxPoints($maxpoints);
150 $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')';
151 if ($maxpoints == 1) {
152 $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')';
153 }
154
155 $table->setTitle(
156 $this->lng->txt('tst_man_scoring_by_qst') . ': ' . $selected_questionData['title'] . $maxpoints .
157 ' [' . $this->lng->txt('question_id_short') . ': ' . $selected_questionData['question_id'] . ']'
158 );
159 }
160
161 $table->setData($table_data);
162 $tpl->setContent($table->getHTML());
163 }
static _getQuestionInfo($question_id)
Returns question information from the database.
ILIAS Setting Class.
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
static initOverlay(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Overlay module.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
if(strpos( $jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:32

References $data, $DIC, $mathJaxSetting, ilTestServiceGUI\$participantData, ilTestServiceGUI\$tpl, assQuestion\_getMaximumPoints(), assQuestion\_getQuestionInfo(), assQuestion\_getReachedPoints(), ilTestParticipantAccessFilter\getScoreParticipantsUserFilter(), iljQueryUtil\initjQuery(), ilYuiUtil\initOverlay(), ilYuiUtil\initPanel(), ilUtil\sendInfo(), and ilTestTabsManager\TAB_ID_MANUAL_SCORING.

Referenced by applyManScoringByQuestionFilter(), resetManScoringByQuestionFilter(), and saveManScoringByQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ EXCEPT_FINALIZED

const ilTestScoringByQuestionsGUI::EXCEPT_FINALIZED = 2

Definition at line 18 of file class.ilTestScoringByQuestionsGUI.php.

◆ ONLY_FINALIZED

const ilTestScoringByQuestionsGUI::ONLY_FINALIZED = 1

Definition at line 17 of file class.ilTestScoringByQuestionsGUI.php.


The documentation for this class was generated from the following file: