ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
174 public function fillRow(array $row)
175 {
176 $this->ctrl->setParameter($this->parent_obj, 'evaluation', $row['qid']);
177
178 if( isset($row['pass']) )
179 {
180 $this->ctrl->setParameter($this->parent_obj, 'pass', $row['pass']);
181 }
182
183 if( $this->isQuestionTitleLinkPossible() )
184 {
185 $questionTitleLink = $this->getQuestionTitleLink($row['qid']);
186
187 if( strlen($questionTitleLink) )
188 {
189 $this->tpl->setVariable('URL_QUESTION_TITLE', $questionTitleLink);
190
191 $this->tpl->setCurrentBlock('title_link_end_tag');
192 $this->tpl->touchBlock('title_link_end_tag');
193 $this->tpl->parseCurrentBlock();
194 }
195 }
196
198 {
199 $objectives = $this->questionRelatedObjectivesList->getQuestionRelatedObjectiveTitles($row['qid']);
200 $this->tpl->setVariable('VALUE_LO_OBJECTIVES', strlen($objectives) ? $objectives : '&nbsp;');
201 }
202
203 if( $this->getShowHintCount() )
204 {
205 $this->tpl->setVariable('VALUE_HINT_COUNT', (int)$row['requested_hints']);
206 }
207
208 if( $this->getShowSuggestedSolution() )
209 {
210 $this->tpl->setVariable('SOLUTION_HINT', $row['solution']);
211 }
212
213 if( $this->areActionListsRequired() )
214 {
215 $this->tpl->setVariable('ACTIONS_MENU', $this->getActionList($row['qid']));
216 }
217
218 $this->tpl->setVariable('VALUE_QUESTION_TITLE', $row['title']);
219 $this->tpl->setVariable('VALUE_QUESTION_ID', $row['qid']);
220
221 if( $this->isPassColumnEnabled() )
222 {
223 $this->tpl->setVariable('VALUE_QUESTION_PASS', $row['pass'] + 1);
224 }
225 else
226 {
227 $this->tpl->setVariable('VALUE_QUESTION_COUNTER', $row['nr']);
228 }
229
230 $this->tpl->setVariable('VALUE_MAX_POINTS', $row['max']);
231 $this->tpl->setVariable('VALUE_REACHED_POINTS', $row['reached']);
232 $this->tpl->setVariable('VALUE_PERCENT_SOLVED', $row['percent']);
233
234 $this->tpl->setVariable('ROW_ID', $this->getRowId($row['qid']));
235 }
236
237 private function getRowId($questionId)
238 {
239 return "pass_details_tbl_row_act_{$this->getActiveId()}_qst_{$questionId}";
240 }
241
242 private function getQuestionTitleLink($questionId)
243 {
244 if( $this->getAnswerListAnchorEnabled() )
245 {
246 return $this->getAnswerListAnchor($questionId);
247 }
248
249 if( strlen($this->getSingleAnswerScreenCmd()) )
250 {
251 return $this->ctrl->getLinkTarget($this->parent_obj, $this->getSingleAnswerScreenCmd());
252 }
253
254 return '';
255 }
256
258 {
259 if( $this->getAnswerListAnchorEnabled() )
260 {
261 return true;
262 }
263
264 if( strlen($this->getSingleAnswerScreenCmd()) )
265 {
266 return true;
267 }
268
269 return false;
270 }
271
272 private function areActionListsRequired()
273 {
274 if( $this->isPdfGenerationRequest() )
275 {
276 return false;
277 }
278
279 if( !$this->getAnswerListAnchorEnabled() )
280 {
281 return false;
282 }
283
284 if( !strlen($this->getSingleAnswerScreenCmd()) )
285 {
286 return false;
287 }
288
289 return true;
290 }
291
292 private function getActionList($questionId)
293 {
294 $aslGUI = new ilAdvancedSelectionListGUI();
295 $aslGUI->setListTitle($this->lng->txt('tst_answer_details'));
296 $aslGUI->setId("act{$this->getActiveId()}_qst{$questionId}");
297
298 if( $this->getAnswerListAnchorEnabled() )
299 {
300 $aslGUI->addItem(
301 $this->lng->txt('tst_list_answer_details'), 'tst_pass_details', $this->getAnswerListAnchor($questionId)
302 );
303 }
304
305 if( strlen($this->getSingleAnswerScreenCmd()) )
306 {
307 $aslGUI->addItem(
308 $this->lng->txt('tst_single_answer_details'), 'tst_pass_details',
309 $this->ctrl->getLinkTarget($this->parent_obj, $this->getSingleAnswerScreenCmd())
310 );
311 }
312
313 return $aslGUI->getHTML();
314 }
315
317 {
318 $this->singleAnswerScreenCmd = $singleAnswerScreenCmd;
319 }
320
321 public function getSingleAnswerScreenCmd()
322 {
324 }
325
327 {
328 $this->answerListAnchorEnabled = $answerListAnchorEnabled;
329 }
330
332 {
334 }
335
336 private function getAnswerListAnchor($questionId)
337 {
338 return "#detailed_answer_block_act_{$this->getActiveId()}_qst_{$questionId}";
339 }
340
342 {
343 // Has to be called before column initialization
344 $this->showHintCount = $showHintCount;
345 }
346
347 public function getShowHintCount()
348 {
350 }
351
353 {
354 $this->showSuggestedSolution = $showSuggestedSolution;
355 }
356
357 public function getShowSuggestedSolution()
358 {
360 }
361
362 public function setActiveId($activeId)
363 {
364 $this->activeId = $activeId;
365 }
366
367 public function getActiveId()
368 {
369 return $this->activeId;
370 }
371
376 {
378 }
379
384 {
385 $this->objectiveOrientedPresentationEnabled = $objectiveOrientedPresentationEnabled;
386 }
387
392 {
394 }
395
400 {
401 $this->multipleObjectivesInvolved = $multipleObjectivesInvolved;
402 }
403
408 {
410 }
411
416 {
417 $this->questionRelatedObjectivesList = $questionRelatedObjectivesList;
418 }
419
423 public function isPassColumnEnabled()
424 {
426 }
427
432 {
433 $this->passColumnEnabled = $passColumnEnabled;
434 }
435}
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.
setFormName($a_formname)
Set Form name.
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.
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