ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilTestSubmissionReviewGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
13{
15 protected $testOutputGUI = null;
16
18 protected $test = null;
19
21 protected $lng;
22
24 protected $ilCtrl;
25
27 protected $tpl;
28
30 protected $testSession;
31
33 {
34 global $lng, $ilCtrl, $tpl;
35 $this->lng = $lng;
36 $this->ilCtrl = $ilCtrl;
37 $this->tpl = $tpl;
38
39 $this->testOutputGUI = $testOutputGUI;
40 $this->test = $test;
41 $this->testSession = $testSession;
42 }
43
44 function executeCommand()
45 {
46 if( !$this->test->getEnableExamview() )
47 {
48 return '';
49 }
50
51 switch( $this->ilCtrl->getNextClass($this) )
52 {
53 default:
54 $this->dispatchCommand();
55 break;
56 }
57
58 return '';
59 }
60
61 protected function dispatchCommand()
62 {
63 switch( $this->ilCtrl->getCmd() )
64 {
65 case 'pdfDownload':
66
67 if( $this->test->getShowExamviewPdf() )
68 {
69 $this->pdfDownload();
70 }
71
72 break;
73
74 case 'show':
75 default:
76
77 $this->show();
78 }
79 }
80
87 private function getContentBlockName()
88 {
89 if ($this->test->getKioskMode())
90 {
91 $this->tpl->setBodyClass("kiosk");
92 $this->tpl->setAddFooter(FALSE);
93 return "CONTENT";
94 }
95 else
96 {
97 return "ADM_CONTENT";
98 }
99 }
100
104 protected function buildToolbar($toolbarId)
105 {
106 require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
107 require_once 'Services/UIComponent/Button/classes/class.ilButton.php';
108 require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
109
110 $toolbar = new ilToolbarGUI();
111 $toolbar->setId($toolbarId);
112
113 $backUrl = $this->ilCtrl->getLinkTarget($this->testOutputGUI, $this->test->getListOfQuestionsEnd() ?
114 'outQuestionSummary' : 'backFromSummary'
115 );
116
117 $button = ilLinkButton::getInstance();
118 $button->setCaption('btn_previous');
119 $button->setUrl($backUrl);
120 $toolbar->addButtonInstance($button);
121
122 if( $this->test->getShowExamviewPdf() )
123 {
124 $pdfUrl = $this->ilCtrl->getLinkTarget($this, 'pdfDownload');
125
126 $button = ilLinkButton::getInstance();
127 $button->setCaption('pdf_export');
128 $button->setUrl($pdfUrl);
129 $button->setTarget('_blank');
130 $toolbar->addButtonInstance($button);
131 }
132
133 $this->ilCtrl->setParameter($this->testOutputGUI, 'reviewed', 1);
134 $nextUrl = $this->ilCtrl->getLinkTarget($this->testOutputGUI, 'finishTest');
135 $this->ilCtrl->setParameter($this->testOutputGUI, 'reviewed', 0);
136
137 $button = ilLinkButton::getInstance();
138 $button->setPrimary(true);
139 $button->setCaption('btn_next');
140 $button->setUrl($nextUrl);
141 $toolbar->addButtonInstance($button);
142
143 return $toolbar;
144 }
145
146 protected function buildUserReviewOutput()
147 {
148 $results = $this->test->getTestResult(
149 $this->testSession->getActiveId(), $this->testSession->getPass(), false
150 );
151
152 require_once 'class.ilTestEvaluationGUI.php';
153 $testevaluationgui = new ilTestEvaluationGUI($this->test);
154 $testevaluationgui->setContextWithinTestPass(true);
155
156 $results_output = $testevaluationgui->getPassListOfAnswers( $results,
157 $this->testSession->getActiveId(), $this->testSession->getPass(),
158 false, false, false, false,
159 false
160 );
161
162 return $results_output;
163 }
164
165 protected function show()
166 {
167 $html = $this->buildToolbar('review_nav_top')->getHTML();
168 $html .= $this->buildUserReviewOutput() . '<br />';
169 $html .= $this->buildToolbar('review_nav_bottom')->getHTML();
170
171 $this->tpl->setVariable($this->getContentBlockName(), $html);
172 }
173
174 protected function pdfDownload()
175 {
176 $reviewOutput = $this->buildUserReviewOutput();
177
178 require_once 'class.ilTestPDFGenerator.php';
180
181 exit;
182 }
183
189 protected function buildPdfFilename()
190 {
191 global $ilSetting;
192
193 $inst_id = $ilSetting->get('inst_id', null);
194
195 require_once 'Services/Utilities/classes/class.ilUtil.php';
196
197 $path = ilUtil::getWebspaceDir() . '/assessment/'. $this->test->getId() . '/exam_pdf';
198
199 if (!is_dir($path))
200 {
202 }
203
205 $filename .= $inst_id . '-' . $this->test->getId();
206 $filename .= '-' . $this->testSession->getActiveId() . '-';
207 $filename .= $this->testSession->getPass() . '.pdf';
208
209 return $filename;
210 }
211}
$filename
Definition: buildRTE.php:89
This class provides processing control methods.
getCmd($a_default_cmd="", $a_safe_commands="")
Determines current get/post command.
getNextClass()
Get next class in the control path from the current class to the target command class.
getLinkTarget(&$a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui object.
setParameter(&$a_obj, $a_parameter, $a_value)
Set parameters that should be passed a form and link of a gui class.
static getInstance()
Factory.
Output class for assessment test evaluation.
Output class for assessment test execution.
static generatePDF($pdf_output, $output_mode, $filename=null)
Test session handler.
Class ilTestSubmissionReviewGUI.
buildPdfFilename()
not in use, but we keep the code (no archive for every user at end of test !!)
__construct(ilTestOutputGUI $testOutputGUI, ilObjTest $test, ilTestSession $testSession)
getContentBlockName()
Returns the name of the current content block (depends on the kiosk mode setting)
static getWebspaceDir($mode="filesystem")
get webspace directory
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static removeTrailingPathSeparators($path)
exit
Definition: login.php:54
global $ilSetting
Definition: privfeed.php:40
$results
$path
Definition: index.php:22
const ILIAS_ABSOLUTE_PATH