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