ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilListOfQuestionsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once('./Services/Table/classes/class.ilTable2GUI.php');
25 
35 {
36  protected $show_points;
37  protected $show_marker;
38 
39  protected $obligationsFilter;
40 
48  public function __construct($a_parent_obj, $a_parent_cmd, $show_points, $show_marker, $obligationsNotAnswered = false, $obligationsFilter = false)
49  {
50  parent::__construct($a_parent_obj, $a_parent_cmd);
51 
52  global $lng, $ilCtrl;
53 
54  $this->lng = $lng;
55  $this->ctrl = $ilCtrl;
56  $this->show_points = $show_points;
57  $this->show_marker = $show_marker;
58  $this->obligationsNotAnswered = $obligationsNotAnswered;
59  $this->obligationsFilter = $obligationsFilter;
60 
61  $this->setFormName('listofquestions');
62  $this->setStyle('table', 'fullwidth');
63 
64  $this->addColumn($this->lng->txt("tst_qst_order"),'order', '');
65  $this->addColumn($this->lng->txt("tst_question_title"),'title', '');
66  $this->addColumn($this->lng->txt("obligatory"),'obligatory', '');
67  $this->addColumn('' ,'postponed', '');
68  if ($this->show_points)
69  {
70  $this->addColumn($this->lng->txt("tst_maximum_points"),'points', '');
71  }
72  $this->addColumn($this->lng->txt("worked_through"),'worked_through', '');
73  if ($this->show_marker)
74  {
75  $this->addColumn($this->lng->txt("tst_question_marker"),'marked', '');
76  }
77 
78  if( $obligationsFilter )
79  {
80  $this->setTitle($this->lng->txt('obligations_summary'));
81  }
82  else
83  {
84  $this->setTitle($this->lng->txt('question_summary'));
85  }
86 
87  $this->setRowTemplate("tpl.il_as_tst_list_of_questions_row.html", "Modules/Test");
88 
89  $this->addCommandButton('backFromSummary', $this->lng->txt('back'));
90 
91  if( !$obligationsNotAnswered )
92  {
93  $this->addCommandButton('finishTest', $this->lng->txt('save_finish'));
94  }
95 
96  $this->setLimit(999);
97 
98  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
99 
100  $this->enable('header');
101  $this->disable('sort');
102  $this->disable('select_all');
103  }
104 
112  public function fillRow($data)
113  {
114  if ($this->show_points)
115  {
116  $this->tpl->setCurrentBlock('points');
117  $this->tpl->setVariable("POINTS", $data['points']);
118  $this->tpl->parseCurrentBlock();
119  }
120  if (strlen($data['description']))
121  {
122  $this->tpl->setCurrentBlock('description');
123  $this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
124  $this->tpl->parseCurrentBlock();
125  }
126  if ($this->show_marker)
127  {
128  if ($data['marked'])
129  {
130  $this->tpl->setCurrentBlock('marked_img');
131  $this->tpl->setVariable("ALT_MARKED", $this->lng->txt("tst_question_marked"));
132  $this->tpl->setVariable("HREF_MARKED", ilUtil::getImagePath("marked.png"));
133  $this->tpl->parseCurrentBlock();
134  }
135  else
136  {
137  $this->tpl->touchBlock('marker');
138  }
139  }
140 
141  // obligatory icon
142  if( $data["obligatory"] )
143  {
144  $OBLIGATORY = "<img src=\"".ilUtil::getImagePath("obligatory.gif", "Modules/Test").
145  "\" alt=\"".$this->lng->txt("question_obligatory").
146  "\" title=\"".$this->lng->txt("question_obligatory")."\" />";
147  }
148  else $OBLIGATORY = '';
149 
150 
151  $this->tpl->setVariable("QUESTION_OBLIGATORY", $OBLIGATORY);
152 
153  $this->tpl->setVariable("ORDER", $data['order']);
154  $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
155  $this->tpl->setVariable("HREF", $data['href']);
156  $this->tpl->setVariable("POSTPONED", $data['postponed']);
157  if ($data["worked_through"])
158  {
159  $this->tpl->setVariable("HREF_WORKED_THROUGH", ilUtil::getImagePath("icon_ok.png"));
160  $this->tpl->setVariable("WORKED_THROUGH", $this->lng->txt("worked_through"));
161  }
162  else
163  {
164  $this->tpl->setVariable("HREF_WORKED_THROUGH", ilUtil::getImagePath("icon_not_ok.png"));
165  $this->tpl->setVariable("WORKED_THROUGH", $this->lng->txt("not_worked_through"));
166  }
167  }
168 }
169 ?>