ILIAS  eassessment Revision 61809
 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 
45  public function __construct($a_parent_obj, $a_parent_cmd, $show_points, $show_marker)
46  {
47  parent::__construct($a_parent_obj, $a_parent_cmd);
48 
49  global $lng, $ilCtrl;
50 
51  $this->lng = $lng;
52  $this->ctrl = $ilCtrl;
53  $this->show_points = $show_points;
54  $this->show_marker = $show_marker;
55 
56  $this->setFormName('listofquestions');
57  $this->setStyle('table', 'fullwidth');
58 
59  $this->addColumn($this->lng->txt("tst_qst_order"),'order', '');
60  $this->addColumn($this->lng->txt("tst_question_title"),'title', '');
61  $this->addColumn('' ,'postponed', '');
62  if ($this->show_points)
63  {
64  $this->addColumn($this->lng->txt("tst_maximum_points"),'points', '');
65  }
66  $this->addColumn($this->lng->txt("worked_through"),'worked_through', '');
67  if ($this->show_marker)
68  {
69  $this->addColumn($this->lng->txt("tst_question_marker"),'marked', '');
70  }
71 
72  $this->setTitle($this->lng->txt('question_summary'));
73 
74  $this->setRowTemplate("tpl.il_as_tst_list_of_questions_row.html", "Modules/Test");
75 
76  $this->addCommandButton('backFromSummary', $this->lng->txt('back'));
77  $this->addCommandButton('finishTest', $this->lng->txt('save_finish'));
78  $this->setLimit(999);
79 
80  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
81 
82  $this->enable('header');
83  $this->disable('sort');
84  $this->disable('select_all');
85  }
86 
94  public function fillRow($data)
95  {
96  if ($this->show_points)
97  {
98  $this->tpl->setCurrentBlock('points');
99  $this->tpl->setVariable("POINTS", $data['points']);
100  $this->tpl->parseCurrentBlock();
101  }
102  if (strlen($data['description']))
103  {
104  $this->tpl->setCurrentBlock('description');
105  $this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
106  $this->tpl->parseCurrentBlock();
107  }
108  if ($this->show_marker)
109  {
110  if ($data['marked'])
111  {
112  $this->tpl->setCurrentBlock('marked_img');
113  $this->tpl->setVariable("ALT_MARKED", $this->lng->txt("tst_question_marked"));
114  $this->tpl->setVariable("HREF_MARKED", ilUtil::getImagePath("marked.png"));
115  $this->tpl->parseCurrentBlock();
116  }
117  else
118  {
119  $this->tpl->touchBlock('marker');
120  }
121  }
122  $this->tpl->setVariable("ORDER", $data['order']);
123  $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
124  $this->tpl->setVariable("HREF", $data['href']);
125  $this->tpl->setVariable("POSTPONED", $data['postponed']);
126  if ($data["worked_through"])
127  {
128  $this->tpl->setVariable("HREF_WORKED_THROUGH", ilUtil::getImagePath("icon_worked_through.gif"));
129  $this->tpl->setVariable("WORKED_THROUGH", $this->lng->txt("worked_through"));
130  }
131  else
132  {
133  $this->tpl->setVariable("HREF_WORKED_THROUGH", ilUtil::getImagePath("icon_not_worked_through.gif"));
134  $this->tpl->setVariable("WORKED_THROUGH", $this->lng->txt("not_worked_through"));
135  }
136  }
137 }
138 ?>