ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestEvalObjectiveOrientedGUI.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 
16 {
17  public function executeCommand()
18  {
19  $this->ctrl->saveParameter($this, "active_id");
20 
21  switch ($this->ctrl->getNextClass($this)) {
22  case 'ilassquestionpagegui':
23  require_once 'Modules/Test/classes/class.ilAssQuestionPageCommandForwarder.php';
24  $forwarder = new ilAssQuestionPageCommandForwarder();
25  $forwarder->setTestObj($this->object);
26  $forwarder->forward();
27  break;
28 
29  default:
30  $cmd = $this->ctrl->getCmd('showVirtualPass') . 'Cmd';
31  $this->$cmd();
32  }
33  }
34 
36  {
37  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'showVirtualPass');
38  $tableGUI->initFilter();
39  $tableGUI->resetOffset();
40  $tableGUI->writeFilterToSession();
41  $this->showVirtualPassCmd();
42  }
43 
45  {
46  $tableGUI = $this->buildPassDetailsOverviewTableGUI($this, 'showVirtualPass');
47  $tableGUI->initFilter();
48  $tableGUI->resetOffset();
49  $tableGUI->resetFilter();
50  $this->showVirtualPassCmd();
51  }
52 
53  private function showVirtualPassCmd()
54  {
55  $testSession = $this->testSessionFactory->getSession();
56 
57  if (!$this->object->getShowPassDetails()) {
58  $executable = $this->object->isExecutable($testSession, $testSession->getUserId());
59 
60  if ($executable["executable"]) {
61  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
62  }
63  }
64 
65  // prepare generation before contents are processed (for mathjax)
66  if ($this->isPdfDeliveryRequest()) {
68  }
69 
70  $toolbar = $this->buildUserTestResultsToolbarGUI();
71  $this->ctrl->setParameter($this, 'pdf', '1');
72  $toolbar->setPdfExportLinkTarget($this->ctrl->getLinkTarget($this, 'showVirtualPass'));
73  $this->ctrl->setParameter($this, 'pdf', '');
74  $toolbar->build();
75 
76  $virtualSequence = $this->service->buildVirtualSequence($testSession);
77  $userResults = $this->service->getVirtualSequenceUserResults($virtualSequence);
78 
79  require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
80  $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
81 
82  $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $virtualSequence);
83  $objectivesList->loadObjectivesTitles();
84 
85  require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
86  $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $this->objCache);
87 
88  $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
89  $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
90  $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
91  $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
92  $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
93 
94  $tpl = new ilTemplate('tpl.il_as_tst_virtual_pass_details.html', false, false, 'Modules/Test');
95 
96  $command_solution_details = "";
97  if ($this->object->getShowSolutionDetails()) {
98  $command_solution_details = "outCorrectSolution";
99  }
100 
101  $questionAnchorNav = $listOfAnswers = $this->object->canShowSolutionPrintview();
102 
103  if ($listOfAnswers) {
104  $list_of_answers = $this->getPassListOfAnswers(
105  $userResults,
106  $testSession->getActiveId(),
107  null,
108  $this->object->getShowSolutionListComparison(),
109  false,
110  false,
111  false,
112  true,
113  $objectivesList,
114  $testResultHeaderLabelBuilder
115  );
116  $tpl->setVariable("LIST_OF_ANSWERS", $list_of_answers);
117  }
118 
119  foreach ($objectivesList->getObjectives() as $loId => $loTitle) {
120  $userResultsForLO = $objectivesList->filterResultsByObjective($userResults, $loId);
121 
122  $overviewTableGUI = $this->getPassDetailsOverviewTableGUI(
123  $userResultsForLO,
124  $testSession->getActiveId(),
125  null,
126  $this,
127  "showVirtualPass",
128  $command_solution_details,
129  $questionAnchorNav,
130  $objectivesList,
131  false
132  );
133  $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getVirtualPassDetailsHeaderLabel(
134  $objectivesList->getObjectiveTitleById($loId)
135  ));
136 
137  require_once 'Modules/Test/classes/class.ilTestLearningObjectivesStatusGUI.php';
138  $loStatus = new ilTestLearningObjectivesStatusGUI($this->lng);
139  $loStatus->setCrsObjId($this->getObjectiveOrientedContainer()->getObjId());
140  $loStatus->setUsrId($testSession->getUserId());
141  $lostatus = $loStatus->getHTML($loId);
142 
143  $tpl->setCurrentBlock('pass_details');
144  $tpl->setVariable("PASS_DETAILS", $overviewTableGUI->getHTML());
145  $tpl->setVariable("LO_STATUS", $lostatus);
146  $tpl->parseCurrentBlock();
147  }
148 
149  $this->populateContent($this->ctrl->getHTML($toolbar) . $tpl->get());
150  }
151 }
const PDF_USER_RESULT
PDF Purposes.
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
static getInstance(ilTestSession $a_test_session)
getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
special template class to simplify handling of ITX/PEAR
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
Service GUI class for tests.
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.
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...