ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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');
6
16{
17 protected $showPointsEnabled = false;
18 protected $showMarkerEnabled = false;
19
20 protected $showObligationsEnabled = false;
21 protected $obligationsFilterEnabled = false;
22
23 protected $obligationsNotAnswered = false;
24
32 public function __construct($a_parent_obj, $a_parent_cmd)
33 {
34 parent::__construct($a_parent_obj, $a_parent_cmd);
35
36 global $lng, $ilCtrl;
37
38 $this->lng = $lng;
39 $this->ctrl = $ilCtrl;
40
41 $this->setFormName('listofquestions');
42 $this->setStyle('table', 'fullwidth');
43
44 $this->setRowTemplate("tpl.il_as_tst_list_of_questions_row.html", "Modules/Test");
45
46 $this->setLimit(999);
47
48 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
49
50 $this->enable('header');
51 $this->disable('sort');
52 $this->disable('select_all');
53 }
54
55 public function init()
56 {
57 // table title
58
59 if( $this->isObligationsFilterEnabled() )
60 {
61 $this->setTitle($this->lng->txt('obligations_summary'));
62 }
63 else
64 {
65 $this->setTitle($this->lng->txt('question_summary'));
66 }
67
68 // columns
69
70 $this->addColumn($this->lng->txt("tst_qst_order"),'order', '');
71 $this->addColumn($this->lng->txt("tst_question_title"),'title', '');
72
73 if( $this->isShowObligationsEnabled() )
74 {
75 $this->addColumn($this->lng->txt("obligatory"), 'obligatory', '');
76 }
77
78 $this->addColumn('' ,'postponed', '');
79
80 if ($this->isShowPointsEnabled())
81 {
82 $this->addColumn($this->lng->txt("tst_maximum_points"),'points', '');
83 }
84
85 $this->addColumn($this->lng->txt("worked_through"),'worked_through', '');
86
87 if( $this->isShowObligationsEnabled() )
88 {
89 $this->addColumn($this->lng->txt("answered"),'answered', '');
90 }
91
92 if ($this->isShowMarkerEnabled())
93 {
94 $this->addColumn($this->lng->txt("tst_question_marker"),'marked', '');
95 }
96
97 // command buttons
98
99 $this->addCommandButton('backFromSummary', $this->lng->txt('back'));
100
101 if( !$this->areObligationsNotAnswered() )
102 {
103 $button = ilSubmitButton::getInstance();
104 $button->setCaption('save_finish');
105 $button->setCommand('finishTest');
106 $this->addCommandButtonInstance($button);
107 }
108 }
109
117 public function fillRow($data)
118 {
119 if ($this->isShowPointsEnabled())
120 {
121 $this->tpl->setCurrentBlock('points');
122 $this->tpl->setVariable("POINTS", $data['points']);
123 $this->tpl->parseCurrentBlock();
124 }
125 if (strlen($data['description']))
126 {
127 $this->tpl->setCurrentBlock('description');
128 $this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
129 $this->tpl->parseCurrentBlock();
130 }
131 if ($this->isShowMarkerEnabled())
132 {
133 if ($data['marked'])
134 {
135 $this->tpl->setCurrentBlock('marked_img');
136 $this->tpl->setVariable("HREF_MARKED", ilUtil::img('./templates/default/images/marked.svg', $this->lng->txt("tst_question_marked"), '24px', '24px'));
137 $this->tpl->parseCurrentBlock();
138 }
139 else
140 {
141 $this->tpl->touchBlock('marker');
142 }
143 }
144 if( $this->isShowObligationsEnabled() )
145 {
146 // obligatory answer status
147 $value = '&nbsp;';
148 if( $data['isAnswered'] )
149 {
150 $value = $this->lng->txt("yes");
151 }
152 $this->tpl->setCurrentBlock('answered_col');
153 $this->tpl->setVariable('ANSWERED', $value);
154 $this->tpl->parseCurrentBlock();
155
156 // obligatory icon
157 if( $data["obligatory"] )
158 {
159 $OBLIGATORY = "<img src=\"".ilUtil::getImagePath("obligatory.gif", "Modules/Test").
160 "\" alt=\"".$this->lng->txt("question_obligatory").
161 "\" title=\"".$this->lng->txt("question_obligatory")."\" />";
162 }
163 else $OBLIGATORY = '';
164 $this->tpl->setVariable("QUESTION_OBLIGATORY", $OBLIGATORY);
165 }
166
167 $this->tpl->setVariable("ORDER", $data['order']);
168 $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
169 $this->tpl->setVariable("HREF", $data['href']);
170 $this->tpl->setVariable("POSTPONED", $data['postponed']);
171 if ($data["worked_through"])
172 {
173 $this->tpl->setVariable("WORKED_THROUGH", $this->lng->txt("yes"));
174 }
175 else
176 {
177 $this->tpl->setVariable("WORKED_THROUGH", '&nbsp;');
178 }
179 }
180
181 public function isShowPointsEnabled()
182 {
184 }
185
187 {
188 $this->showPointsEnabled = $showPointsEnabled;
189 }
190
191 public function isShowMarkerEnabled()
192 {
194 }
195
197 {
198 $this->showMarkerEnabled = $showMarkerEnabled;
199 }
200
201 public function isShowObligationsEnabled()
202 {
204 }
205
207 {
208 $this->showObligationsEnabled = $showObligationsEnabled;
209 }
210
212 {
214 }
215
217 {
218 $this->obligationsFilterEnabled = $obligationsFilterEnabled;
219 }
220
222 {
224 }
225
227 {
228 $this->obligationsNotAnswered = $obligationsNotAnswered;
229 }
230
231
232}
__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="")
Add a column to the header.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormName($a_formname)
Set Form name.
addCommandButtonInstance(ilButton $a_button)
Add Command button instance.
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)
setLimit($a_limit=0, $a_default_limit=0)
set max.
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