ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  $next_class = $this->ilCtrl->getNextClass($this);
47 
48  switch($next_class)
49  {
50  default:
51  $ret = $this->dispatchCommand();
52  break;
53  }
54  return $ret;
55  }
56 
57  protected function dispatchCommand()
58  {
59  $cmd = $this->ilCtrl->getCmd();
60  switch ($cmd)
61  {
62  default:
63  $ret = $this->show();
64  }
65 
66  return $ret;
67  }
68 
75  private function getContentBlockName()
76  {
77  if ($this->test->getKioskMode())
78  {
79  $this->tpl->setBodyClass("kiosk");
80  $this->tpl->setAddFooter(FALSE);
81  return "CONTENT";
82  }
83  else
84  {
85  return "ADM_CONTENT";
86  }
87  }
88 
89  public function show()
90  {
91  require_once 'class.ilTestEvaluationGUI.php';
92  require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php';
93 
94  global $ilUser;
95 
96  $template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test");
97 
98  $this->ilCtrl->setParameter($this, "skipfinalstatement", 1);
99  $template->setVariable("FORMACTION", $this->ilCtrl->getFormAction($this->testOutputGUI, 'redirectBack').'&reviewed=1');
100 
101  $template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next"));
102  $template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous"));
103 
104  if($this->test->getListOfQuestionsEnd())
105  {
106  $template->setVariable("CANCEL_CMD", 'outQuestionSummary');
107  }
108  else
109  {
110  $template->setVariable("CANCEL_CMD", 'backFromSummary');
111  }
112 
113  $active = $this->test->getActiveIdOfUser($ilUser->getId());
114 
115  $testevaluationgui = new ilTestEvaluationGUI($this->test);
116  $testevaluationgui->setContextWithinTestPass(true);
117  $results = $this->test->getTestResult($active, $this->testSession->getPass());
118  $results_output = $testevaluationgui->getPassListOfAnswers(
119  $results, $active, $this->testSession->getPass(), false, false, false, false
120  );
121 
122  if ($this->test->getShowExamviewPdf())
123  {
124  $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
125  global $ilSetting;
126  $inst_id = $ilSetting->get('inst_id', null);
127  $path = ilUtil::getWebspaceDir() . '/assessment/'. $this->testOutputGUI->object->getId() . '/exam_pdf';
128  if (!is_dir($path))
129  {
131  }
132  $filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $this->testSession->getPass() . '.pdf';
133  require_once 'class.ilTestPDFGenerator.php';
135  $template->setVariable("PDF_FILE_LOCATION", $filename);
136  }
137  else
138  {
139  $template->setCurrentBlock('prevent_double_form_subm');
140  $template->touchBlock('prevent_double_form_subm');
141  $template->parseCurrentBlock();
142  }
143 
144  if($this->test->getShowExamviewHtml())
145  {
146  if($this->test->getListOfQuestionsEnd())
147  {
148  $template->setVariable("CANCEL_CMD_BOTTOM", 'outQuestionSummary');
149  }
150  else
151  {
152  $template->setVariable("CANCEL_CMD_BOTTOM", 'backFromSummary');
153  }
154  $template->setVariable("BUTTON_CONTINUE_BOTTOM", $this->lng->txt("btn_next"));
155  $template->setVariable("BUTTON_BACK_BOTTOM", $this->lng->txt("btn_previous"));
156 
157  $template->setVariable('HTML_REVIEW', $results_output);
158  }
159 
160  $this->tpl->setVariable($this->getContentBlockName(), $template->get() );
161  }
162 }