ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTestPassDetailsOverviewTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
6
16{
17 private $singleAnswerScreenCmd = null;
18
19 private $answerListAnchorEnabled = false;
20
21 private $showHintCount = false;
22
23 private $showSuggestedSolution = false;
24
25 private $activeId = null;
26
28
30
32
33 private $passColumnEnabled = false;
34
35 private $tableIdsByParentClasses = array(
36 'ilTestEvaluationGUI' => 1,
37 'ilTestServiceGUI' => 2
38 );
39
44
45 public function __construct(ilCtrl $ctrl, $parent, $cmd)
46 {
47 $tableId = 0;
48 if( isset($this->tableIdsByParentClasses[get_class($parent)]) )
49 {
50 $tableId = $this->tableIdsByParentClasses[get_class($parent)];
51 }
52
53 $this->ctrl = $ctrl;
54
55 $this->setId('tst_pdo_'.$tableId);
56 $this->setPrefix('tst_pdo_'.$tableId);
57
58 $this->setDefaultOrderField('nr');
59 $this->setDefaultOrderDirection('ASC');
60
61 parent::__construct($parent, $cmd);
62
63 $this->setFormName('tst_pass_details_overview');
64 $this->setFormAction($this->ctrl->getFormAction($parent, $cmd));
65
66 // Don't set any limit because of print/pdf views.
67 $this->setLimit(PHP_INT_MAX);
68 $this->setExternalSegmentation(true);
69
70 $this->disable('linkbar');
71 $this->disable('hits');
72 $this->disable('sort');
73
74 //$this->disable('numinfo');
75 //$this->disable('numinfo_header');
76 // KEEP THIS ENABLED, SINCE NO TABLE FILTER ARE PROVIDED OTHERWISE
77
78 $this->setRowTemplate('tpl.il_as_tst_pass_details_overview_qst_row.html', 'Modules/Test');
79 }
80
84 public function initColumns()
85 {
86 if( $this->isPassColumnEnabled() )
87 {
89 {
90 $passHeaderLabel = $this->lng->txt("tst_attempt");
91 }
92 else
93 {
94 $passHeaderLabel = $this->lng->txt("pass");
95 }
96
97 $this->addColumn($passHeaderLabel, 'pass', '');
98 }
99 else
100 {
101 $this->addColumn($this->lng->txt("tst_question_no"), '', '');
102 }
103
104 $this->addColumn($this->lng->txt("question_id"), '', '');
105 $this->addColumn($this->lng->txt("tst_question_title"), '', '');
106
108 {
109 $this->addColumn($this->lng->txt('tst_res_lo_objectives_header'), '', '');
110 }
111
112 $this->addColumn($this->lng->txt("tst_maximum_points"), '', '');
113 $this->addColumn($this->lng->txt("tst_reached_points"), '', '');
114
115 if( $this->getShowHintCount() )
116 {
117 $this->addColumn($this->lng->txt("tst_question_hints_requested_hint_count_header"), '', '');
118 }
119
120 $this->addColumn($this->lng->txt("tst_percent_solved"), '', '');
121
122 if( $this->getShowSuggestedSolution() )
123 {
124 $this->addColumn($this->lng->txt("solution_hint"), '', '');
125 }
126
127 if( $this->areActionListsRequired() )
128 {
129 $this->addColumn('', '', '1');
130 }
131
132 return $this;
133 }
134
138 public function initFilter()
139 {
140 if( count($this->parent_obj->object->getResultFilterTaxIds()) )
141 {
142 require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
143
144 foreach($this->parent_obj->object->getResultFilterTaxIds() as $taxId)
145 {
146 $postvar = "tax_$taxId";
147
148 $inp = new ilTaxSelectInputGUI($taxId, $postvar, true);
149 $this->addFilterItem($inp);
150 $inp->readFromSession();
151 $this->filter[$postvar] = $inp->getValue();
152 }
153 }
154
155 return $this;
156 }
157
161 public function isPdfGenerationRequest()
162 {
164 }
165
169 public function setIsPdfGenerationRequest($is_print_request)
170 {
171 $this->is_pdf_generation_request = $is_print_request;
172 }
173
177 public function fillRow($row)
178 {
179 $this->ctrl->setParameter($this->parent_obj, 'evaluation', $row['qid']);
180
181 if( isset($row['pass']) )
182 {
183 $this->ctrl->setParameter($this->parent_obj, 'pass', $row['pass']);
184 }
185
186 if( $this->isQuestionTitleLinkPossible() )
187 {
188 $questionTitleLink = $this->getQuestionTitleLink($row['qid']);
189
190 if( strlen($questionTitleLink) )
191 {
192 $this->tpl->setVariable('URL_QUESTION_TITLE', $questionTitleLink);
193
194 $this->tpl->setCurrentBlock('title_link_end_tag');
195 $this->tpl->touchBlock('title_link_end_tag');
196 $this->tpl->parseCurrentBlock();
197 }
198 }
199
201 {
202 $objectives = $this->questionRelatedObjectivesList->getQuestionRelatedObjectiveTitles($row['qid']);
203 $this->tpl->setVariable('VALUE_LO_OBJECTIVES', strlen($objectives) ? $objectives : '&nbsp;');
204 }
205
206 if( $this->getShowHintCount() )
207 {
208 $this->tpl->setVariable('VALUE_HINT_COUNT', (int)$row['requested_hints']);
209 }
210
211 if( $this->getShowSuggestedSolution() )
212 {
213 $this->tpl->setVariable('SOLUTION_HINT', $row['solution']);
214 }
215
216 if( $this->areActionListsRequired() )
217 {
218 $this->tpl->setVariable('ACTIONS_MENU', $this->getActionList($row['qid']));
219 }
220
221 $this->tpl->setVariable('VALUE_QUESTION_TITLE', $row['title']);
222 $this->tpl->setVariable('VALUE_QUESTION_ID', $row['qid']);
223
224 if( $this->isPassColumnEnabled() )
225 {
226 $this->tpl->setVariable('VALUE_QUESTION_PASS', $row['pass'] + 1);
227 }
228 else
229 {
230 $this->tpl->setVariable('VALUE_QUESTION_COUNTER', $row['nr']);
231 }
232
233 $this->tpl->setVariable('VALUE_MAX_POINTS', $row['max']);
234 $this->tpl->setVariable('VALUE_REACHED_POINTS', $row['reached']);
235 $this->tpl->setVariable('VALUE_PERCENT_SOLVED', $row['percent']);
236
237 $this->tpl->setVariable('ROW_ID', $this->getRowId($row['qid']));
238 }
239
240 private function getRowId($questionId)
241 {
242 return "pass_details_tbl_row_act_{$this->getActiveId()}_qst_{$questionId}";
243 }
244
245 private function getQuestionTitleLink($questionId)
246 {
247 if( $this->getAnswerListAnchorEnabled() )
248 {
249 return $this->getAnswerListAnchor($questionId);
250 }
251
252 if( strlen($this->getSingleAnswerScreenCmd()) )
253 {
254 return $this->ctrl->getLinkTarget($this->parent_obj, $this->getSingleAnswerScreenCmd());
255 }
256
257 return '';
258 }
259
261 {
262 if( $this->getAnswerListAnchorEnabled() )
263 {
264 return true;
265 }
266
267 if( strlen($this->getSingleAnswerScreenCmd()) )
268 {
269 return true;
270 }
271
272 return false;
273 }
274
275 private function areActionListsRequired()
276 {
277 if( $this->isPdfGenerationRequest() )
278 {
279 return false;
280 }
281
282 if( !$this->getAnswerListAnchorEnabled() )
283 {
284 return false;
285 }
286
287 if( !strlen($this->getSingleAnswerScreenCmd()) )
288 {
289 return false;
290 }
291
292 return true;
293 }
294
295 private function getActionList($questionId)
296 {
297 $aslGUI = new ilAdvancedSelectionListGUI();
298 $aslGUI->setListTitle($this->lng->txt('tst_answer_details'));
299 $aslGUI->setId("act{$this->getActiveId()}_qst{$questionId}");
300
301 if( $this->getAnswerListAnchorEnabled() )
302 {
303 $aslGUI->addItem(
304 $this->lng->txt('tst_list_answer_details'), 'tst_pass_details', $this->getAnswerListAnchor($questionId)
305 );
306 }
307
308 if( strlen($this->getSingleAnswerScreenCmd()) )
309 {
310 $aslGUI->addItem(
311 $this->lng->txt('tst_single_answer_details'), 'tst_pass_details',
312 $this->ctrl->getLinkTarget($this->parent_obj, $this->getSingleAnswerScreenCmd())
313 );
314 }
315
316 return $aslGUI->getHTML();
317 }
318
320 {
321 $this->singleAnswerScreenCmd = $singleAnswerScreenCmd;
322 }
323
324 public function getSingleAnswerScreenCmd()
325 {
327 }
328
330 {
331 $this->answerListAnchorEnabled = $answerListAnchorEnabled;
332 }
333
335 {
337 }
338
339 private function getAnswerListAnchor($questionId)
340 {
341 return "#detailed_answer_block_act_{$this->getActiveId()}_qst_{$questionId}";
342 }
343
345 {
346 // Has to be called before column initialization
347 $this->showHintCount = $showHintCount;
348 }
349
350 public function getShowHintCount()
351 {
353 }
354
356 {
357 $this->showSuggestedSolution = $showSuggestedSolution;
358 }
359
360 public function getShowSuggestedSolution()
361 {
363 }
364
365 public function setActiveId($activeId)
366 {
367 $this->activeId = $activeId;
368 }
369
370 public function getActiveId()
371 {
372 return $this->activeId;
373 }
374
379 {
381 }
382
387 {
388 $this->objectiveOrientedPresentationEnabled = $objectiveOrientedPresentationEnabled;
389 }
390
395 {
397 }
398
403 {
404 $this->multipleObjectivesInvolved = $multipleObjectivesInvolved;
405 }
406
411 {
413 }
414
419 {
420 $this->questionRelatedObjectivesList = $questionRelatedObjectivesList;
421 }
422
426 public function isPassColumnEnabled()
427 {
429 }
430
435 {
436 $this->passColumnEnabled = $passColumnEnabled;
437 }
438}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
This class provides processing control methods.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExternalSegmentation($a_val)
Set external segmentation.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
disable($a_module_name)
diesables particular modules of table
Select taxonomy nodes input GUI.
setObjectiveOrientedPresentationEnabled($objectiveOrientedPresentationEnabled)
setQuestionRelatedObjectivesList($questionRelatedObjectivesList)
$cmd
Definition: sahs_server.php:35