ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilListOfQuestionsTableGUI.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
5include_once('./Services/Table/classes/class.ilTable2GUI.php');
6require_once 'Modules/Test/classes/class.ilTestPlayerCommands.php';
7
17{
18 protected $showPointsEnabled = false;
19 protected $showMarkerEnabled = false;
20
21 protected $showObligationsEnabled = false;
22 protected $obligationsFilterEnabled = false;
23
24 protected $obligationsNotAnswered = false;
25
26 protected $finishTestButtonEnabled = false;
27
35 public function __construct($a_parent_obj, $a_parent_cmd)
36 {
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38
39 global $lng, $ilCtrl;
40
41 $this->lng = $lng;
42 $this->ctrl = $ilCtrl;
43
44 $this->setFormName('listofquestions');
45 $this->setStyle('table', 'fullwidth');
46
47 $this->setRowTemplate("tpl.il_as_tst_list_of_questions_row.html", "Modules/Test");
48
49 $this->setLimit(999);
50
51 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
52
53 $this->enable('header');
54 $this->disable('sort');
55 $this->disable('select_all');
56 }
57
58 public function init()
59 {
60 // table title
61
62 if( $this->isObligationsFilterEnabled() )
63 {
64 $this->setTitle($this->lng->txt('obligations_summary'));
65 }
66 else
67 {
68 $this->setTitle($this->lng->txt('question_summary'));
69 }
70
71 // columns
72
73 $this->addColumn($this->lng->txt("tst_qst_order"),'order', '');
74 $this->addColumn($this->lng->txt("tst_question_title"),'title', '');
75
76 if( false && $this->isShowObligationsEnabled() )
77 {
78 $this->addColumn($this->lng->txt("obligatory"), 'obligatory', '');
79 }
80
81 $this->addColumn('' ,'postponed', '');
82
83 if ($this->isShowPointsEnabled())
84 {
85 $this->addColumn($this->lng->txt("tst_maximum_points"),'points', '');
86 }
87
88 #$this->addColumn($this->lng->txt("worked_through"),'worked_through', '');
89 $this->addColumn($this->lng->txt("answered"),'answered', '');
90
91 if( false && $this->isShowObligationsEnabled() )
92 {
93 $this->addColumn($this->lng->txt("answered"),'answered', '');
94 }
95
96 if ($this->isShowMarkerEnabled())
97 {
98 $this->addColumn($this->lng->txt("tst_question_marker"),'marked', '');
99 }
100
101 // command buttons
102
103 $this->addCommandButton(
104 ilTestPlayerCommands::SHOW_QUESTION, $this->lng->txt('back')
105 );
106
107 if( !$this->areObligationsNotAnswered() && $this->isFinishTestButtonEnabled() )
108 {
109 $button = ilSubmitButton::getInstance();
110 $button->setCaption('finish_test');
111 $button->setCommand(ilTestPlayerCommands::FINISH_TEST);
112 $this->addCommandButtonInstance($button);
113 }
114 }
115
123 public function fillRow($data)
124 {
125 if ($this->isShowPointsEnabled())
126 {
127 $this->tpl->setCurrentBlock('points');
128 $this->tpl->setVariable("POINTS", $data['points'].'&nbsp;'.$this->lng->txt("points_short"));
129 $this->tpl->parseCurrentBlock();
130 }
131 if (strlen($data['description']))
132 {
133 $this->tpl->setCurrentBlock('description');
134 $this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
135 $this->tpl->parseCurrentBlock();
136 }
137 if ($this->isShowMarkerEnabled())
138 {
139 if ($data['marked'])
140 {
141 $this->tpl->setCurrentBlock('marked_img');
142 $this->tpl->setVariable("HREF_MARKED", ilUtil::img('./templates/default/images/marked.svg', $this->lng->txt("tst_question_marked"), '24px', '24px'));
143 $this->tpl->parseCurrentBlock();
144 }
145 else
146 {
147 $this->tpl->touchBlock('marker');
148 }
149 }
150 if( false && $this->isShowObligationsEnabled() )
151 {
152 // obligatory answer status
153 $value = '&nbsp;';
154 if( $data['isAnswered'] )
155 {
156 $value = $this->lng->txt("yes");
157 }
158 $this->tpl->setCurrentBlock('answered_col');
159 $this->tpl->setVariable('ANSWERED', $value);
160 $this->tpl->parseCurrentBlock();
161
162 // obligatory icon
163 if( $data["obligatory"] )
164 {
165 $OBLIGATORY = "<img src=\"".ilUtil::getImagePath("obligatory.gif", "Modules/Test").
166 "\" alt=\"".$this->lng->txt("question_obligatory").
167 "\" title=\"".$this->lng->txt("question_obligatory")."\" />";
168 }
169 else $OBLIGATORY = '';
170 $this->tpl->setVariable("QUESTION_OBLIGATORY", $OBLIGATORY);
171 }
172
173 $this->ctrl->setParameter($this->parent_obj, 'sequence', $data['sequence']);
174 $this->ctrl->setParameter($this->parent_obj, 'pmode', '');
175 $href = $this->ctrl->getLinkTarget($this->parent_obj, ilTestPlayerCommands::SHOW_QUESTION);
176
177 $postponed = (
178 $data['postponed'] ? $this->lng->txt('postponed') : ''
179 );
180
181 $this->tpl->setVariable("ORDER", $data['order']);
182 $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
183 $this->tpl->setVariable("HREF", $href);
184 $this->tpl->setVariable("POSTPONED", $postponed);
185 if ($data["worked_through"])
186 {
187 $this->tpl->setVariable("WORKED_THROUGH", $this->lng->txt("yes"));
188 }
189 else
190 {
191 $this->tpl->setVariable("WORKED_THROUGH", '&nbsp;');
192 }
193 }
194
195 public function isShowPointsEnabled()
196 {
198 }
199
201 {
202 $this->showPointsEnabled = $showPointsEnabled;
203 }
204
205 public function isShowMarkerEnabled()
206 {
208 }
209
211 {
212 $this->showMarkerEnabled = $showMarkerEnabled;
213 }
214
215 public function isShowObligationsEnabled()
216 {
218 }
219
221 {
222 $this->showObligationsEnabled = $showObligationsEnabled;
223 }
224
226 {
228 }
229
231 {
232 $this->obligationsFilterEnabled = $obligationsFilterEnabled;
233 }
234
236 {
238 }
239
241 {
242 $this->obligationsNotAnswered = $obligationsNotAnswered;
243 }
244
249 {
251 }
252
257 {
258 $this->finishTestButtonEnabled = $finishTestButtonEnabled;
259 }
260}
setFinishTestButtonEnabled($finishTestButtonEnabled)
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
setShowObligationsEnabled($showObligationsEnabled)
setObligationsFilterEnabled($obligationsFilterEnabled)
setObligationsNotAnswered($obligationsNotAnswered)
static getInstance()
Factory.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
addCommandButtonInstance(ilButtonBase $a_button)
Add Command button instance.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
disable($a_module_name)
diesables particular modules of table
setStyle($a_element, $a_style)
enable($a_module_name)
enables particular modules of table
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40