ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestServiceGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
5 include_once 'Modules/Test/classes/class.ilTestService.php';
6 
22 {
26  public $object = null;
27 
31  public $service = null;
32 
36  protected $db;
37 
38  public $lng;
39  public $tpl;
40 
44  public $ctrl;
45 
49  protected $tabs;
50 
54  protected $objCache;
55 
56  public $ilias;
57  public $tree;
58  public $ref_id;
59 
65  protected $testSessionFactory = null;
66 
72  protected $testSequenceFactory = null;
73 
77  protected $participantData;
78 
83 
85 
89  public function isContextResultPresentation()
90  {
92  }
93 
98  {
99  $this->contextResultPresentation = $contextResultPresentation;
100  }
101 
108  public function __construct(ilObjTest $a_object)
109  {
110  global $DIC;
111  $lng = $DIC['lng'];
112  $tpl = $DIC['tpl'];
113  $ilCtrl = $DIC['ilCtrl'];
114  $ilias = $DIC['ilias'];
115  $tree = $DIC['tree'];
116  $ilDB = $DIC['ilDB'];
117  $ilPluginAdmin = $DIC['ilPluginAdmin'];
118  $ilTabs = $DIC['ilTabs'];
119  $ilObjDataCache = $DIC['ilObjDataCache'];
120 
121  $lng->loadLanguageModule('cert');
122 
123  $this->db = $ilDB;
124  $this->lng = &$lng;
125  $this->tpl = &$tpl;
126  $this->ctrl = &$ilCtrl;
127  $this->tabs = $ilTabs;
128  $this->objCache = $ilObjDataCache;
129  $this->ilias = &$ilias;
130  $this->object = &$a_object;
131  $this->tree = &$tree;
132  $this->ref_id = $a_object->ref_id;
133 
134  $this->service = new ilTestService($a_object);
135 
136  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
137  $this->testSessionFactory = new ilTestSessionFactory($this->object);
138 
139  require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
140  $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
141 
142  $this->objectiveOrientedContainer = null;
143  }
144 
149  {
150  $this->participantData = $participantData;
151  }
152 
156  public function getParticipantData()
157  {
158  return $this->participantData;
159  }
160 
166  public function getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults)
167  {
168  $data = array();
169 
170  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
171  $considerHiddenQuestions = false;
172 
173  require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
174  $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
175  } else {
176  $considerHiddenQuestions = true;
177  }
178 
179  $scoredPass = $this->object->_getResultPass($testSession->getActiveId());
180 
181  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
183  $testSession->getActiveId()
184  );
185 
186  foreach ($passes as $pass) {
187  $row = array();
188 
189  $considerOptionalQuestions = true;
190 
191  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
192  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->getActiveId(), $pass);
193 
194  $testSequence->loadFromDb();
195  $testSequence->loadQuestions();
196 
197  if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) {
198  $considerOptionalQuestions = false;
199  }
200 
201  $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
202  $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
203 
204  $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
205  $objectivesList->loadObjectivesTitles();
206 
207  $row['objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions());
208  }
209 
210  if ($withResults) {
211  $result_array = $this->object->getTestResult($testSession->getActiveId(), $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
212 
213  foreach ($result_array as $resultStructKEY => $question) {
214  if ($resultStructKEY === 'test' || $resultStructKEY === 'pass') {
215  continue;
216  }
217 
218  $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question['qid']);
219 
220  if ($requestData instanceof ilAssQuestionHintRequestStatisticData && $result_array[$resultStructKEY]['requested_hints'] === null) {
221  $result_array['pass']['total_requested_hints'] += $requestData->getRequestsCount();
222 
223  $result_array[$resultStructKEY]['requested_hints'] = $requestData->getRequestsCount();
224  $result_array[$resultStructKEY]['hint_points'] = $requestData->getRequestsPoints();
225  }
226  }
227 
228  if (!$result_array['pass']['total_max_points']) {
229  $percentage = 0;
230  } else {
231  $percentage = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
232  }
233  $total_max = $result_array['pass']['total_max_points'];
234  $total_reached = $result_array['pass']['total_reached_points'];
235  $total_requested_hints = $result_array['pass']['total_requested_hints'];
236  }
237 
238  if ($withResults) {
239  $row['scored'] = ($pass == $scoredPass);
240  }
241 
242  $row['pass'] = $pass;
243  $row['date'] = ilObjTest::lookupLastTestPassAccess($testSession->getActiveId(), $pass);
244  if ($withResults) {
245  $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
246  $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
247 
248  if ($this->object->isOfferingQuestionHintsEnabled()) {
249  $row['hints'] = $total_requested_hints;
250  }
251 
252  $row['reached_points'] = $total_reached;
253  $row['max_points'] = $total_max;
254  $row['percentage'] = $percentage;
255  }
256 
257  $data[] = $row;
258  }
259 
260  return $data;
261  }
262 
267  {
268  $this->objectiveOrientedContainer = $objectiveOrientedContainer;
269  }
270 
275  {
277  }
278 
282  public function executeCommand()
283  {
284  $cmd = $this->ctrl->getCmd();
285  $next_class = $this->ctrl->getNextClass($this);
286 
287  $cmd = $this->getCommand($cmd);
288  switch ($next_class) {
289  default:
290  $ret = &$this->$cmd();
291  break;
292  }
293  return $ret;
294  }
295 
301  public function getCommand($cmd)
302  {
303  return $cmd;
304  }
305 
309  protected function isPdfDeliveryRequest()
310  {
311  if (!isset($_GET['pdf'])) {
312  return false;
313  }
314 
315  if (!(bool) $_GET['pdf']) {
316  return false;
317  }
318 
319  return true;
320  }
321 
325  public function buildPassOverviewTableGUI($targetGUI)
326  {
327  require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
328 
329  $table = new ilTestPassOverviewTableGUI($targetGUI, '');
330 
331  $table->setPdfPresentationEnabled(
332  isset($_GET['pdf']) && $_GET['pdf'] == 1
333  );
334 
335  $table->setObjectiveOrientedPresentationEnabled(
336  $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
337  );
338 
339  return $table;
340  }
341 
352  public function 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)
353  {
354  $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
355 
356  $counter = 1;
357  // output of questions with solutions
358  foreach ($result_array as $question_data) {
359  if (($question_data["workedthrough"] == 1) || ($only_answered_questions == false)) {
360  $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
361  $question = $question_data["qid"];
362  if (is_numeric($question)) {
363  $maintemplate->setCurrentBlock("printview_question");
364  $question_gui = $this->object->createQuestionGUI("", $question);
365  if (is_object($question_gui)) {
366  if ($this->isPdfDeliveryRequest()) {
367  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
368  }
369 
370  if ($anchorNav) {
371  $template->setCurrentBlock('block_id');
372  $template->setVariable('BLOCK_ID', "detailed_answer_block_act_{$active_id}_qst_{$question}");
373  $template->parseCurrentBlock();
374 
375  $template->setCurrentBlock('back_anchor');
376  $template->setVariable('HREF_BACK_ANCHOR', "#pass_details_tbl_row_act_{$active_id}_qst_{$question}");
377  $template->setVariable('TXT_BACK_ANCHOR', $this->lng->txt('tst_back_to_question_list'));
378  $template->parseCurrentBlock();
379  }
380 
381  if ($show_reached_points) {
382  $template->setCurrentBlock("result_points");
383  $template->setVariable("RESULT_POINTS", $this->lng->txt("tst_reached_points") . ": " . $question_gui->object->getReachedPoints($active_id, $pass) . " " . $this->lng->txt("of") . " " . $question_gui->object->getMaximumPoints());
384  $template->parseCurrentBlock();
385  }
386  $template->setVariable("COUNTER_QUESTION", $counter . ". ");
387  $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
388  $template->setVariable("QUESTION_ID", $question_gui->object->getId());
389  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
390 
391  if ($objectivesList !== null) {
392  $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
393  $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
394  $template->setVariable("OBJECTIVES", $objectives);
395  }
396 
397  $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
398 
399  $showFeedback = $this->isContextResultPresentation() && $this->object->getShowSolutionFeedback();
400  $show_solutions = $this->isContextResultPresentation() && $show_solutions;
401 
402  if ($show_solutions) {
403  $compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', true, true, 'Modules/Test');
404  $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
405  $compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
406  $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $showFeedback);
407  $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true);
408 
409  $compare_template->setVariable('PARTICIPANT', $result_output);
410  $compare_template->setVariable('SOLUTION', $best_output);
411  if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
412  $question_gui->setUseIntermediateSolution(true);
413  $intermediate_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, true, $showFeedback);
414  $question_gui->setUseIntermediateSolution(false);
415  $compare_template->setVariable('TXT_INTERMEDIATE', $this->lng->txt('autosavecontent'));
416  $compare_template->setVariable('INTERMEDIATE', $intermediate_output);
417  }
418  $template->setVariable('SOLUTION_OUTPUT', $compare_template->get());
419  } else {
420  $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $showFeedback);
421  if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
422  $question_gui->setUseIntermediateSolution(true);
423  $intermediate_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, true, $showFeedback);
424  $question_gui->setUseIntermediateSolution(false);
425  $template->setVariable('TXT_INTERMEDIATE', $this->lng->txt('autosavecontent'));
426  $template->setVariable('INTERMEDIATE', $intermediate_output);
427  }
428  $template->setVariable('SOLUTION_OUTPUT', $result_output);
429  }
430 
431  $maintemplate->setCurrentBlock("printview_question");
432  $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
433  $maintemplate->parseCurrentBlock();
434  $counter++;
435  }
436  }
437  }
438  }
439 
440  if ($testResultHeaderLabelBuilder !== null) {
441  if ($pass !== null) {
442  $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
443  } else {
444  $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
445  }
446  } else {
447  $headerText = '';
448  }
449 
450  $maintemplate->setVariable("RESULTS_OVERVIEW", $headerText);
451  return $maintemplate->get();
452  }
453 
466  public function getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions = false)
467  {
468  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
469 
470  $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
471 
472  include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
474 
475  $counter = 1;
476  // output of questions with solutions
477  foreach ($result_array as $question_data) {
478  $question = $question_data["qid"];
479  if (is_numeric($question)) {
480  $question_gui = $this->object->createQuestionGUI("", $question);
481  if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
482  $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
483  $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", true, true, "Modules/Test");
484  #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
485  $template->setVariable("COUNTER_QUESTION", $counter . ". ");
486  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
487  $points = $question_gui->object->getMaximumPoints();
488  if ($points == 1) {
489  $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
490  } else {
491  $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
492  }
493 
494  $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
495  $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, true);
496 
497  $solout = $question_gui->object->getSuggestedSolutionOutput();
498  if (strlen($solout)) {
499  $scoretemplate->setCurrentBlock("suggested_solution");
500  $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
501  $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
502  $scoretemplate->parseCurrentBlock();
503  }
504 
505  $scoretemplate->setCurrentBlock("feedback");
506  $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
507  $feedback = $this->object->getManualFeedback($active_id, $question, $pass);
508  $scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, true)));
509  $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
510  $scoretemplate->parseCurrentBlock();
511 
512  $scoretemplate->setVariable("NAME_INPUT", $question);
513  $this->ctrl->setParameter($this, "active_id", $active_id);
514  $this->ctrl->setParameter($this, "pass", $pass);
515  $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
516  $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
517  $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
518  $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
519 
520  $template->setVariable("SOLUTION_OUTPUT", $result_output);
521  $maintemplate->setCurrentBlock("printview_question");
522  $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
523  $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
524  $maintemplate->parseCurrentBlock();
525  }
526  $counter++;
527  }
528  }
529  if ($counter == 1) {
530  // no scorable questions found
531  $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
532  }
533  $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass + 1));
534 
535  include_once "./Services/YUI/classes/class.ilYuiUtil.php";
537 
538  return $maintemplate->get();
539  }
540 
541  protected function getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList = null, $multipleObjectivesInvolved = true)
542  {
543  $this->ctrl->setParameter($targetGUI, 'active_id', $active_id);
544  $this->ctrl->setParameter($targetGUI, 'pass', $pass);
545 
546  $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
547 
548  if (!$this->isPdfDeliveryRequest()) {
549  $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
550  }
551 
552  $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
553  $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
554 
555  if ($objectivesList !== null) {
556  $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
557  $tableGUI->setObjectiveOrientedPresentationEnabled(true);
558  }
559 
560  $tableGUI->setMultipleObjectivesInvolved($multipleObjectivesInvolved);
561 
562  $tableGUI->setActiveId($active_id);
563  $tableGUI->setShowSuggestedSolution(false);
564 
565  $usersQuestionSolutions = array();
566 
567  foreach ($result_array as $key => $val) {
568  if ($key === 'test' || $key === 'pass') {
569  continue;
570  }
571 
572  if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
573  $tableGUI->setShowSuggestedSolution(true);
574  }
575 
576  if (isset($val['pass'])) {
577  $tableGUI->setPassColumnEnabled(true);
578  }
579 
580  $usersQuestionSolutions[$key] = $val;
581  }
582 
583  $tableGUI->initColumns()->initFilter();
584 
585  $tableGUI->setFilterCommand($targetCMD . 'SetTableFilter');
586  $tableGUI->setResetCommand($targetCMD . 'ResetTableFilter');
587 
588  $tableGUI->setData($usersQuestionSolutions);
589 
590  return $tableGUI;
591  }
592 
599  public function getResultsSignature()
600  {
601  if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
602  $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "Modules/Test");
603  $template->setVariable("TXT_DATE", $this->lng->txt("date"));
606  $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
608  $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
609  $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
610  return $template->get();
611  } else {
612  return "";
613  }
614  }
615 
625  public function getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity = false)
626  {
627  if (!is_object($testSession)) {
628  throw new TestException();
629  }
630  $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", true, true, "Modules/Test");
631  include_once './Services/User/classes/class.ilObjUser.php';
632  $user_id = $this->object->_getUserIdFromActiveId($active_id);
633  if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
634  $user = new ilObjUser($user_id);
635  } else {
636  $user = new ilObjUser();
637  $user->setLastname($this->lng->txt("deleted_user"));
638  }
639  $t = $testSession->getSubmittedTimestamp();
640  if (!$t) {
641  $t = $this->object->_getLastAccess($testSession->getActiveId());
642  }
643 
644  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
645  $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
646  $template->setCurrentBlock("name");
647  $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
648  $template->setVariable('VALUE_USR_NAME', $uname);
649  $template->parseCurrentBlock();
650  }
651 
652  $title_matric = "";
653  if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false) || ($overwrite_anonymity))) {
654  $template->setCurrentBlock("matriculation");
655  $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
656  $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
657  $template->parseCurrentBlock();
658  $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
659  }
660 
661  $invited_user = array_pop($this->object->getInvitedUsers($user_id));
662  if (strlen($invited_user["clientip"])) {
663  $template->setCurrentBlock("client_ip");
664  $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
665  $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
666  $template->parseCurrentBlock();
667  $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
668  }
669 
670  $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
671  $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
672 
673  // change the pagetitle (tab title or title in title bar of window)
674  $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
675  $this->tpl->setHeaderPageTitle($pagetitle);
676 
677  return $template->get();
678  }
679 
689  public function getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList = null)
690  {
691  global $DIC;
692  $ilUser = $DIC['ilUser'];
693 
694  $test_id = $this->object->getTestId();
695  $question_gui = $this->object->createQuestionGUI("", $question_id);
696 
697  if ($this->isPdfDeliveryRequest()) {
698  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
699  }
700 
701  $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", true, true, "Modules/Test");
702  $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
703  $result_output = $question_gui->getSolutionOutput($active_id, $pass, true, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, false, true);
704  $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true, false, false);
705  if ($this->object->getShowSolutionFeedback() && $_GET['cmd'] != 'outCorrectSolution') {
706  $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
707  $question_gui->object->fetchIndexedValuesFromValuePairs(
708  $question_gui->object->getSolutionValues($active_id, $pass)
709  )
710  );
711  if (strlen($specificAnswerFeedback)) {
712  $template->setCurrentBlock("outline_specific_feedback");
713  $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
714  $template->parseCurrentBlock();
715  }
716  }
717  if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
718  $template->setCurrentBlock("best_solution");
719  $template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
720  $template->setVariable("BEST_OUTPUT", $best_output);
721  $template->parseCurrentBlock();
722  }
723  $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
724  $maxpoints = $question_gui->object->getMaximumPoints();
725  if ($maxpoints == 1) {
726  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
727  } else {
728  $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
729  }
730  if ($objectivesList !== null) {
731  $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
732  $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
733  $template->setVariable('OBJECTIVES', $objectives);
734  }
735  $template->setVariable("SOLUTION_OUTPUT", $result_output);
736  $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
737  $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
738  $template->setVariable("BACKLINK_TEXT", "&lt;&lt; " . $this->lng->txt("back"));
739  return $template->get();
740  }
741 
754  public function getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details = true, $show_answers = true, $show_question_only = false, $show_reached_points = false)
755  {
756  global $DIC;
757  $ilObjDataCache = $DIC['ilObjDataCache'];
758 
759  include_once("./Services/UICore/classes/class.ilTemplate.php");
760  $template = new ilTemplate("tpl.il_as_tst_results_participant.html", true, true, "Modules/Test");
761 
762  if ($this->participantData instanceof ilTestParticipantData) {
763  $user_id = $this->participantData->getUserIdByActiveId($active_id);
764  $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
765  } else {
766  $user_id = $this->object->_getUserIdFromActiveId($active_id);
767  $uname = $this->object->userLookupFullName($user_id, true);
768  }
769 
770  if (((array_key_exists("pass", $_GET)) && (strlen($_GET["pass"]) > 0)) || (!is_null($pass))) {
771  if (is_null($pass)) {
772  $pass = $_GET["pass"];
773  }
774  }
775 
776  if (!is_null($pass)) {
777  require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
778  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
779 
780  $objectivesList = null;
781 
782  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
783  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
784  $testSequence->loadFromDb();
785  $testSequence->loadQuestions();
786 
787  require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
788  $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
789 
790  $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
791  $objectivesList->loadObjectivesTitles();
792 
793  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
794  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
795  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
796  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
797  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
798  }
799 
800  $result_array = $this->object->getTestResult(
801  $active_id,
802  $pass,
803  false,
804  !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
805  );
806 
807  $user_id = $this->object->_getUserIdFromActiveId($active_id);
808  $showAllAnswers = true;
809  if ($this->object->isExecutable($testSession, $user_id)) {
810  $showAllAnswers = false;
811  }
812  if ($show_answers) {
813  $list_of_answers = $this->getPassListOfAnswers(
814  $result_array,
815  $active_id,
816  $pass,
817  $_SESSION['tst_results_show_best_solutions'],
818  $showAllAnswers,
819  $show_question_only,
820  $show_reached_points,
821  $show_pass_details,
822  $objectivesList,
823  $testResultHeaderLabelBuilder
824  );
825  $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
826  }
827 
828  if ($show_pass_details) {
829  $overviewTableGUI = $this->getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, "getResultsOfUserOutput", '', $show_answers, $objectivesList);
830  $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
831  $template->setVariable("PASS_DETAILS", $overviewTableGUI->getHTML());
832  }
833 
834  $signature = $this->getResultsSignature();
835  $template->setVariable("SIGNATURE", $signature);
836 
837  if ($this->object->isShowExamIdInTestResultsEnabled()) {
838  $template->setCurrentBlock('exam_id_footer');
839  $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
840  $testSession->getActiveId(),
841  $pass
842  ));
843  $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
844  $template->parseCurrentBlock();
845  }
846  }
847 
848  $template->setCurrentBlock('participant_back_anchor');
849  $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
850  $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
851  $template->parseCurrentBlock();
852 
853  $template->setCurrentBlock('participant_block_id');
854  $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
855  $template->parseCurrentBlock();
856 
857  if ($this->isGradingMessageRequired()) {
858  $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
859  $gradingMessageBuilder->buildList();
860 
861  $template->setCurrentBlock('grading_message');
862  $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
863  $template->parseCurrentBlock();
864  }
865 
866 
867  $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
868  $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
869  $template->setVariable("USER_DATA", $user_data);
870 
871  $this->populateExamId($template, (int) $active_id, (int) $pass);
873 
874  return $template->get();
875  }
876 
884  public function getResultsHeadUserAndPass($active_id, $pass)
885  {
886  $template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", true, true, "Modules/Test");
887  include_once './Services/User/classes/class.ilObjUser.php';
888  $user_id = $this->object->_getUserIdFromActiveId($active_id);
889  if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
890  $user = new ilObjUser($user_id);
891  } else {
892  $user = new ilObjUser();
893  $user->setLastname($this->lng->txt("deleted_user"));
894  }
895  $title_matric = "";
896  if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false))) {
897  $template->setCurrentBlock("user_matric");
898  $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
899  $template->parseCurrentBlock();
900  $template->setCurrentBlock("user_matric_value");
901  $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
902  $template->parseCurrentBlock();
903  $template->touchBlock("user_matric_separator");
904  $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
905  }
906 
907  $invited_user = array_pop($this->object->getInvitedUsers($user_id));
908  if (strlen($invited_user["clientip"])) {
909  $template->setCurrentBlock("user_clientip");
910  $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
911  $template->parseCurrentBlock();
912  $template->setCurrentBlock("user_clientip_value");
913  $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
914  $template->parseCurrentBlock();
915  $template->touchBlock("user_clientip_separator");
916  $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
917  }
918 
919  $template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
920  $uname = $this->object->userLookupFullName($user_id, false);
921  $template->setVariable("VALUE_USR_NAME", $uname);
922  $template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
923  $template->setVariable("VALUE_PASS", $pass);
924  return $template->get();
925  }
926 
934  public function getQuestionResultForTestUsers($question_id, $test_id)
935  {
936  // prepare generation before contents are processed (for mathjax)
938 
939  // REQUIRED, since we call this object regardless of the loop
940  $question_gui = $this->object->createQuestionGUI("", $question_id);
941 
942  $this->object->setAccessFilteredParticipantList(
943  $this->object->buildStatisticsAccessFilteredParticipantList()
944  );
945 
946  $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
947  $output = '';
948  foreach ($foundusers as $active_id => $passes) {
949  $resultpass = $this->object->_getResultPass($active_id);
950  for ($i = 0; $i < count($passes); $i++) {
951  if (($resultpass !== null) && ($resultpass == $passes[$i]["pass"])) {
952  if ($output) {
953  $output .= "<br /><br /><br />";
954  }
955 
956  // check if re-instantiation is really neccessary
957  $question_gui = $this->object->createQuestionGUI("", $passes[$i]["qid"]);
958  $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
959  $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
960  $output .= $question_gui->getSolutionOutput(
961  $active_id,
962  $resultpass,
963  $graphicalOutput = false,
964  $result_output = false,
965  $show_question_only = false,
966  $show_feedback = false
967  );
968  }
969  }
970  }
971 
972  require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
973  ilTestPDFGenerator::generatePDF($output, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $question_gui->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
974  }
975 
979  protected function buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
980  {
981  if (!isset($targetGUI->object) && method_exists($targetGUI, 'getTestObj')) {
982  $targetGUI->object = $targetGUI->getTestObj();
983  }
984 
985  require_once 'Modules/Test/classes/tables/class.ilTestPassDetailsOverviewTableGUI.php';
986  $tableGUI = new ilTestPassDetailsOverviewTableGUI($this->ctrl, $targetGUI, $targetCMD);
987  $tableGUI->setIsPdfGenerationRequest($this->isPdfDeliveryRequest());
988  return $tableGUI;
989  }
990 
991  protected function isGradingMessageRequired()
992  {
993  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
994  return false;
995  }
996 
997  if ($this->object->isShowGradingStatusEnabled()) {
998  return true;
999  }
1000 
1001  if ($this->object->isShowGradingMarkEnabled()) {
1002  return true;
1003  }
1004 
1005  if ($this->object->areObligationsEnabled()) {
1006  return true;
1007  }
1008 
1009  return false;
1010  }
1011 
1016  protected function getGradingMessageBuilder($activeId)
1017  {
1018  require_once 'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
1019  $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->object);
1020 
1021  $gradingMessageBuilder->setActiveId($activeId);
1022 
1023  return $gradingMessageBuilder;
1024  }
1025 
1026  protected function buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
1027  {
1028  require_once 'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
1029  $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
1030 
1031  $objectivesAdapter->buildQuestionRelatedObjectiveList($testSequence, $questionRelatedObjectivesList);
1032 
1033  return $questionRelatedObjectivesList;
1034  }
1035 
1036  protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
1037  {
1038  global $DIC;
1039  $ilDB = $DIC['ilDB'];
1040  $ilPluginAdmin = $DIC['ilPluginAdmin'];
1041 
1042  $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1043  $table_gui->initFilter();
1044 
1045  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1046  $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
1047 
1048  $questionList->setParentObjIdsFilter(array($this->object->getId()));
1049  $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
1050 
1051  foreach ($table_gui->getFilterItems() as $item) {
1052  if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1053  $v = $item->getValue();
1054 
1055  if (is_array($v) && count($v) && !(int) $v[0]) {
1056  continue;
1057  }
1058 
1059  $taxId = substr($item->getPostVar(), strlen('tax_'));
1060  $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
1061  } elseif ($item->getValue() !== false) {
1062  $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1063  }
1064  }
1065 
1066  $questionList->load();
1067 
1068  $filteredTestResult = array();
1069 
1070  $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
1071 
1072  foreach ($resultData as $resultItemKey => $resultItemValue) {
1073  if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
1074  continue;
1075  }
1076 
1077  if (!$questionList->isInList($resultItemValue['qid'])) {
1078  continue;
1079  }
1080 
1081  $filteredTestResult[] = $resultItemValue;
1082  }
1083 
1084  return $filteredTestResult;
1085  }
1086 
1090  protected function populateContent($content)
1091  {
1092  if ($this->isPdfDeliveryRequest()) {
1093  require_once 'Modules/Test/classes/class.ilTestPDFGenerator.php';
1094 
1096  $content,
1098  $this->object->getTitleFilenameCompliant(),
1100  );
1101  } else {
1102  $this->tpl->setContent($content);
1103  }
1104  }
1105 
1109  protected function buildUserTestResultsToolbarGUI()
1110  {
1111  require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
1112  $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
1113 
1114  return $toolbar;
1115  }
1116 
1117  protected function outCorrectSolutionCmd()
1118  {
1119  $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
1120  }
1121 
1127  protected function outCorrectSolution()
1128  {
1129  if (!$this->object->getShowSolutionDetails()) {
1130  ilUtil::sendInfo($this->lng->txt("no_permission"), true);
1131  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1132  }
1133 
1134  $testSession = $this->testSessionFactory->getSession();
1135  $activeId = $testSession->getActiveId();
1136 
1137  if (!($activeId > 0)) {
1138  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1139  }
1140 
1141  $this->ctrl->saveParameter($this, "pass");
1142  $pass = (int) $_GET['pass'];
1143 
1144  $questionId = (int) $_GET['evaluation'];
1145 
1146  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1147  $testSequence->loadFromDb();
1148  $testSequence->loadQuestions();
1149 
1150  if (!$testSequence->questionExists($questionId)) {
1152  }
1153 
1154  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1155  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1156  $testSequence->loadFromDb();
1157  $testSequence->loadQuestions();
1158 
1159  require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1160  $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1161  $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1162  $objectivesList->loadObjectivesTitles();
1163  } else {
1164  $objectivesList = null;
1165  }
1166 
1167  global $DIC;
1168  $ilTabs = $DIC['ilTabs'];
1169 
1170  if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
1171  $ilTabs->setBackTarget(
1172  $this->lng->txt("tst_back_to_virtual_pass"),
1173  $this->ctrl->getLinkTarget($this, 'showVirtualPass')
1174  );
1175  } else {
1176  $ilTabs->setBackTarget(
1177  $this->lng->txt("tst_back_to_pass_details"),
1178  $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
1179  );
1180  }
1181  $ilTabs->clearSubTabs();
1182 
1183  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1184  $this->tpl->setCurrentBlock("ContentStyle");
1185  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
1186  $this->tpl->parseCurrentBlock();
1187 
1188  $this->tpl->setCurrentBlock("SyntaxStyle");
1189  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
1190  $this->tpl->parseCurrentBlock();
1191 
1192  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1193  if ($this->object->getShowSolutionAnswersOnly()) {
1194  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1195  }
1196 
1197  $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
1198 
1199  $this->tpl->setContent($solution);
1200  }
1201 
1206  public function populatePassFinishDate($tpl, $passFinishDate)
1207  {
1210  $passFinishDate = ilDatePresentation::formatDate(new ilDateTime($passFinishDate, IL_CAL_UNIX));
1212  $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
1213  $tpl->setVariable("PASS_FINISH_DATE_VALUE", $passFinishDate);
1214  }
1215 
1221  public function populateExamId(ilTemplate $tpl, int $activeId, int $pass)
1222  {
1223  if ($this->object->isShowExamIdInTestResultsEnabled()) {
1224  $tpl->setVariable("EXAM_ID_TXT", $this->lng->txt('exam_id'));
1225  $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
1226  $activeId,
1227  $pass
1228  ));
1229  }
1230  }
1231 }
1232 
1233 // internal sort function to sort the result array
1234 function sortResults($a, $b)
1235 {
1236  $sort = ($_GET["sort"]) ? ($_GET["sort"]) : "nr";
1237  $sortorder = ($_GET["sortorder"]) ? ($_GET["sortorder"]) : "asc";
1238  if (strcmp($sortorder, "asc")) {
1239  $smaller = 1;
1240  $greater = -1;
1241  } else {
1242  $smaller = -1;
1243  $greater = 1;
1244  }
1245  if ($a[$sort] == $b[$sort]) {
1246  return 0;
1247  }
1248  return ($a[$sort] < $b[$sort]) ? $smaller : $greater;
1249 }
static _lookupLogin($a_user_id)
lookup login
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity=false)
Returns the user data for a test results output.
setContextResultPresentation($contextResultPresentation)
$_SESSION["AccountId"]
$template
global $DIC
Definition: saml.php:7
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
const PDF_USER_RESULT
PDF Purposes.
sortResults($a, $b)
static setUseRelativeDates($a_status)
set use relative dates
getResultsSignature()
Returns HTML code for a signature field.
const IL_CAL_UNIX
static accessViolationRedirect()
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
static useRelativeDates()
check if relative dates are used
global $ilCtrl
Definition: ilias.php:18
getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
Returns an output of the solution to an answer compared to the correct solution.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
static getInstance(ilTestSession $a_test_session)
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
Class for single dates.
buildPassOverviewTableGUI($targetGUI)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getCommand($cmd)
Retrieves the ilCtrl command.
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
special template class to simplify handling of ITX/PEAR
setParticipantData($participantData)
outCorrectSolution()
Creates an output of the solution of an answer compared to the correct solution.
static initDomEvent()
Init YUI DomEvent.
Date and time handling
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
Class ilTestPassOverviewTableGUI.
Test session handler.
static getSyntaxStylePath()
get syntax style path
static lookupLastTestPassAccess($activeId, $passIndex)
static getContentStylePath($a_style_id, $add_random=true)
get content style path
$user
Definition: migrateto20.php:57
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.
$row
Service class for tests.
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
static _getManualScoring()
Retrieve the manual scoring settings.
__construct(ilObjTest $a_object)
The constructor takes the test object reference as parameter.
global $ilDB
populatePassFinishDate($tpl, $passFinishDate)
$ret
Definition: parser.php:6
populateExamId(ilTemplate $tpl, int $activeId, int $pass)
executeCommand()
execute command
$i
Definition: disco.tpl.php:19
setObjectiveOrientedContainer(ilTestObjectiveOrientedContainer $objectiveOrientedContainer)
Service GUI class for tests.
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
if(empty($password)) $table
Definition: pwgen.php:24
static _getReachedPoints($active_id, $question_id, $pass=null)
Returns the points, a learner has reached answering the question.
$key
Definition: croninfo.php:18
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.
getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions=false)
Returns the list of answers of a users test pass and offers a scoring option.
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults)
getQuestionResultForTestUsers($question_id, $test_id)
Creates a HTML representation for the results of a given question in a test.
$data
Definition: bench.php:6
static lookupExamId($active_id, $pass)