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