ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestEvaluationGUI.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 require_once './Modules/Test/classes/class.ilTestServiceGUI.php';
5 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
6 require_once 'Modules/Test/classes/class.ilTestPassFinishTasks.php';
7 
8 
29 {
33  protected $testAccess;
34 
39 
48  public function __construct(ilObjTest $a_object)
49  {
50  parent::__construct($a_object);
51 
52  global $DIC; /* @var ILIAS\DI\Container $DIC */
53 
54  require_once 'Modules/Test/classes/class.ilTestProcessLockerFactory.php';
55  $this->processLockerFactory = new ilTestProcessLockerFactory(
56  new ilSetting('assessment'),
57  $DIC->database()
58  );
59  }
60 
64  public function getTestAccess()
65  {
66  return $this->testAccess;
67  }
68 
72  public function setTestAccess($testAccess)
73  {
74  $this->testAccess = $testAccess;
75  }
76 
80  public function executeCommand()
81  {
82  $cmd = $this->ctrl->getCmd();
83  $next_class = $this->ctrl->getNextClass($this);
84  $this->ctrl->saveParameter($this, "sequence");
85  $this->ctrl->saveParameter($this, "active_id");
86  $cmd = $this->getCommand($cmd);
87  switch ($next_class) {
88  case 'iltestpassdetailsoverviewtablegui':
89  require_once 'Modules/Test/classes/tables/class.ilTestPassDetailsOverviewTableGUI.php';
90  $tableGUI = new ilTestPassDetailsOverviewTableGUI($this->ctrl, $this, 'outUserPassDetails');
91  $tableGUI->setIsPdfGenerationRequest($this->isPdfDeliveryRequest());
92  $tableGUI->initFilter();
93  $this->ctrl->forwardCommand($tableGUI);
94  break;
95 
96  default:
97  $ret = &$this->$cmd();
98  break;
99  }
100  return $ret;
101  }
102 
103  public function &getHeaderNames()
104  {
105  $headernames = array();
106  if ($this->object->getAnonymity()) {
107  array_push($headernames, $this->lng->txt("counter"));
108  } else {
109  array_push($headernames, $this->lng->txt("name"));
110  array_push($headernames, $this->lng->txt("login"));
111  }
112  $additionalFields = $this->object->getEvaluationAdditionalFields();
113  if (count($additionalFields)) {
114  foreach ($additionalFields as $fieldname) {
115  array_push($headernames, $this->lng->txt($fieldname));
116  }
117  }
118  array_push($headernames, $this->lng->txt("tst_reached_points"));
119  array_push($headernames, $this->lng->txt("tst_mark"));
120  if ($this->object->getECTSOutput()) {
121  array_push($headernames, $this->lng->txt("ects_grade"));
122  }
123  array_push($headernames, $this->lng->txt("tst_answered_questions"));
124  array_push($headernames, $this->lng->txt("working_time"));
125  array_push($headernames, $this->lng->txt("detailed_evaluation"));
126  return $headernames;
127  }
128 
129  public function &getHeaderVars()
130  {
131  $headervars = array();
132  if ($this->object->getAnonymity()) {
133  array_push($headervars, "counter");
134  } else {
135  array_push($headervars, "name");
136  array_push($headervars, "login");
137  }
138  array_push($headervars, "resultspoints");
139  array_push($headervars, "resultsmarks");
140  if ($this->object->getECTSOutput()) {
141  array_push($headervars, "ects_grade");
142  }
143  array_push($headervars, "qworkedthrough");
144  array_push($headervars, "timeofwork");
145  array_push($headervars, "");
146  return $headervars;
147  }
148 
152  public function filterEvaluation()
153  {
154  if (!$this->getTestAccess()->checkStatisticsAccess()) {
156  }
157 
158  include_once "./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
159  $table_gui = new ilEvaluationAllTableGUI($this, 'outEvaluation');
160  $table_gui->writeFilterToSession();
161  $this->ctrl->redirect($this, "outEvaluation");
162  }
163 
167  public function resetfilterEvaluation()
168  {
169  if (!$this->getTestAccess()->checkStatisticsAccess()) {
171  }
172 
173  include_once "./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
174  $table_gui = new ilEvaluationAllTableGUI($this, 'outEvaluation');
175  $table_gui->resetFilter();
176  $this->ctrl->redirect($this, "outEvaluation");
177  }
178 
184  public function outEvaluation()
185  {
186  global $DIC; /* @var ILIAS\DI\Container $DIC */
187  $ilToolbar = $DIC->toolbar();
188 
189  if (!$this->getTestAccess()->checkStatisticsAccess()) {
191  }
192 
193  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_STATISTICS);
194 
195  include_once "./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
196 
197  $table_gui = new ilEvaluationAllTableGUI(
198  $this,
199  'outEvaluation',
200  $this->object->getAnonymity(),
201  $this->object->isOfferingQuestionHintsEnabled()
202  );
203 
204  $data = array();
205  $arrFilter = array();
206 
207  foreach ($table_gui->getFilterItems() as $item) {
208  if ($item->getValue() !== false) {
209  switch ($item->getPostVar()) {
210  case 'group':
211  case 'name':
212  case 'course':
213  $arrFilter[$item->getPostVar()] = $item->getValue();
214  break;
215  case 'passed_only':
216  $passedonly = $item->getChecked();
217  break;
218  }
219  }
220  }
221  include_once "./Modules/Test/classes/class.ilTestEvaluationData.php";
222  $eval = new ilTestEvaluationData($this->object);
223  $eval->setFilterArray($arrFilter);
224  $foundParticipants = $eval->getParticipants();
225 
226  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
227  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
228 
229  $participantData = new ilTestParticipantData($DIC->database(), $DIC->language());
230  $participantData->setActiveIdsFilter($eval->getParticipantIds());
231 
232  $participantData->setParticipantAccessFilter(
234  );
235 
236  $participantData->load($this->object->getTestId());
237 
238  $counter = 1;
239  if (count($participantData->getActiveIds()) > 0) {
240  if ($this->object->getECTSOutput()) {
241  $passed_array = &$this->object->getTotalPointsPassedArray();
242  }
243  foreach ($participantData->getActiveIds() as $active_id) {
244  if (!isset($foundParticipants[$active_id]) || !($foundParticipants[$active_id] instanceof ilTestEvaluationUserData)) {
245  continue;
246  }
247 
248  /* @var $userdata ilTestEvaluationUserData */
249  $userdata = $foundParticipants[$active_id];
250 
251  $remove = false;
252  if ($passedonly) {
253  $mark_obj = $this->object->getMarkSchema()->getMatchingMark($userdata->getReachedPointsInPercent());
254 
255  if ($mark_obj->getPassed() == false || !$userdata->areObligationsAnswered()) {
256  $remove = true;
257  }
258  }
259  if (!$remove) {
260  // build the evaluation row
261  $evaluationrow = array();
262  if ($this->object->getAnonymity()) {
263  $evaluationrow['name'] = $counter;
264  $evaluationrow['login'] = '';
265  } else {
266  $evaluationrow['name'] = $userdata->getName();
267  if (strlen($userdata->getLogin())) {
268  $evaluationrow['login'] = "[" . $userdata->getLogin() . "]";
269  } else {
270  $evaluationrow['login'] = '';
271  }
272  }
273 
274  $evaluationrow['reached'] = $userdata->getReached();
275  $evaluationrow['max'] = $userdata->getMaxpoints();
276  $evaluationrow['hint_count'] = $userdata->getRequestedHintsCountFromScoredPass();
277  $evaluationrow['exam_id'] = $userdata->getExamIdFromScoredPass();
278  $percentage = $userdata->getReachedPointsInPercent();
279  $mark = $this->object->getMarkSchema()->getMatchingMark($percentage);
280  if (is_object($mark)) {
281  $evaluationrow['mark'] = $mark->getShortName();
282  }
283  if ($this->object->getECTSOutput()) {
284  $ects_mark = $this->object->getECTSGrade($passed_array, $userdata->getReached(), $userdata->getMaxPoints());
285  $evaluationrow['ects_grade'] = $ects_mark;
286  }
287  $evaluationrow['answered'] = $userdata->getQuestionsWorkedThroughInPercent();
288  $evaluationrow['questions_worked_through'] = $userdata->getQuestionsWorkedThrough();
289  $evaluationrow['number_of_questions'] = $userdata->getNumberOfQuestions();
290  $time_seconds = $userdata->getTimeOfWork();
291  $time_hours = floor($time_seconds / 3600);
292  $time_seconds -= $time_hours * 3600;
293  $time_minutes = floor($time_seconds / 60);
294  $time_seconds -= $time_minutes * 60;
295  $evaluationrow['working_time'] = sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds);
296  $this->ctrl->setParameter($this, "active_id", $active_id);
297  $href = $this->ctrl->getLinkTarget($this, "detailedEvaluation");
298  $detailed_evaluation = $this->lng->txt("detailed_evaluation_show");
299  $evaluationrow['details'] = "<a class=\"il_ContainerItemCommand\" href=\"$href\">$detailed_evaluation</a>";
300  $userfields = ilObjUser::_lookupFields($userdata->getUserID());
301  $evaluationrow['gender'] = $userfields['gender'];
302  $evaluationrow['email'] = $userfields['email'];
303  $evaluationrow['institution'] = $userfields['institution'];
304  $evaluationrow['street'] = $userfields['street'];
305  $evaluationrow['city'] = $userfields['city'];
306  $evaluationrow['zipcode'] = $userfields['zipcode'];
307  $evaluationrow['country'] = $userfields['country'];
308  $evaluationrow['sel_country'] = $userfields['sel_country'];
309  $evaluationrow['department'] = $userfields['department'];
310  $evaluationrow['matriculation'] = $userfields['matriculation'];
311  $counter++;
312  $data[] = $evaluationrow;
313  }
314  }
315  }
316 
317  $table_gui->setData($data);
318  if (count($participantData->getActiveIds()) > 0) {
319  $ilToolbar->setFormName('form_output_eval');
320  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'exportEvaluation'));
321  require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
322  $export_type = new ilSelectInputGUI($this->lng->txt('exp_eval_data'), 'export_type');
323  $options = array(
324  'excel' => $this->lng->txt('exp_type_excel'),
325  'csv' => $this->lng->txt('exp_type_spss')
326  );
327 
328  if (!$this->object->getAnonymity()) {
329  try {
330  $globalCertificatePrerequisites = new ilCertificateActiveValidator();
331  if ($globalCertificatePrerequisites->validate()) {
332  $options['certificate'] = $this->lng->txt('exp_type_certificate');
333  }
334  } catch (ilException $e) {
335  }
336  }
337 
338  $export_type->setOptions($options);
339 
340  $ilToolbar->addInputItem($export_type, true);
341  require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
342  $button = ilSubmitButton::getInstance();
343  $button->setCommand('exportEvaluation');
344  $button->setCaption('export');
345  $button->getOmitPreventDoubleSubmission();
346  $ilToolbar->addButtonInstance($button);
347  }
348 
349  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
350  if ($this->object->getShowSolutionAnswersOnly()) {
351  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
352  }
353 
354  $this->tpl->setContent($table_gui->getHTML());
355  }
356 
364  public function detailedEvaluation()
365  {
366  global $DIC; /* @var ILIAS\DI\Container $DIC */
367 
368  if (!$this->getTestAccess()->checkStatisticsAccess()) {
370  }
371 
372  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_STATISTICS);
373 
374  $active_id = $_GET['active_id'];
375 
376  if (!$this->getTestAccess()->checkResultsAccessForActiveId($active_id)) {
378  }
379 
380  if (strlen($active_id) == 0) {
381  ilUtil::sendInfo($this->lng->txt('detailed_evaluation_missing_active_id'), true);
382  $this->ctrl->redirect($this, 'outEvaluation');
383  }
384 
385  $this->tpl->addCss(ilUtil::getStyleSheetLocation('output', 'test_print.css', 'Modules/Test'), 'print');
386 
387  $toolbar = $DIC['ilToolbar'];
388 
389  require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
390  $backBtn = ilLinkButton::getInstance();
391  $backBtn->setCaption('back');
392  $backBtn->setUrl($this->ctrl->getLinkTarget($this, 'outEvaluation'));
393  $toolbar->addInputItem($backBtn);
394 
395  $this->object->setAccessFilteredParticipantList(
396  $this->object->buildStatisticsAccessFilteredParticipantList()
397  );
398 
399  $data = &$this->object->getCompleteEvaluationData();
400 
401  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
402  $form = new ilPropertyFormGUI();
403  $form->setTitle(sprintf(
404  $this->lng->txt('detailed_evaluation_for'),
405  $data->getParticipant($active_id)->getName()
406  ));
407 
408  $resultPoints = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_resultspoints'));
409  $resultPoints->setValue($data->getParticipant($active_id)->getReached() . " " . strtolower($this->lng->txt("of")) . " " . $data->getParticipant($active_id)->getMaxpoints() . " (" . sprintf("%2.2f", $data->getParticipant($active_id)->getReachedPointsInPercent()) . " %" . ")");
410  $form->addItem($resultPoints);
411 
412  if (strlen($data->getParticipant($active_id)->getMark())) {
413  $resultMarks = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_resultsmarks'));
414  $resultMarks->setValue($data->getParticipant($active_id)->getMark());
415  $form->addItem($resultMarks);
416  if (strlen($data->getParticipant($active_id)->getECTSMark())) {
417  $ectsGrade = new ilNonEditableValueGUI($this->lng->txt('ects_grade'));
418  $ectsGrade->setValue($data->getParticipant($active_id)->getECTSMark());
419  $form->addItem($ectsGrade);
420  }
421  }
422 
423  if ($this->object->isOfferingQuestionHintsEnabled()) {
424  $requestHints = new ilNonEditableValueGUI($this->lng->txt('tst_question_hints_requested_hint_count_header'));
425  $requestHints->setValue($data->getParticipant($active_id)->getRequestedHintsCountFromScoredPass());
426  $form->addItem($requestHints);
427  }
428 
429  $time_seconds = $data->getParticipant($active_id)->getTimeOfWork();
430  $atime_seconds = $data->getParticipant($active_id)->getNumberOfQuestions() ? $time_seconds / $data->getParticipant($active_id)->getNumberOfQuestions() : 0;
431  $time_hours = floor($time_seconds / 3600);
432  $time_seconds -= $time_hours * 3600;
433  $time_minutes = floor($time_seconds / 60);
434  $time_seconds -= $time_minutes * 60;
435  $timeOfWork = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_timeofwork'));
436  $timeOfWork->setValue(sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
437  $form->addItem($timeOfWork);
438 
439  $this->tpl->setVariable("TXT_ATIMEOFWORK", $this->lng->txt(""));
440  $time_hours = floor($atime_seconds / 3600);
441  $atime_seconds -= $time_hours * 3600;
442  $time_minutes = floor($atime_seconds / 60);
443  $atime_seconds -= $time_minutes * 60;
444  $avgTimeOfWork = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_atimeofwork'));
445  $avgTimeOfWork->setValue(sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $atime_seconds));
446  $form->addItem($avgTimeOfWork);
447 
448  $firstVisit = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_firstvisit'));
449  $firstVisit->setValue(ilDatePresentation::formatDate(new ilDateTime($data->getParticipant($active_id)->getFirstVisit(), IL_CAL_UNIX)));
450  $form->addItem($firstVisit);
451 
452  $lastVisit = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_lastvisit'));
453  $lastVisit->setValue(ilDatePresentation::formatDate(new ilDateTime($data->getParticipant($active_id)->getLastVisit(), IL_CAL_UNIX)));
454  $form->addItem($lastVisit);
455 
456  $nrPasses = new ilNonEditableValueGUI($this->lng->txt('tst_nr_of_passes'));
457  $nrPasses->setValue($data->getParticipant($active_id)->getLastPass() + 1);
458  $form->addItem($nrPasses);
459 
460  $scoredPass = new ilNonEditableValueGUI($this->lng->txt('scored_pass'));
461  if ($this->object->getPassScoring() == SCORE_BEST_PASS) {
462  $scoredPass->setValue($data->getParticipant($active_id)->getBestPass() + 1);
463  } else {
464  $scoredPass->setValue($data->getParticipant($active_id)->getLastPass() + 1);
465  }
466  $form->addItem($scoredPass);
467 
468  $median = $data->getStatistics()->getStatistics()->median();
469  $pct = $data->getParticipant($active_id)->getMaxpoints() ? ($median / $data->getParticipant($active_id)->getMaxpoints()) * 100.0 : 0;
470  $mark = $this->object->mark_schema->getMatchingMark($pct);
471  if (is_object($mark)) {
472  $markMedian = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_mark_median'));
473  $markMedian->setValue($mark->getShortName());
474  $form->addItem($markMedian);
475  }
476 
477  $rankParticipant = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_rank_participant'));
478  $rankParticipant->setValue($data->getStatistics()->getStatistics()->rank($data->getParticipant($active_id)->getReached()));
479  $form->addItem($rankParticipant);
480 
481  $rankMedian = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_rank_median'));
482  $rankMedian->setValue($data->getStatistics()->getStatistics()->rank_median());
483  $form->addItem($rankMedian);
484 
485  $totalParticipants = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_total_participants'));
486  $totalParticipants->setValue($data->getStatistics()->getStatistics()->count());
487  $form->addItem($totalParticipants);
488 
489  $medianField = new ilNonEditableValueGUI($this->lng->txt('tst_stat_result_median'));
490  $medianField->setValue($median);
491  $form->addItem($medianField);
492 
493  $this->tpl->setContent($form->getHTML());
494 
495  $tables = array();
496 
497  for ($pass = 0; $pass <= $data->getParticipant($active_id)->getLastPass(); $pass++) {
498  $finishdate = ilObjTest::lookupPassResultsUpdateTimestamp($active_id, $pass);
499  if ($finishdate > 0) {
500  if (($DIC->access()->checkAccess('write', '', (int) $_GET['ref_id']))) {
501  $this->ctrl->setParameter($this, 'statistics', '1');
502  $this->ctrl->setParameter($this, 'active_id', $active_id);
503  $this->ctrl->setParameter($this, 'pass', $pass);
504  } else {
505  $this->ctrl->setParameter($this, 'statistics', '');
506  $this->ctrl->setParameter($this, 'active_id', '');
507  $this->ctrl->setParameter($this, 'pass', '');
508  }
509 
510  require_once 'Modules/Test/classes/tables/class.ilTestDetailedEvaluationStatisticsTableGUI.php';
511  $table = new ilTestDetailedEvaluationStatisticsTableGUI($this, 'detailedEvaluation', ($pass + 1) . '_' . $this->object->getId());
512  $table->setTitle(sprintf($this->lng->txt("tst_eval_question_points"), $pass + 1));
513  if (($DIC->access()->checkAccess('write', '', (int) $_GET['ref_id']))) {
514  $table->addCommandButton('outParticipantsPassDetails', $this->lng->txt('tst_show_answer_sheet'));
515  }
516 
517  $questions = $data->getParticipant($active_id)->getQuestions($pass);
518  if (!is_array($questions)) {
519  $questions = $data->getParticipant($active_id)->getQuestions(0);
520  }
521 
522  $tableData = array();
523 
524  $counter = 0;
525  foreach ((array) $questions as $question) {
526  $userDataData = array(
527  'counter' => ++$counter,
528  'id' => $question['id'],
529  'id_txt' => $this->lng->txt('question_id_short'),
530  'title' => $data->getQuestionTitle($question['id'])
531  );
532 
533  $answeredquestion = $data->getParticipant($active_id)->getPass($pass)->getAnsweredQuestionByQuestionId($question["id"]);
534  if (is_array($answeredquestion)) {
535  $percent = $answeredquestion['points'] ? $answeredquestion['reached'] / $answeredquestion['points'] * 100.0 : 0;
536  $userDataData['points'] = $answeredquestion['reached'] . ' ' . strtolower($this->lng->txt('of')) . " " . $answeredquestion['points'] . ' (' . sprintf("%.2f", $percent) . ' %)';
537  } else {
538  $userDataData['points'] = '0 ' . strtolower($this->lng->txt('of')) . ' ' . $question['points'] . ' (' . sprintf("%.2f", 0) . ' %) - ' . $this->lng->txt('question_not_answered');
539  }
540 
541  $tableData[] = $userDataData;
542  }
543  $table->setData($tableData);
544 
545  $tables[] = $table->getHTML();
546  }
547  }
548 
549  global $DIC; /* @var ILIAS\DI\Container $DIC */
550  $DIC['tpl']->setContent($form->getHTML() . implode('', $tables));
551  }
552 
558  {
559  $this->getQuestionResultForTestUsers($_GET["qid"], $this->object->getTestId());
560  }
561 
567  {
568  require_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
569  $question_object = assQuestion::_instanciateQuestion($_GET["qid"]);
570  if ($question_object instanceof ilObjFileHandlingQuestionType) {
571  $question_object->deliverFileUploadZIPFile(
572  $this->ref_id,
573  $this->object->getTestId(),
574  $this->object->getTitle()
575  );
576  } else {
577  $this->ctrl->redirect($this, "singleResults");
578  }
579  }
580 
588  public function eval_a()
589  {
590  global $DIC; /* @var ILIAS\DI\Container $DIC */
591  $ilToolbar = $DIC->toolbar();
592 
593  if (!$this->getTestAccess()->checkStatisticsAccess()) {
595  }
596 
597  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_STATISTICS);
598 
599  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_eval_anonymous_aggregation.html", "Modules/Test");
600 
601  $this->object->setAccessFilteredParticipantList(
602  $this->object->buildStatisticsAccessFilteredParticipantList()
603  );
604 
605  $eval = &$this->object->getCompleteEvaluationData();
606  $data = array();
607  $foundParticipants = &$eval->getParticipants();
608  if (count($foundParticipants)) {
609  $ilToolbar->setFormName('form_output_eval');
610  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'exportAggregatedResults'));
611  require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
612  $export_type = new ilSelectInputGUI($this->lng->txt('exp_eval_data'), 'export_type');
613  $export_type->setOptions(array(
614  'excel' => $this->lng->txt('exp_type_excel'),
615  'csv' => $this->lng->txt('exp_type_spss')
616  ));
617  $ilToolbar->addInputItem($export_type, true);
618  require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php';
619  $button = ilSubmitButton::getInstance();
620  $button->setCommand('exportAggregatedResults');
621  $button->setCaption('export');
622  $button->getOmitPreventDoubleSubmission();
623  $ilToolbar->addButtonInstance($button);
624 
625  array_push($data, array(
626  'result' => $this->lng->txt("tst_eval_total_persons"),
627  'value' => count($foundParticipants)
628  ));
629  $total_finished = $eval->getTotalFinishedParticipants();
630  array_push($data, array(
631  'result' => $this->lng->txt("tst_eval_total_finished"),
632  'value' => $total_finished
633  ));
634  $average_time = $this->object->evalTotalStartedAverageTime(
635  $eval->getParticipantIds()
636  );
637  $diff_seconds = $average_time;
638  $diff_hours = floor($diff_seconds / 3600);
639  $diff_seconds -= $diff_hours * 3600;
640  $diff_minutes = floor($diff_seconds / 60);
641  $diff_seconds -= $diff_minutes * 60;
642  array_push($data, array(
643  'result' => $this->lng->txt("tst_eval_total_finished_average_time"),
644  'value' => sprintf("%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds)
645  ));
646  $total_passed = 0;
647  $total_passed_reached = 0;
648  $total_passed_max = 0;
649  $total_passed_time = 0;
650  foreach ($foundParticipants as $userdata) {
651  if ($userdata->getPassed()) {
652  $total_passed++;
653  $total_passed_reached += $userdata->getReached();
654  $total_passed_max += $userdata->getMaxpoints();
655  $total_passed_time += $userdata->getTimeOfWork();
656  }
657  }
658  $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
659  $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
660  $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
661  array_push($data, array(
662  'result' => $this->lng->txt("tst_eval_total_passed"),
663  'value' => $total_passed
664  ));
665  array_push($data, array(
666  'result' => $this->lng->txt("tst_eval_total_passed_average_points"),
667  'value' => sprintf("%2.2f", $average_passed_reached) . " " . strtolower($this->lng->txt("of")) . " " . sprintf("%2.2f", $average_passed_max)
668  ));
669  $average_time = $average_passed_time;
670  $diff_seconds = $average_time;
671  $diff_hours = floor($diff_seconds / 3600);
672  $diff_seconds -= $diff_hours * 3600;
673  $diff_minutes = floor($diff_seconds / 60);
674  $diff_seconds -= $diff_minutes * 60;
675  array_push($data, array(
676  'result' => $this->lng->txt("tst_eval_total_passed_average_time"),
677  'value' => sprintf("%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds)
678  ));
679  }
680 
681  include_once "./Modules/Test/classes/tables/class.ilTestAggregatedResultsTableGUI.php";
682  $table_gui = new ilTestAggregatedResultsTableGUI($this, 'eval_a');
683  $table_gui->setData($data);
684  $this->tpl->setVariable('AGGREGATED_RESULTS', $table_gui->getHTML());
685 
686  $rows = array();
687  foreach ($eval->getQuestionTitles() as $question_id => $question_title) {
688  $answered = 0;
689  $reached = 0;
690  $max = 0;
691  foreach ($foundParticipants as $userdata) {
692  for ($i = 0; $i <= $userdata->getLastPass(); $i++) {
693  if (is_object($userdata->getPass($i))) {
694  $question = &$userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id);
695  if (is_array($question)) {
696  $answered++;
697  $reached += $question["reached"];
698  $max += $question["points"];
699  }
700  }
701  }
702  }
703  $percent = $max ? $reached / $max * 100.0 : 0;
704  $counter++;
705  $this->ctrl->setParameter($this, "qid", $question_id);
706 
707  $points_reached = ($answered ? $reached / $answered : 0);
708  $points_max = ($answered ? $max / $answered : 0);
709  array_push(
710  $rows,
711  array(
712  'qid' => $question_id,
713  'title' => $question_title,
714  'points' => $points_reached,
715  'points_reached' => $points_reached,
716  'points_max' => $points_max,
717  'percentage' => (float) $percent,
718  'answers' => $answered
719  )
720  );
721  }
722  include_once "./Modules/Test/classes/tables/class.ilTestAverageReachedPointsTableGUI.php";
723  $table_gui = new ilTestAverageReachedPointsTableGUI($this, 'eval_a');
724  $table_gui->setData($rows);
725  $this->tpl->setVariable('TBL_AVG_REACHED', $table_gui->getHTML());
726  }
727 
731  public function exportEvaluation()
732  {
733  $filterby = "";
734  if (array_key_exists("g_filterby", $_GET)) {
735  $filterby = $_GET["g_filterby"];
736  }
737 
738  $filtertext = "";
739  if (array_key_exists("g_userfilter", $_GET)) {
740  $filtertext = $_GET["g_userfilter"];
741  }
742 
743  $passedonly = false;
744  if (array_key_exists("g_passedonly", $_GET)) {
745  if ($_GET["g_passedonly"] == 1) {
746  $passedonly = true;
747  }
748  }
749 
750  require_once 'Modules/Test/classes/class.ilTestExportFactory.php';
751  $expFactory = new ilTestExportFactory($this->object);
752 
753  switch ($_POST["export_type"]) {
754  case "excel":
755  $expFactory->getExporter('results')->exportToExcel(
756  $deliver = true,
757  $filterby,
758  $filtertext,
759  $passedonly
760  );
761  break;
762 
763  case "csv":
764  $expFactory->getExporter('results')->exportToCSV(
765  $deliver = true,
766  $filterby,
767  $filtertext,
768  $passedonly
769  );
770  break;
771 
772  case "certificate":
773  if ($passedonly) {
774  $this->ctrl->setParameterByClass("iltestcertificategui", "g_passedonly", "1");
775  }
776  if (strlen($filtertext)) {
777  $this->ctrl->setParameterByClass("iltestcertificategui", "g_userfilter", $filtertext);
778  }
779  $this->ctrl->redirect($this, "exportCertificate");
780  break;
781  }
782  }
783 
789  public function exportAggregatedResults()
790  {
791  require_once 'Modules/Test/classes/class.ilTestExportFactory.php';
792  $expFactory = new ilTestExportFactory($this->object);
793  $exportObj = $expFactory->getExporter('aggregated');
794 
795  switch ($_POST["export_type"]) {
796  case "excel":
797  $exportObj->exportToExcel($deliver = true);
798  break;
799  case "csv":
800  $exportObj->exportToCSV($deliver = true);
801  break;
802  }
803  }
804 
811  public function exportCertificate()
812  {
813  global $DIC;
814 
815  $globalCertificatePrerequisites = new ilCertificateActiveValidator();
816  if (!$globalCertificatePrerequisites->validate()) {
817  $DIC['ilErr']->raiseError($this->lng->txt('permission_denied'), $DIC['ilErr']->MESSAGE);
818  }
819 
820  $database = $DIC->database();
821  $logger = $DIC->logger()->root();
822 
823  $pathFactory = new ilCertificatePathFactory();
824  $objectId = $this->object->getId();
825  $zipAction = new ilUserCertificateZip(
826  $objectId,
827  $pathFactory->create($this->object)
828  );
829 
830  $archive_dir = $zipAction->createArchiveDirectory();
831  $total_users = array();
832 
833  $this->object->setAccessFilteredParticipantList(
834  $this->object->buildStatisticsAccessFilteredParticipantList()
835  );
836 
837  $ilUserCertificateRepository = new ilUserCertificateRepository($database, $logger);
838  $pdfGenerator = new ilPdfGenerator($ilUserCertificateRepository, $logger);
839 
840  $total_users = &$this->object->evalTotalPersonsArray();
841  if (count($total_users)) {
842  $certValidator = new ilCertificateDownloadValidator();
843 
844  foreach ($total_users as $active_id => $name) {
845  $user_id = $this->object->_getUserIdFromActiveId($active_id);
846 
847  if (!$certValidator->isCertificateDownloadable($user_id, $objectId)) {
848  continue;
849  }
850 
851  $pdfAction = new ilCertificatePdfAction(
852  $logger,
853  $pdfGenerator,
855  $this->lng->txt('error_creating_certificate_pdf')
856  );
857 
858  $pdf = $pdfAction->createPDF($user_id, $objectId);
859  if (strlen($pdf)) {
860  $zipAction->addPDFtoArchiveDirectory($pdf, $archive_dir, $user_id . "_" . str_replace(" ", "_", ilUtil::getASCIIFilename($name)) . ".pdf");
861  }
862  }
863  $zipArchive = $zipAction->zipCertificatesInArchiveDirectory($archive_dir, true);
864  }
865  }
866 
873  public function getEvaluationQuestionId($question_id, $original_id = "")
874  {
875  if ($original_id > 0) {
876  return $original_id;
877  } else {
878  return $question_id;
879  }
880  }
881 
889  public function outParticipantsPassDetails()
890  {
891  global $DIC;
892  $ilTabs = $DIC['ilTabs'];
893  $ilAccess = $DIC['ilAccess'];
894  $ilObjDataCache = $DIC['ilObjDataCache'];
895 
896  $active_id = (int) $_GET["active_id"];
897 
898  if (!$this->getTestAccess()->checkResultsAccessForActiveId($active_id)) {
900  }
901 
902  $this->ctrl->saveParameter($this, "active_id");
903  $testSession = $this->testSessionFactory->getSession($active_id);
904 
905  // protect actives from other tests
906  if ($testSession->getTestId() != $this->object->getTestId()) {
908  }
909 
910  $this->ctrl->saveParameter($this, "pass");
911  $pass = (int) $_GET["pass"];
912 
913  if (isset($_GET['statistics']) && $_GET['statistics'] == 1) {
914  $this->ctrl->setParameterByClass("ilTestEvaluationGUI", "active_id", $active_id);
915  $this->ctrl->saveParameter($this, 'statistics');
916 
917  $ilTabs->setBackTarget(
918  $this->lng->txt('back'),
919  $this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'detailedEvaluation')
920  );
921  } elseif ($this->object->getNrOfTries() == 1) {
922  $ilTabs->setBackTarget(
923  $this->lng->txt('back'),
924  $this->ctrl->getLinkTargetByClass('ilParticipantsTestResultsGUI')
925  );
926  } else {
927  $ilTabs->setBackTarget(
928  $this->lng->txt('tst_results_back_overview'),
929  $this->ctrl->getLinkTarget($this, 'outParticipantsResultsOverview')
930  );
931  }
932 
933  // prepare generation before contents are processed (for mathjax)
934  if ($this->isPdfDeliveryRequest()) {
936  }
937 
938  require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
939  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
940 
941  $objectivesList = null;
942 
943  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
944  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
945  $testSequence->loadFromDb();
946  $testSequence->loadQuestions();
947 
948  require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
949  $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
950 
951  $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
952  $objectivesList->loadObjectivesTitles();
953 
954  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
955  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
956  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
957  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
958  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
959  }
960 
961  $result_array = $this->getFilteredTestResult($active_id, $pass, false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired());
962 
963  $overviewTableGUI = $this->getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $this, "outParticipantsPassDetails", '', true, $objectivesList);
964  $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
965  $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, false);
966  $user_id = $this->object->_getUserIdFromActiveId($active_id);
967 
968  $template = new ilTemplate("tpl.il_as_tst_pass_details_overview_participants.html", true, true, "Modules/Test");
969 
970  $toolbar = $this->buildUserTestResultsToolbarGUI();
971 
972  $this->ctrl->setParameter($this, 'pdf', '1');
973  $toolbar->setPdfExportLinkTarget($this->ctrl->getLinkTarget($this, 'outParticipantsPassDetails'));
974  $this->ctrl->setParameter($this, 'pdf', '');
975 
976  if (isset($_GET['show_best_solutions'])) {
977  $_SESSION['tst_results_show_best_solutions'] = true;
978  } elseif (isset($_GET['hide_best_solutions'])) {
979  $_SESSION['tst_results_show_best_solutions'] = false;
980  } elseif (!isset($_SESSION['tst_results_show_best_solutions'])) {
981  $_SESSION['tst_results_show_best_solutions'] = false;
982  }
983 
984  if ($_SESSION['tst_results_show_best_solutions']) {
985  $this->ctrl->setParameter($this, 'hide_best_solutions', '1');
986  $toolbar->setHideBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, 'outParticipantsPassDetails'));
987  $this->ctrl->setParameter($this, 'hide_best_solutions', '');
988  } else {
989  $this->ctrl->setParameter($this, 'show_best_solutions', '1');
990  $toolbar->setShowBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, 'outParticipantsPassDetails'));
991  $this->ctrl->setParameter($this, 'show_best_solutions', '');
992  }
993 
994  $toolbar->build();
995  $template->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar));
996 
997  if ($this->isGradingMessageRequired() && $this->object->getNrOfTries() == 1) {
998  $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
999  $gradingMessageBuilder->buildList();
1000 
1001  $template->setCurrentBlock('grading_message');
1002  $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
1003  $template->parseCurrentBlock();
1004  }
1005 
1006  $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, $_SESSION['tst_results_show_best_solutions'], false, false, false, true, $objectivesList, $testResultHeaderLabelBuilder);
1007  $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
1008  $template->setVariable("PASS_DETAILS", $this->ctrl->getHTML($overviewTableGUI));
1009 
1010  $data = &$this->object->getCompleteEvaluationData();
1011  $data->getParticipant($active_id)->setPassScoring($pass);
1012  $result = $data->getParticipant($active_id)->getReached() . " " . strtolower($this->lng->txt("of")) . " " . $data->getParticipant($active_id)->getMaxpoints() . " (" . sprintf("%2.2f", $data->getParticipant($active_id)->getReachedPointsInPercent()) . " %" . ")";
1013  $template->setCurrentBlock('total_score');
1014  $template->setVariable("TOTAL_RESULT_TEXT", $this->lng->txt('tst_stat_result_resultspoints'));
1015  $template->setVariable("TOTAL_RESULT", $result);
1016  $template->parseCurrentBlock();
1017 
1018  if (!$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1019  $template->setVariable("USER_DATA", $user_data);
1020 
1021  $uname = $this->object->userLookupFullName($user_id);
1022  $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name_pass"), $pass + 1, $uname));
1023 
1024  $template->setVariable("TEXT_RESULTS", $testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
1025  }
1026 
1027  $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1028 
1029  $this->populateExamId($template, (int) $active_id, (int) $pass);
1030  $this->populatePassFinishDate($template, ilObjTest::lookupLastTestPassAccess($active_id, $pass));
1031 
1032  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1033  if ($this->object->getShowSolutionAnswersOnly()) {
1034  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1035  }
1036 
1037  if ($this->isPdfDeliveryRequest()) {
1038  //$this->object->deliverPDFfromHTML($template->get());
1039  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
1040  } else {
1041  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1042  }
1043  }
1044 
1051  {
1052  global $DIC;
1053  $ilTabs = $DIC['ilTabs'];
1054  $ilObjDataCache = $DIC['ilObjDataCache'];
1055 
1056  $active_id = (int) $_GET["active_id"];
1057 
1058  if (!$this->getTestAccess()->checkResultsAccessForActiveId($active_id)) {
1060  }
1061 
1062  $testSession = $this->testSessionFactory->getSession($active_id);
1063 
1064  // protect actives from other tests
1065  if ($testSession->getTestId() != $this->object->getTestId()) {
1067  }
1068 
1069  if ($this->object->getNrOfTries() == 1) {
1070  $this->ctrl->setParameter($this, "active_id", $active_id);
1071  $this->ctrl->setParameter($this, "pass", ilObjTest::_getResultPass($active_id));
1072  $this->ctrl->redirect($this, "outParticipantsPassDetails");
1073  }
1074 
1075  $ilTabs->setBackTarget(
1076  $this->lng->txt('back'),
1077  $this->ctrl->getLinkTargetByClass(['ilObjTestGUI', 'ilTestResultsGUI', 'ilParticipantsTestResultsGUI'])
1078  );
1079 
1080  // prepare generation before contents are processed (for mathjax)
1081  if ($this->isPdfDeliveryRequest()) {
1083  }
1084 
1085  $template = new ilTemplate("tpl.il_as_tst_pass_overview_participants.html", true, true, "Modules/Test");
1086 
1087  $toolbar = $this->buildUserTestResultsToolbarGUI();
1088 
1089  $this->ctrl->setParameter($this, 'pdf', '1');
1090  $toolbar->setPdfExportLinkTarget($this->ctrl->getLinkTarget($this, __FUNCTION__));
1091  $this->ctrl->setParameter($this, 'pdf', '');
1092 
1093  $toolbar->build();
1094  $template->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar));
1095 
1096  require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
1097  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
1098  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1099  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
1100  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
1101  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
1102  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
1103  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
1104  }
1105 
1106  global $DIC; /* @var ILIAS\DI\Container $DIC */
1107  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
1108  $testPassesSelector = new ilTestPassesSelector($DIC['ilDB'], $this->object);
1109  $testPassesSelector->setActiveId($testSession->getActiveId());
1110  $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
1111 
1112  $passOverViewTableGUI = $this->buildPassOverviewTableGUI($this);
1113  $passOverViewTableGUI->setActiveId($testSession->getActiveId());
1114  $passOverViewTableGUI->setResultPresentationEnabled(true);
1115  $passOverViewTableGUI->setPassDetailsCommand('outParticipantsPassDetails');
1116  $passOverViewTableGUI->init();
1117  $passOverViewTableGUI->setData($this->getPassOverviewTableData($testSession, $testPassesSelector->getExistingPasses(), true, true));
1118  $passOverViewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassOverviewHeaderLabel());
1119  $template->setVariable("PASS_OVERVIEW", $passOverViewTableGUI->getHTML());
1120 
1121  if ($this->isGradingMessageRequired()) {
1122  $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
1123  $gradingMessageBuilder->buildList();
1124 
1125  $template->setCurrentBlock('grading_message');
1126  $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
1127  $template->parseCurrentBlock();
1128  }
1129 
1130  $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
1131  $user_id = $this->object->_getUserIdFromActiveId($active_id);
1132 
1133  if (!$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1134  if ($this->object->getAnonymity()) {
1135  $template->setVariable("TEXT_HEADING", $this->lng->txt("tst_result"));
1136  } else {
1137  $uname = $this->object->userLookupFullName($user_id, true);
1138  $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
1139  $template->setVariable("USER_DATA", $user_data);
1140  }
1141  }
1142 
1143  $template->parseCurrentBlock();
1144 
1145 
1146  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1147  if ($this->object->getShowSolutionAnswersOnly()) {
1148  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1149  }
1150 
1151  if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1)) {
1152  //$this->object->deliverPDFfromHTML($template->get(), $this->object->getTitle());
1153 
1154  $name = ilObjUser::_lookupName($user_id);
1155  $filename = $name['lastname'] . '_' . $name['firstname'] . '_' . $name['login'] . '__' . $this->object->getTitleFilenameCompliant();
1157  //ilUtil::deliverData($file, ilUtil::getASCIIFilename($this->object->getTitle()) . ".pdf", "application/pdf", false, true);
1158  //$template->setVariable("PDF_FILE_LOCATION", $filename);
1159  } else {
1160  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1161  }
1162  }
1163 
1165  {
1166  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1167  $tableGUI->initFilter();
1168  $tableGUI->resetOffset();
1169  $tableGUI->writeFilterToSession();
1170  $this->outUserPassDetails();
1171  }
1172 
1174  {
1175  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1176  $tableGUI->initFilter();
1177  $tableGUI->resetOffset();
1178  $tableGUI->resetFilter();
1179  $this->outUserPassDetails();
1180  }
1181 
1183  {
1184  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'outParticipantsPassDetails');
1185  $tableGUI->initFilter();
1186  $tableGUI->resetOffset();
1187  $tableGUI->writeFilterToSession();
1188  $this->outParticipantsPassDetails();
1189  }
1190 
1192  {
1193  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'outParticipantsPassDetails');
1194  $tableGUI->initFilter();
1195  $tableGUI->resetOffset();
1196  $tableGUI->resetFilter();
1197  $this->outParticipantsPassDetails();
1198  }
1199 
1205  public function outUserPassDetails()
1206  {
1207  global $DIC;
1208  $ilTabs = $DIC['ilTabs'];
1209  $ilUser = $DIC['ilUser'];
1210  $ilObjDataCache = $DIC['ilObjDataCache'];
1211 
1212  $ilTabs->clearSubTabs();
1213  $ilTabs->setBackTarget($this->lng->txt('tst_results_back_overview'), $this->ctrl->getLinkTarget($this));
1214 
1215  $testSession = $this->testSessionFactory->getSession();
1216 
1217  if (!$this->object->getShowPassDetails()) {
1218  #$executable = $this->object->isExecutable($testSession, $ilUser->getId());
1219 
1220  #if($executable["executable"])
1221  #{
1222  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1223  #}
1224  }
1225 
1226  $active_id = $testSession->getActiveId();
1227  $user_id = $testSession->getUserId();
1228 
1229  $this->ctrl->saveParameter($this, "pass");
1230  $pass = $_GET["pass"];
1231 
1232  // prepare generation before contents are processed (for mathjax)
1233  if ($this->isPdfDeliveryRequest()) {
1235  }
1236 
1237  require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
1238  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
1239 
1240  $objectivesList = null;
1241 
1242  $considerHiddenQuestions = true;
1243  $considerOptionalQuestions = true;
1244 
1245  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1246  $considerHiddenQuestions = false;
1247 
1248  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
1249  $testSequence->loadFromDb();
1250  $testSequence->loadQuestions();
1251 
1252  if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) {
1253  $considerOptionalQuestions = false;
1254  }
1255 
1256  require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1257  $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1258 
1259  $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1260  $objectivesList->loadObjectivesTitles();
1261 
1262  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
1263  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
1264  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
1265  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
1266  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
1267  }
1268 
1269  $result_array = $this->getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions);
1270 
1271  $command_solution_details = "";
1272  if ($this->object->getShowSolutionDetails()) {
1273  $command_solution_details = "outCorrectSolution";
1274  }
1275  $questionAnchorNav = $this->object->canShowSolutionPrintview();
1276 
1277  $tpl = new ilTemplate('tpl.il_as_tst_pass_details_overview_participants.html', true, true, "Modules/Test");
1278 
1279  if (!$this->isPdfDeliveryRequest()) {
1280  $toolbar = $this->buildUserTestResultsToolbarGUI();
1281 
1282  $this->ctrl->setParameter($this, 'pdf', '1');
1283  $toolbar->setPdfExportLinkTarget($this->ctrl->getLinkTarget($this, 'outUserPassDetails'));
1284  $this->ctrl->setParameter($this, 'pdf', '');
1285 
1286  $validator = new ilCertificateDownloadValidator();
1287  if ($validator->isCertificateDownloadable($user_id, $this->object->getId())) {
1288  $toolbar->setCertificateLinkTarget($this->ctrl->getLinkTarget($this, 'outCertificate'));
1289  }
1290 
1291  $toolbar->build();
1292 
1293  $tpl->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar));
1294 
1295  $tpl->setCurrentBlock('signature');
1296  $tpl->setVariable("SIGNATURE", $this->getResultsSignature());
1297  $tpl->parseCurrentBlock();
1298 
1299  if ($this->object->isShowExamIdInTestResultsEnabled()) {
1300  $tpl->setCurrentBlock('exam_id');
1301  $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
1302  $testSession->getActiveId(),
1303  $pass
1304  ));
1305  $tpl->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
1306  $tpl->parseCurrentBlock();
1307  }
1308  }
1309 
1310  if (!$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() &&
1311  $this->isGradingMessageRequired() && $this->object->getNrOfTries() == 1) {
1312  $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
1313  $gradingMessageBuilder->buildMessage();
1314  $gradingMessageBuilder->sendMessage();
1315 
1316  #$template->setCurrentBlock('grading_message');
1317  #$template->setVariable('GRADING_MESSAGE', );
1318  #$template->parseCurrentBlock();
1319  }
1320 
1321  $overviewTableGUI = $this->getPassDetailsOverviewTableGUI(
1322  $result_array,
1323  $active_id,
1324  $pass,
1325  $this,
1326  "outUserPassDetails",
1327  $command_solution_details,
1328  $questionAnchorNav,
1329  $objectivesList
1330  );
1331  $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
1332  $tpl->setVariable("PASS_DETAILS", $this->ctrl->getHTML($overviewTableGUI));
1333 
1334  $data = &$this->object->getCompleteEvaluationData();
1335  $percent = $data->getParticipant($active_id)->getPass($pass)->getReachedPoints() / $data->getParticipant($active_id)->getPass($pass)->getMaxPoints() * 100;
1336  $result = $data->getParticipant($active_id)->getPass($pass)->getReachedPoints() . " " . strtolower($this->lng->txt("of")) . " " . $data->getParticipant($active_id)->getPass($pass)->getMaxPoints() . " (" . sprintf("%2.2f", $percent) . " %" . ")";
1337  $tpl->setCurrentBlock('total_score');
1338  $tpl->setVariable("TOTAL_RESULT_TEXT", $this->lng->txt('tst_stat_result_resultspoints'));
1339  $tpl->setVariable("TOTAL_RESULT", $result);
1340  $tpl->parseCurrentBlock();
1341 
1342  if ($this->object->canShowSolutionPrintview()) {
1343  $list_of_answers = $this->getPassListOfAnswers(
1344  $result_array,
1345  $active_id,
1346  $pass,
1347  $this->object->getShowSolutionListComparison(),
1348  false,
1349  false,
1350  false,
1351  true,
1352  $objectivesList,
1353  $testResultHeaderLabelBuilder
1354  );
1355  $tpl->setVariable("LIST_OF_ANSWERS", $list_of_answers);
1356  }
1357 
1358  $tpl->setVariable("TEXT_RESULTS", $testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
1359  $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1360 
1361  $uname = $this->object->userLookupFullName($user_id, true);
1362  $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
1363  if (!$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1364  if ($this->object->getAnonymity()) {
1365  $tpl->setVariable("TEXT_HEADING", $this->lng->txt("tst_result_pass"));
1366  } else {
1367  $tpl->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name_pass"), $pass + 1, $uname));
1368  $tpl->setVariable("USER_DATA", $user_data);
1369  }
1370  }
1371 
1372  $this->populateExamId($tpl, (int) $active_id, (int) $pass);
1374 
1375  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1376  if ($this->object->getShowSolutionAnswersOnly()) {
1377  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1378  }
1379 
1380  if ($this->isPdfDeliveryRequest()) {
1381  ilTestPDFGenerator::generatePDF($tpl->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
1382  } else {
1383  $this->tpl->setContent($tpl->get());
1384  }
1385  }
1386 
1392  public function outUserResultsOverview()
1393  {
1394  global $DIC;
1395  $ilUser = $DIC['ilUser'];
1396  $ilObjDataCache = $DIC['ilObjDataCache'];
1397 
1398  $testSession = $this->testSessionFactory->getSession();
1399  $active_id = $testSession->getActiveId();
1400  $user_id = $ilUser->getId();
1401  $uname = $this->object->userLookupFullName($user_id, true);
1402 
1403  if (!$this->object->canShowTestResults($testSession)) {
1404  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1405  }
1406 
1407  // prepare generation before contents are processed (for mathjax)
1408  if ($this->isPdfDeliveryRequest()) {
1410  }
1411 
1412  $templatehead = new ilTemplate("tpl.il_as_tst_results_participants.html", true, true, "Modules/Test");
1413  $template = new ilTemplate("tpl.il_as_tst_results_participant.html", true, true, "Modules/Test");
1414 
1415  $toolbar = $this->buildUserTestResultsToolbarGUI();
1416 
1417  $this->ctrl->setParameter($this, 'pdf', '1');
1418  $toolbar->setPdfExportLinkTarget($this->ctrl->getLinkTarget($this, 'outUserResultsOverview'));
1419  $this->ctrl->setParameter($this, 'pdf', '');
1420 
1421  $validator = new ilCertificateDownloadValidator();
1422  if ($validator->isCertificateDownloadable($user_id, $this->object->getId())) {
1423  $toolbar->setCertificateLinkTarget($this->ctrl->getLinkTarget($this, 'outCertificate'));
1424  }
1425 
1426  $toolbar->build();
1427 
1428  $templatehead->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar));
1429 
1430  $passDetailsEnabled = $this->object->getShowPassDetails();
1431  #if (!$passDetailsEnabled)
1432  #{
1433  # $executable = $this->object->isExecutable($testSession, $ilUser->getId());
1434  # if (!$executable["executable"]) $passDetailsEnabled = true;
1435  #}
1436 
1437  require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
1438  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
1439  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1440  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
1441  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
1442  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
1443  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
1444  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
1445  }
1446 
1447  $template->setCurrentBlock("pass_overview");
1448 
1449  global $DIC; /* @var ILIAS\DI\Container $DIC */
1450  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
1451  $testPassesSelector = new ilTestPassesSelector($DIC['ilDB'], $this->object);
1452  $testPassesSelector->setActiveId($testSession->getActiveId());
1453  $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
1454 
1455  $passOverViewTableGUI = $this->buildPassOverviewTableGUI($this);
1456  $passOverViewTableGUI->setActiveId($testSession->getActiveId());
1457  $passOverViewTableGUI->setResultPresentationEnabled(true);
1458  if ($passDetailsEnabled) {
1459  $passOverViewTableGUI->setPassDetailsCommand('outUserPassDetails');
1460  }
1461  if ($this->object->isPassDeletionAllowed()) {
1462  $passOverViewTableGUI->setPassDeletionCommand('confirmDeletePass');
1463  }
1464  $passOverViewTableGUI->init();
1465  $passOverViewTableGUI->setData($this->getPassOverviewTableData($testSession, $testPassesSelector->getReportablePasses(), true));
1466  $passOverViewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassOverviewHeaderLabel());
1467  $overview = $passOverViewTableGUI->getHTML();
1468  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1469  require_once 'Modules/Test/classes/class.ilTestLearningObjectivesStatusGUI.php';
1470  $loStatus = new ilTestLearningObjectivesStatusGUI($this->lng);
1471  $loStatus->setCrsObjId($this->getObjectiveOrientedContainer()->getObjId());
1472  $loStatus->setUsrId($testSession->getUserId());
1473  $overview .= "<br />" . $loStatus->getHTML();
1474  }
1475  $template->setVariable("PASS_OVERVIEW", $overview);
1476  $template->parseCurrentBlock();
1477 
1478  if ($this->isGradingMessageRequired()) {
1479  $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
1480  $gradingMessageBuilder->buildMessage();
1481  $gradingMessageBuilder->sendMessage();
1482 
1483  #$template->setCurrentBlock('grading_message');
1484  #$template->setVariable('GRADING_MESSAGE', );
1485  #$template->parseCurrentBlock();
1486  }
1487 
1488  $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
1489 
1490  if (!$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1491  if ($this->object->getAnonymity()) {
1492  $template->setVariable("TEXT_HEADING", $this->lng->txt("tst_result"));
1493  } else {
1494  $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
1495  $template->setVariable("USER_DATA", $user_data);
1496  }
1497  }
1498 
1499  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1500  if ($this->object->getShowSolutionAnswersOnly()) {
1501  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1502  }
1503  $templatehead->setVariable("RESULTS_PARTICIPANT", $template->get());
1504 
1505  if ($this->isPdfDeliveryRequest()) {
1506  ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
1507  } else {
1508  $this->tpl->setContent($templatehead->get());
1509  }
1510  }
1511 
1519  public function outUserListOfAnswerPasses()
1520  {
1521  global $DIC; /* @var ILIAS\DI\Container $DIC */
1522  $ilUser = $DIC['ilUser'];
1523  $ilObjDataCache = $DIC['ilObjDataCache'];
1524 
1525  if (!$this->object->getShowSolutionPrintview()) {
1526  ilUtil::sendInfo($this->lng->txt("no_permission"), true);
1527  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1528  }
1529 
1530  $template = new ilTemplate("tpl.il_as_tst_info_list_of_answers.html", true, true, "Modules/Test");
1531 
1532  $pass = null;
1533  if (array_key_exists("pass", $_GET)) {
1534  if (strlen($_GET["pass"])) {
1535  $pass = $_GET["pass"];
1536  }
1537  }
1538  $user_id = $ilUser->getId();
1539 
1540  $testSession = $this->testSessionFactory->getSession();
1541  $active_id = $testSession->getActiveId();
1542 
1543  $template->setVariable("TEXT_RESULTS", $this->lng->txt("tst_passes"));
1544 
1545  global $DIC; /* @var ILIAS\DI\Container $DIC */
1546  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
1547  $testPassesSelector = new ilTestPassesSelector($DIC['ilDB'], $this->object);
1548  $testPassesSelector->setActiveId($testSession->getActiveId());
1549  $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
1550 
1551  $passOverViewTableGUI = $this->buildPassOverviewTableGUI($this);
1552  $passOverViewTableGUI->setActiveId($testSession->getActiveId());
1553  $passOverViewTableGUI->setResultPresentationEnabled(false);
1554  $passOverViewTableGUI->setPassDetailsCommand('outUserListOfAnswerPasses');
1555  $passOverViewTableGUI->init();
1556  $passOverViewTableGUI->setData($this->getPassOverviewTableData($testSession, $testPassesSelector->getClosedPasses(), false));
1557  $template->setVariable("PASS_OVERVIEW", $passOverViewTableGUI->getHTML());
1558 
1559  $signature = "";
1560  if (strlen($pass)) {
1561  require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
1562  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
1563 
1564  $objectivesList = null;
1565 
1566  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1567  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
1568  $testSequence->loadFromDb();
1569  $testSequence->loadQuestions();
1570 
1571  require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1572  $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1573 
1574  $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1575  $objectivesList->loadObjectivesTitles();
1576 
1577  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
1578  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
1579  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
1580  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
1581  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
1582  }
1583 
1584  $result_array = $this->object->getTestResult(
1585  $active_id,
1586  $pass,
1587  false,
1588  !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
1589  );
1590 
1591  $signature = $this->getResultsSignature();
1592  $user_id = &$this->object->_getUserIdFromActiveId($active_id);
1593  $showAllAnswers = true;
1594  if ($this->object->isExecutable($testSession, $user_id)) {
1595  $showAllAnswers = false;
1596  }
1597  $this->setContextResultPresentation(false);
1598  $answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, false, $showAllAnswers, false, false, false, $objectivesList, $testResultHeaderLabelBuilder);
1599  $template->setVariable("PASS_DETAILS", $answers);
1600  }
1601  $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1602  $template->setVariable("PRINT_TEXT", $this->lng->txt("print"));
1603  $template->setVariable("PRINT_URL", "javascript:window.print();");
1604 
1605  $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
1606  $template->setVariable("USER_DATA", $user_data);
1607  $template->setVariable("TEXT_LIST_OF_ANSWERS", $this->lng->txt("tst_list_of_answers"));
1608  if (strlen($signature)) {
1609  $template->setVariable("SIGNATURE", $signature);
1610  }
1611  if (!is_null($pass) && $this->object->isShowExamIdInTestResultsEnabled()) {
1612  $template->setCurrentBlock('exam_id_footer');
1613  $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
1614  $testSession->getActiveId(),
1615  $pass
1616  ));
1617  $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
1618  $template->parseCurrentBlock();
1619  }
1620  $this->tpl->setVariable("ADM_CONTENT", $template->get());
1621 
1622  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1623  if ($this->object->getShowSolutionAnswersOnly()) {
1624  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1625  }
1626  }
1627 
1635  public function passDetails()
1636  {
1637  if (array_key_exists("pass", $_GET) && (strlen($_GET["pass"]) > 0)) {
1638  $this->ctrl->saveParameter($this, "pass");
1639  $this->ctrl->saveParameter($this, "active_id");
1640  $this->outTestResults(false, $_GET["pass"]);
1641  } else {
1642  $this->outTestResults(false);
1643  }
1644  }
1645 
1650  public function singleResults()
1651  {
1652  global $DIC; /* @var ILIAS\DI\Container $DIC */
1653 
1654  if (!$this->getTestAccess()->checkStatisticsAccess()) {
1656  }
1657 
1658  $this->object->setAccessFilteredParticipantList(
1659  $this->object->buildStatisticsAccessFilteredParticipantList()
1660  );
1661 
1662  $DIC->tabs()->activateTab(ilTestTabsManager::TAB_ID_STATISTICS);
1663 
1664  $data = &$this->object->getCompleteEvaluationData();
1665  $color_class = array("tblrow1", "tblrow2");
1666  $counter = 0;
1667  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_eval_single_answers.html", "Modules/Test");
1668  $foundParticipants = &$data->getParticipants();
1669  if (count($foundParticipants) == 0) {
1670  ilUtil::sendInfo($this->lng->txt("tst_no_evaluation_data"));
1671  return;
1672  } else {
1673  $rows = array();
1674  foreach ($data->getQuestionTitles() as $question_id => $question_title) {
1675  $answered = 0;
1676  $reached = 0;
1677  $max = 0;
1678  foreach ($foundParticipants as $userdata) {
1679  $pass = $userdata->getScoredPass();
1680  if (is_object($userdata->getPass($pass))) {
1681  $question = &$userdata->getPass($pass)->getAnsweredQuestionByQuestionId($question_id);
1682  if (is_array($question)) {
1683  $answered++;
1684  }
1685  }
1686  }
1687  $counter++;
1688  $this->ctrl->setParameter($this, "qid", $question_id);
1689  require_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
1690  $question_object = assQuestion::_instanciateQuestion($question_id);
1691  $download = "";
1692  if ($question_object instanceof ilObjFileHandlingQuestionType) {
1693  if ($question_object->hasFileUploads($this->object->getTestId())) {
1694  $download = "<a href=\"" . $this->ctrl->getLinkTarget($this, "exportFileUploadsForAllParticipants") . "\">" . $this->lng->txt("download") . "</a>";
1695  }
1696  }
1697  array_push(
1698  $rows,
1699  array(
1700  'qid' => $question_id,
1701  'question_title' => $question_title,
1702  'number_of_answers' => $answered,
1703  'output' => "<a href=\"" . $this->ctrl->getLinkTarget($this, "exportQuestionForAllParticipants") . "\">" . $this->lng->txt("pdf_export") . "</a>",
1704  'file_uploads' => $download
1705  )
1706  );
1707  }
1708  if (count($rows)) {
1709  require_once './Modules/Test/classes/tables/class.ilResultsByQuestionTableGUI.php';
1710  $table_gui = new ilResultsByQuestionTableGUI($this, "singleResults");
1711  $table_gui->setTitle($this->lng->txt("tst_answered_questions_test"));
1712  $table_gui->setData($rows);
1713 
1714  $this->tpl->setVariable("TBL_SINGLE_ANSWERS", $table_gui->getHTML());
1715  } else {
1716  $this->tpl->setVariable("TBL_SINGLE_ANSWERS", $this->lng->txt("adm_no_special_users"));
1717  }
1718  }
1719  }
1720 
1724  public function outCertificate()
1725  {
1726  global $DIC;
1727 
1728  $user = $DIC->user();
1729  $database = $DIC->database();
1730  $logger = $DIC->logger()->root();
1731 
1732  $ilUserCertificateRepository = new ilUserCertificateRepository($database, $logger);
1733  $pdfGenerator = new ilPdfGenerator($ilUserCertificateRepository, $logger);
1734 
1735  $pdfAction = new ilCertificatePdfAction(
1736  $logger,
1737  $pdfGenerator,
1739  $this->lng->txt('error_creating_certificate_pdf')
1740  );
1741 
1742  $pdfAction->downloadPdf((int) $user->getId(), (int) $this->object->getId());
1743  }
1744 
1745  public function confirmDeletePass()
1746  {
1747  if (isset($_GET['context']) && strlen($_GET['context'])) {
1748  $context = $_GET['context'];
1749  } else {
1751  }
1752 
1753  if (!$this->object->isPassDeletionAllowed() && !$this->object->isDynamicTest()) {
1755  }
1756 
1757  require_once 'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
1758 
1759  $confirm = new ilTestPassDeletionConfirmationGUI($this->ctrl, $this->lng, $this);
1760  $confirm->build((int) $_GET['active_id'], (int) $_GET['pass'], $context);
1761 
1762  global $DIC;
1763  $tpl = $DIC['tpl'];
1764  $tpl->setContent($this->ctrl->getHTML($confirm));
1765  }
1766 
1767  public function cancelDeletePass()
1768  {
1769  $this->redirectToPassDeletionContext($_POST['context']);
1770  }
1771 
1773  {
1774  require_once 'Modules/Test/classes/confirmations/class.ilTestPassDeletionConfirmationGUI.php';
1775 
1776  switch ($context) {
1778 
1779  $this->ctrl->redirect($this, 'outUserResultsOverview');
1780 
1781  // no break
1783 
1784  $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
1785 
1786  // no break
1788 
1789  $this->ctrl->redirectByClass('ilTestPlayerDynamicQuestionSetGUI', 'startTest');
1790  }
1791  }
1792 
1793  public function performDeletePass()
1794  {
1795  if (isset($_POST['context']) && strlen($_POST['context'])) {
1796  $context = $_POST['context'];
1797  } else {
1799  }
1800 
1801  if (!$this->object->isPassDeletionAllowed() && !$this->object->isDynamicTest()) {
1803  }
1805  global $DIC;
1806  $ilDB = $DIC['ilDB'];
1807 
1808  $active_fi = null;
1809  $pass = null;
1810 
1811  if (isset($_POST['active_id']) && (int) $_POST['active_id']) {
1812  $active_fi = $_POST['active_id'];
1813  }
1814 
1815  if (isset($_POST['pass']) && is_numeric($_POST['pass'])) {
1816  $pass = $_POST['pass'];
1817  }
1818 
1819  if (is_null($active_fi) || is_null($pass)) {
1820  $this->ctrl->redirect($this, 'outUserResultsOverview');
1821  }
1822 
1823  if (!$this->object->isDynamicTest() && $pass == $this->object->_getResultPass($active_fi)) {
1824  $this->ctrl->redirect($this, 'outUserResultsOverview');
1825  }
1826 
1827  // Get information
1828  $result = $ilDB->query("
1829  SELECT tst_active.tries, tst_active.last_finished_pass, tst_sequence.pass
1830  FROM tst_active
1831  LEFT JOIN tst_sequence
1832  ON tst_sequence.active_fi = tst_active.active_id
1833  AND tst_sequence.pass = tst_active.tries
1834  WHERE tst_active.active_id = {$ilDB->quote($active_fi, 'integer')}
1835  ");
1836 
1837  $row = $ilDB->fetchAssoc($result);
1838 
1839  $tries = $row['tries'];
1840  $lastFinishedPass = is_numeric($row['last_finished_pass']) ? $row['last_finished_pass'] : -1;
1841 
1842  if ($pass < $lastFinishedPass) {
1843  $isActivePass = false;
1844  $must_renumber = true;
1845  } elseif ($pass == $lastFinishedPass) {
1846  $isActivePass = false;
1847 
1848  if ($tries == $row['pass']) {
1849  $must_renumber = true;
1850  } else {
1851  $must_renumber = false;
1852  }
1853  } elseif ($pass == $row['pass']) {
1854  $isActivePass = true;
1855  $must_renumber = false;
1856  } else {
1857  throw new ilTestException('This should not happen, please contact Bjoern Heyser to clean up this pass salad!');
1858  }
1859 
1860  if (!$this->object->isDynamicTest() && $isActivePass) {
1861  $this->ctrl->redirect($this, 'outUserResultsOverview');
1862  }
1863 
1864  if ($pass == 0 && (
1865  ($lastFinishedPass == 0 && $tries == 1 && $tries != $row['pass'])
1866  || ($isActivePass == true) // should be equal to || ($lastFinishedPass == -1 && $tries == 0)
1867  )) {
1868  $last_pass = true;
1869  } else {
1870  $last_pass = false;
1871  }
1872 
1873  // Work on tables:
1874  // tst_active
1875  if ($last_pass) {
1876  $ilDB->manipulate(
1877  'DELETE
1878  FROM tst_active
1879  WHERE active_id = ' . $ilDB->quote($active_fi, 'integer')
1880  );
1881  } elseif (!$isActivePass) {
1882  $ilDB->manipulate(
1883  'UPDATE tst_active
1884  SET tries = ' . $ilDB->quote($tries - 1, 'integer') . ',
1885  last_finished_pass = ' . $ilDB->quote($lastFinishedPass - 1, 'integer') . '
1886  WHERE active_id = ' . $ilDB->quote($active_fi, 'integer')
1887  );
1888  }
1889  // tst_manual_fb
1890  $ilDB->manipulate(
1891  'DELETE
1892  FROM tst_manual_fb
1893  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1894  AND pass = ' . $ilDB->quote($pass, 'integer')
1895  );
1896 
1897  if ($must_renumber) {
1898  $ilDB->manipulate(
1899  'UPDATE tst_manual_fb
1900  SET pass = pass - 1
1901  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1902  AND pass > ' . $ilDB->quote($pass, 'integer')
1903  );
1904  }
1905 
1906  // tst_mark -> nothing to do
1907  //
1908  // tst_pass_result
1909  $ilDB->manipulate(
1910  'DELETE
1911  FROM tst_pass_result
1912  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1913  AND pass = ' . $ilDB->quote($pass, 'integer')
1914  );
1915 
1916  if ($must_renumber) {
1917  $ilDB->manipulate(
1918  'UPDATE tst_pass_result
1919  SET pass = pass - 1
1920  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1921  AND pass > ' . $ilDB->quote($pass, 'integer')
1922  );
1923  }
1924 
1925  // tst_qst_solved -> nothing to do
1926 
1927  // tst_rnd_copy -> nothing to do
1928  // tst_rnd_qpl_title -> nothing to do
1929 
1930  // tst_sequence
1931  $ilDB->manipulate(
1932  'DELETE
1933  FROM tst_sequence
1934  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1935  AND pass = ' . $ilDB->quote($pass, 'integer')
1936  );
1937 
1938  if ($must_renumber) {
1939  $ilDB->manipulate(
1940  'UPDATE tst_sequence
1941  SET pass = pass - 1
1942  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1943  AND pass > ' . $ilDB->quote($pass, 'integer')
1944  );
1945  }
1946 
1947  if ($this->object->isDynamicTest()) {
1948  $tables = array(
1949  'tst_seq_qst_tracking', 'tst_seq_qst_answstatus', 'tst_seq_qst_postponed', 'tst_seq_qst_checked'
1950  );
1951 
1952  foreach ($tables as $table) {
1953  $ilDB->manipulate("
1954  DELETE FROM $table
1955  WHERE active_fi = {$ilDB->quote($active_fi, 'integer')}
1956  AND pass = {$ilDB->quote($pass, 'integer')}
1957  ");
1958 
1959  if ($must_renumber) {
1960  $ilDB->manipulate("
1961  UPDATE $table
1962  SET pass = pass - 1
1963  WHERE active_fi = {$ilDB->quote($active_fi, 'integer')}
1964  AND pass > {$ilDB->quote($pass, 'integer')}
1965  ");
1966  }
1967  }
1968  }
1969 
1970  // tst_solutions
1971  $ilDB->manipulate(
1972  'DELETE
1973  FROM tst_solutions
1974  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1975  AND pass = ' . $ilDB->quote($pass, 'integer')
1976  );
1977 
1978  if ($must_renumber) {
1979  $ilDB->manipulate(
1980  'UPDATE tst_solutions
1981  SET pass = pass - 1
1982  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1983  AND pass > ' . $ilDB->quote($pass, 'integer')
1984  );
1985  }
1986 
1987  // tst_test_result
1988  $ilDB->manipulate(
1989  'DELETE
1990  FROM tst_test_result
1991  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
1992  AND pass = ' . $ilDB->quote($pass, 'integer')
1993  );
1994 
1995  if ($must_renumber) {
1996  $ilDB->manipulate(
1997  'UPDATE tst_test_result
1998  SET pass = pass - 1
1999  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
2000  AND pass > ' . $ilDB->quote($pass, 'integer')
2001  );
2002  }
2003 
2004  // qpl_hint_tracking
2005  $ilDB->manipulate(
2006  'DELETE
2007  FROM qpl_hint_tracking
2008  WHERE qhtr_active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
2009  AND qhtr_pass = ' . $ilDB->quote($pass, 'integer')
2010  );
2011 
2012  if ($must_renumber) {
2013  $ilDB->manipulate(
2014  'UPDATE qpl_hint_tracking
2015  SET qhtr_pass = qhtr_pass - 1
2016  WHERE qhtr_active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
2017  AND qhtr_pass > ' . $ilDB->quote($pass, 'integer')
2018  );
2019  }
2020 
2021  // tst_test_rnd_qst -> nothing to do
2022 
2023  // tst_times
2024  $ilDB->manipulate(
2025  'DELETE
2026  FROM tst_times
2027  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
2028  AND pass = ' . $ilDB->quote($pass, 'integer')
2029  );
2030 
2031  if ($must_renumber) {
2032  $ilDB->manipulate(
2033  'UPDATE tst_times
2034  SET pass = pass - 1
2035  WHERE active_fi = ' . $ilDB->quote($active_fi, 'integer') . '
2036  AND pass > ' . $ilDB->quote($pass, 'integer')
2037  );
2038  }
2039 
2040  require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
2042  $this->object->logAction($this->lng->txtlng("assessment", "log_deleted_pass", ilObjAssessmentFolder::_getLogLanguage()));
2043  }
2044  // tst_result_cache
2045  // Ggfls. nur renumbern.
2046  require_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
2048 
2049  if ($this->object->isDynamicTest()) {
2050  require_once 'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php';
2052  }
2053 
2055  }
2056 
2057  protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
2058  {
2059  global $DIC;
2060  $ilDB = $DIC['ilDB'];
2061  $ilPluginAdmin = $DIC['ilPluginAdmin'];
2062 
2063  $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions);
2064  $questionIds = array();
2065  foreach ($resultData as $resultItemKey => $resultItemValue) {
2066  if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
2067  continue;
2068  }
2069 
2070  $questionIds[] = $resultItemValue['qid'];
2071  }
2072 
2073  $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
2074  $table_gui->initFilter();
2075 
2076  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
2077  $questionList = new ilAssQuestionList($ilDB, $this->lng, $this->refinery, $ilPluginAdmin);
2078  $questionList->setIncludeQuestionIdsFilter($questionIds);
2079  $questionList->setQuestionInstanceTypeFilter(null);
2080 
2081  foreach ($table_gui->getFilterItems() as $item) {
2082  if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
2083  $v = $item->getValue();
2084 
2085  if (is_array($v) && count($v) && !(int) $v[0]) {
2086  continue;
2087  }
2088 
2089  $taxId = substr($item->getPostVar(), strlen('tax_'));
2090  $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
2091  } elseif ($item->getValue() !== false) {
2092  $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
2093  }
2094  }
2095 
2096  $questionList->load();
2097 
2098  $filteredTestResult = array();
2099 
2100  foreach ($resultData as $resultItemKey => $resultItemValue) {
2101  if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
2102  continue;
2103  }
2104 
2105  if (!$questionList->isInList($resultItemValue['qid'])) {
2106  continue;
2107  }
2108 
2109  $filteredTestResult[] = $resultItemValue;
2110  }
2111 
2112  return $filteredTestResult;
2113  }
2114 
2116  {
2117  global $DIC; /* @var ILIAS\DI\Container $DIC */
2118 
2119  $activeId = (int) $_GET["active_id"];
2120 
2121  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
2123 
2124  require_once 'Modules/Test/classes/class.ilTestParticipantList.php';
2125  $participantData = new ilTestParticipantData($DIC->database(), $DIC->language());
2126  $participantData->setActiveIdsFilter(array($activeId));
2127  $participantData->setParticipantAccessFilter($accessFilter);
2128  $participantData->load($this->object->getTestId());
2129 
2130  if (!in_array($activeId, $participantData->getActiveIds())) {
2132  }
2133 
2138  if ($this->object->isEndingTimeEnabled() || $this->object->getEnableProcessingTime()) {
2139  if ($this->object->endingTimeReached() == false) {
2140  $starting_time = $this->object->getStartingTimeOfUser($activeId);
2141  if ($this->object->isMaxProcessingTimeReached($starting_time, $activeId) == false) {
2142  ilUtil::sendInfo($this->lng->txt("finish_pass_for_user_in_processing_time"));
2143  }
2144  }
2145  }
2146 
2147  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
2148  $cgui = new ilConfirmationGUI();
2149 
2150  $cgui->setHeaderText(sprintf(
2151  $this->lng->txt("finish_pass_for_user_confirmation"),
2152  $participantData->getFormatedFullnameByActiveId($activeId)
2153  ));
2154 
2155  $this->ctrl->setParameter($this, 'active_id', $activeId);
2156  $cgui->setFormAction($this->ctrl->getFormAction($this, "participants"));
2157 
2158  $cgui->setCancel($this->lng->txt("cancel"), "redirectBackToParticipantsScreen");
2159  $cgui->setConfirm($this->lng->txt("proceed"), "confirmFinishTestPassForUser");
2160 
2161  $this->tpl->setContent($cgui->getHTML());
2162  }
2163 
2165  {
2166  global $DIC; /* @var ILIAS\DI\Container $DIC */
2167 
2168  $activeId = (int) $_GET["active_id"];
2169 
2170  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
2172 
2173  require_once 'Modules/Test/classes/class.ilTestParticipantList.php';
2174  $participantData = new ilTestParticipantData($DIC->database(), $DIC->language());
2175  $participantData->setActiveIdsFilter(array($activeId));
2176  $participantData->setParticipantAccessFilter($accessFilter);
2177  $participantData->load($this->object->getTestId());
2178 
2179  if (in_array($activeId, $participantData->getActiveIds())) {
2180  $testSession = new ilTestSession();
2181  $testSession->loadFromDb($activeId);
2182 
2183  assQuestion::_updateTestPassResults(
2184  $activeId,
2185  $testSession->getPass(),
2186  $this->object->areObligationsEnabled(),
2187  null,
2188  $this->object->getId()
2189  );
2190 
2191  $this->finishTestPass($activeId, $this->object->getId());
2192  }
2193 
2194 
2196  }
2197 
2198  public function finishAllUserPasses()
2199  {
2204  if ($this->object->isEndingTimeEnabled() || $this->object->getEnableProcessingTime()) {
2205  if ($this->object->endingTimeReached() == false) {
2207  $participantList = new ilTestParticipantList($this->object);
2208  $participantList->initializeFromDbRows($this->object->getTestParticipants());
2209  $participantList = $participantList->getAccessFilteredList($accessFilter);
2210 
2211  foreach ($participantList as $participant) {
2212  if (!$participant->hasUnfinishedPasses()) {
2213  continue;
2214  }
2215  $starting_time = $this->object->getStartingTimeOfUser($participant->getActiveId());
2216  if ($this->object->isMaxProcessingTimeReached($starting_time, $participant->getActiveId()) == false) {
2217  ilUtil::sendFailure($this->lng->txt("finish_pass_for_all_users_in_processing_time"), true);
2219  }
2220  }
2221  }
2222  }
2223 
2224  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
2225  $cgui = new ilConfirmationGUI();
2226  $cgui->setFormAction($this->ctrl->getFormAction($this));
2227  $cgui->setHeaderText($this->lng->txt("finish_pass_for_all_users"));
2228  $cgui->setCancel($this->lng->txt("cancel"), "redirectBackToParticipantsScreen");
2229  $cgui->setConfirm($this->lng->txt("proceed"), "confirmFinishTestPassForAllUser");
2230  $this->tpl->setContent($cgui->getHTML());
2231  }
2232 
2234  {
2235  require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
2237 
2238  require_once 'Modules/Test/classes/class.ilTestParticipantList.php';
2239  $participantList = new ilTestParticipantList($this->object);
2240  $participantList->initializeFromDbRows($this->object->getTestParticipants());
2241  $participantList = $participantList->getAccessFilteredList($accessFilter);
2242 
2243  foreach ($participantList as $participant) {
2244  if (!$participant->hasUnfinishedPasses()) {
2245  continue;
2246  }
2247 
2248  $testSession = new ilTestSession();
2249  $testSession->loadFromDb($participant->getActiveId());
2250 
2251  assQuestion::_updateTestPassResults(
2252  $participant->getActiveId(),
2253  $testSession->getPass(),
2254  $this->object->areObligationsEnabled(),
2255  null,
2256  $this->object->getId()
2257  );
2258 
2259  $this->finishTestPass($participant->getActiveId(), $this->object->getId());
2260  }
2261 
2263  }
2264 
2265  protected function finishTestPass($active_id, $obj_id)
2266  {
2267  $processLocker = $this->processLockerFactory->withContextId((int) $active_id)->getLocker();
2268 
2269  $test_pass_finisher = new ilTestPassFinishTasks($active_id, $obj_id);
2270  $test_pass_finisher->performFinishTasks($processLocker);
2271  }
2272 
2274  {
2275  $this->ctrl->redirectByClass("ilTestParticipantsGUI");
2276  }
2277 }
static _lookupName($a_user_id)
lookup user name
Class ilPdfGeneratorConstantsTest.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
Move this to a proper place.
Class ilTestPassFinishTasks.
singleResults()
Creates user results for single questions.
getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity=false)
Returns the user data for a test results output.
$context
Definition: webdav.php:26
setContextResultPresentation($contextResultPresentation)
$data
Definition: storeScorm.php:23
exportEvaluation()
Exports the evaluation data to a selected file format.
outCertificate()
Output of a test certificate.
$_SESSION["AccountId"]
$result
exportCertificate()
Exports the user results as PDF certificates using XSL-FO via XML:RPC calls.
This class represents a property form user interface.
outParticipantsResultsOverview()
Output of the pass overview for a test called from the statistics.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
static lookupPassResultsUpdateTimestamp($active_id, $pass)
passDetails()
Output of the learners view of an existing test pass.
const PDF_USER_RESULT
PDF Purposes.
TableGUI class for results by question.
executeCommand()
execute command
exportAggregatedResults()
Exports the aggregated results.
Interface ilObjFileHandlingQuestionType.
outUserResultsOverview()
Output of the pass overview for a test called by a test participant.
getResultsSignature()
Returns HTML code for a signature field.
TableGUI class for evaluation of all users.
__construct(ilObjTest $a_object)
ilTestEvaluationGUI constructor
const IL_CAL_UNIX
static accessViolationRedirect()
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Base Exception for all Exceptions relating to Modules/Test.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
if($format !==null) $name
Definition: metadata.php:230
static _getLogLanguage()
retrieve the log language for assessment logging
getEvaluationQuestionId($question_id, $original_id="")
Returns the ID of a question for evaluation purposes.
static getInstance(ilTestSession $a_test_session)
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
finishTestPass($active_id, $obj_id)
getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
outParticipantsPassDetails()
Output of the pass details of an existing test pass for the test statistics.
buildPassOverviewTableGUI($targetGUI)
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
getCommand($cmd)
Retrieves the ilCtrl command.
Validates if an active certificate is stored in the database and can be downloaded by the user...
global $DIC
Definition: goto.php:24
Output class for assessment test evaluation.
createArchiveDirectory()
Creates a directory for a zip archive containing multiple certificates.
static lookupLastTestPassAccess($activeId, $passIndex)
setOptions($a_options)
Set Options.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$filename
Definition: buildRTE.php:89
exportFileUploadsForAllParticipants()
Creates a ZIP file containing all file uploads for a given question in a test.
$rows
Definition: xhr_table.php:10
Just a wrapper class to create Unit Test for other classes.
detailedEvaluation()
Creates the detailed evaluation output for a selected participant.
createPDF(int $userId, int $objectId)
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
This class represents a non editable value in a property form.
__construct(Container $dic, ilPlugin $plugin)
global $ilDB
exportQuestionForAllParticipants()
Creates a PDF representation of the answers for a given question in a test.
populatePassFinishDate($tpl, $passFinishDate)
$ret
Definition: parser.php:6
populateExamId(ilTemplate $tpl, int $activeId, int $pass)
outUserPassDetails()
Output of the pass details of an existing test pass for the active test participant.
outEvaluation()
Creates the evaluation output for the test.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
$ilUser
Definition: imgupload.php:18
outUserListOfAnswerPasses()
Output of the pass overview for a user when he/she wants to see his/her list of answers.
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.
$_POST["username"]
eval_a()
Output of anonymous aggregated results for the test.
const SCORE_BEST_PASS
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.
$i
Definition: metadata.php:24
Confirmation screen class.
static lookupExamId($active_id, $pass)
downloadPdf(int $userId, int $objectId)