ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilTestQuestionSideListGUI.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 
12 {
16  protected $ctrl;
17 
21  protected $lng;
22 
26  private $targetGUI;
27 
32 
37 
42 
46  private $disabled;
47 
53  {
54  $this->ctrl = $ctrl;
55  $this->lng = $lng;
56 
57  $this->questionSummaryData = array();
58  $this->currentSequenceElement = null;
59  $this->disabled = false;
60  }
61 
65  public function getTargetGUI()
66  {
67  return $this->targetGUI;
68  }
69 
73  public function setTargetGUI($targetGUI)
74  {
75  $this->targetGUI = $targetGUI;
76  }
77 
81  public function getQuestionSummaryData()
82  {
84  }
85 
90  {
91  $this->questionSummaryData = $questionSummaryData;
92  }
93 
97  public function getCurrentSequenceElement()
98  {
100  }
101 
106  {
107  $this->currentSequenceElement = $currentSequenceElement;
108  }
109 
113  public function getCurrentPresentationMode()
114  {
116  }
117 
122  {
123  $this->currentPresentationMode = $currentPresentationMode;
124  }
125 
129  public function isDisabled()
130  {
131  return $this->disabled;
132  }
133 
137  public function setDisabled($disabled)
138  {
139  $this->disabled = $disabled;
140  }
141 
145  private function buildPanel()
146  {
147  require_once 'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
148  $panel = ilPanelGUI::getInstance();
149  $panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_SUBHEADING);
150  $panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
151  $panel->setHeading($this->lng->txt('list_of_questions'));
152  return $panel;
153  }
154 
158  private function renderList()
159  {
160  $tpl = new ilTemplate('tpl.il_as_tst_list_of_questions_short.html', true, true, 'Modules/Test');
161 
162  foreach( $this->getQuestionSummaryData() as $row )
163  {
164  $title = ilUtil::prepareFormOutput($row['title']);
165 
166  if( strlen($row['description']) )
167  {
168  $description = " title=\"{$row['description']}\" ";
169  }
170  else
171  {
172  $description = "";
173  }
174 
175  $active = ($row['sequence'] == $this->getCurrentSequenceElement()) ? ' active' : '';
176 
177  $class = (
178  $row['worked_through'] ? 'answered'.$active : 'unanswered'.$active
179  );
180 
181  /*
182  if( $this->isDisabled() )
183  {
184  $tpl->setCurrentBlock('disabled_entry');
185  $tpl->setVariable('CLASS', $class);
186  $tpl->setVariable('ITEM', $title);
187  $tpl->setVariable('DESCRIPTION', $description);
188  $tpl->parseCurrentBlock();
189  }
190  else
191  {
192  */
193  $tpl->setCurrentBlock('linked_entry');
194  $tpl->setVariable('HREF', $this->buildLink($row['sequence']));
195  $tpl->setVariable('NEXTCMD', ilTestPlayerCommands::SHOW_QUESTION);
196  $tpl->setVariable('NEXTSEQ', $row['sequence']);
197  $tpl->setVariable('CLASS', $class);
198  $tpl->setVariable('ITEM', $title);
199  $tpl->setVariable("DESCRIPTION", $description);
200  $tpl->parseCurrentBlock();
201  /*
202  }
203  */
204 
205  $tpl->setCurrentBlock('item');
206  }
207 
208  return $tpl->get();
209  }
210 
214  public function getHTML()
215  {
216  $panel = $this->buildPanel();
217  $panel->setBody($this->renderList());
218  return $panel->getHTML();
219  }
220 
225  private function buildLink($sequenceElement)
226  {
227  $this->ctrl->setParameter(
228  $this->getTargetGUI(), 'pmode', ''
229  );
230 
231  $this->ctrl->setParameter(
232  $this->getTargetGUI(), 'sequence', $sequenceElement
233  );
234 
235  $href = $this->ctrl->getLinkTarget($this->getTargetGUI(), ilTestPlayerCommands::SHOW_QUESTION);
236 
237  $this->ctrl->setParameter(
238  $this->getTargetGUI(), 'pmode', $this->getCurrentPresentationMode()
239  );
240  $this->ctrl->setParameter(
241  $this->getTargetGUI(), 'sequence', $this->getCurrentSequenceElement()
242  );
243  return $href;
244  }
245 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class provides processing control methods.
setCurrentSequenceElement($currentSequenceElement)
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
setCurrentPresentationMode($currentPresentationMode)
const HEADING_STYLE_SUBHEADING
static getInstance()
Get instance.
const PANEL_STYLE_SECONDARY
language handling
__construct(ilCtrl $ctrl, ilLanguage $lng)