ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilEvaluationAllTableGUI.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 
36 {
37  protected $specialcolumns;
38  protected $anonymity;
39 
40  public function __construct($a_parent_obj, $a_parent_cmd, $special_columns, $anonymity = false)
41  {
42  global $ilCtrl, $lng;
43 
44  parent::__construct($a_parent_obj, $a_parent_cmd);
45 
46  $this->lng = $lng;
47  $this->ctrl = $ilCtrl;
48  $this->setSpecialColumns($special_columns);
49  $this->setFormName('evaluation_all');
50  $this->setStyle('table', 'fullwidth');
51  $this->addColumn($lng->txt("name"), "name", "");
52  $this->addColumn($lng->txt("login"), "login", "");
53  $this->anonymity = $anonymity;
54  if ($this->hasSpecialColumn('gender'))
55  {
56  $this->addColumn($lng->txt("gender"), "gender", "");
57  }
58  if ($this->hasSpecialColumn('email'))
59  {
60  $this->addColumn($lng->txt("email"), "email", "");
61  }
62  if ($this->hasSpecialColumn('institution'))
63  {
64  $this->addColumn($lng->txt("institution"), "institution", "");
65  }
66  if ($this->hasSpecialColumn('street'))
67  {
68  $this->addColumn($lng->txt("street"), "street", "");
69  }
70  if ($this->hasSpecialColumn('city'))
71  {
72  $this->addColumn($lng->txt("city"), "city", "");
73  }
74  if ($this->hasSpecialColumn('zipcode'))
75  {
76  $this->addColumn($lng->txt("zipcode"), "zipcode", "");
77  }
78  if ($this->hasSpecialColumn('country'))
79  {
80  $this->addColumn($lng->txt("country"), "country", "");
81  }
82  if ($this->hasSpecialColumn('department'))
83  {
84  $this->addColumn($lng->txt("department"), "department", "");
85  }
86  if ($this->hasSpecialColumn('matriculation'))
87  {
88  $this->addColumn($lng->txt("matriculation"), "matriculation", "");
89  }
90  $this->addColumn($lng->txt("tst_reached_points"), "reached", "");
91  $this->addColumn($lng->txt("tst_mark"), "tst_mark", "");
92  if ($this->hasSpecialColumn('ects_grade'))
93  {
94  $this->addColumn($lng->txt("ects_grade"), "ects_grade", "");
95  }
96  $this->addColumn($lng->txt("tst_answered_questions"), "answered", "");
97  $this->addColumn($lng->txt("working_time"), "working_time", "");
98  $this->addColumn($lng->txt("detailed_evaluation"), "details", "");
99 
100  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
101  $this->setRowTemplate("tpl.table_evaluation_all.html", "Modules/Test");
102  $this->setDefaultOrderField("name");
103  $this->setDefaultOrderDirection("asc");
104  $this->enable('sort');
105  $this->enable('header');
106 
107  $this->setFilterCommand('filterEvaluation');
108  $this->setResetCommand('resetfilterEvaluation');
109  $this->initFilter();
110  }
111 
117  function numericOrdering($a_field)
118  {
119  switch ($a_field)
120  {
121  case 'name':
122  if ($this->anonymity)
123  {
124  return true;
125  }
126  else
127  {
128  return false;
129  }
130  break;
131  case 'reached':
132  return true;
133  break;
134  default:
135  return false;
136  break;
137  }
138  }
139 
143  function initFilter()
144  {
145  global $lng, $rbacreview, $ilUser;
146 
147  // name
148  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
149  $ti = new ilTextInputGUI($lng->txt("name"), "name");
150  $ti->setMaxLength(64);
151  $ti->setValidationRegexp('/^[^%]+$/is');
152  $ti->setSize(20);
153  $this->addFilterItem($ti);
154  $ti->readFromSession();
155  $this->filter["name"] = $ti->getValue();
156 
157  // group
158  $ti = new ilTextInputGUI($lng->txt("grp"), "group");
159  $ti->setMaxLength(64);
160  $ti->setSize(20);
161  $ti->setValidationRegexp('/^[^%]+$/is');
162  $this->addFilterItem($ti);
163  $ti->readFromSession();
164  $this->filter["group"] = $ti->getValue();
165 
166  // course
167  $ti = new ilTextInputGUI($lng->txt("course"), "course");
168  $ti->setMaxLength(64);
169  $ti->setValidationRegexp('/^[^%]+$/is');
170  $ti->setSize(20);
171  $this->addFilterItem($ti);
172  $ti->readFromSession();
173  $this->filter["course"] = $ti->getValue();
174 
175  // passed tests
176  include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
177  $si = new ilCheckboxInputGUI($this->lng->txt("passed_only"), "passed_only");
178 // $si->setOptionTitle();
179  $this->addFilterItem($si);
180  $si->readFromSession();
181  $this->filter["passedonly"] = $si->getValue();
182  }
183 
188  protected function fillRow($data)
189  {
190  $this->tpl->setVariable("NAME", $data['name']);
191  $this->tpl->setVariable("LOGIN", $data['login']);
192  if ($this->hasSpecialColumn('gender'))
193  {
194  $this->tpl->setCurrentBlock('gender');
195  $this->tpl->setVariable("GENDER", $this->lng->txt('gender_' . $data['gender']));
196  $this->tpl->parseCurrentBlock();
197  }
198  if ($this->hasSpecialColumn('email'))
199  {
200  $this->tpl->setCurrentBlock('email');
201  $this->tpl->setVariable("EMAIL", strlen($data['email']) ? $data['email'] : '&nbsp;');
202  $this->tpl->parseCurrentBlock();
203  }
204  if ($this->hasSpecialColumn('institution'))
205  {
206  $this->tpl->setCurrentBlock('institution');
207  $this->tpl->setVariable("INSTITUTION", strlen($data['institution']) ? $data['institution'] : '&nbsp;');
208  $this->tpl->parseCurrentBlock();
209  }
210  if ($this->hasSpecialColumn('street'))
211  {
212  $this->tpl->setCurrentBlock('street');
213  $this->tpl->setVariable("STREET", strlen($data['street']) ? $data['street'] : '&nbsp;');
214  $this->tpl->parseCurrentBlock();
215  }
216  if ($this->hasSpecialColumn('city'))
217  {
218  $this->tpl->setCurrentBlock('city');
219  $this->tpl->setVariable("CITY", strlen($data['city']) ? $data['city'] : '&nbsp;');
220  $this->tpl->parseCurrentBlock();
221  }
222  if ($this->hasSpecialColumn('zipcode'))
223  {
224  $this->tpl->setCurrentBlock('zipcode');
225  $this->tpl->setVariable("ZIPCODE", strlen($data['zipcode']) ? $data['zipcode'] : '&nbsp;');
226  $this->tpl->parseCurrentBlock();
227  }
228  if ($this->hasSpecialColumn('country'))
229  {
230  $this->tpl->setCurrentBlock('country');
231  $this->tpl->setVariable("COUNTRY", strlen($data['country']) ? $data['country'] : '&nbsp;');
232  $this->tpl->parseCurrentBlock();
233  }
234  if ($this->hasSpecialColumn('department'))
235  {
236  $this->tpl->setCurrentBlock('department');
237  $this->tpl->setVariable("DEPARTMENT", strlen($data['department']) ? $data['department'] : '&nbsp;');
238  $this->tpl->parseCurrentBlock();
239  }
240  if ($this->hasSpecialColumn('matriculation'))
241  {
242  $this->tpl->setCurrentBlock('matriculation');
243  $this->tpl->setVariable("MATRICULATION", strlen($data['matriculation']) ? $data['matriculation'] : '&nbsp;');
244  $this->tpl->parseCurrentBlock();
245  }
246  $this->tpl->setVariable("REACHED", $data['reached'] . " " . strtolower($this->lng->txt("of")) . " " . $data['max']);
247  $this->tpl->setVariable("MARK", $data['mark']);
248  if ($this->hasSpecialColumn('ects_grade'))
249  {
250  $this->tpl->setCurrentBlock('ects_grade');
251  $this->tpl->setVariable("ECTS_GRADE", $data['ects_grade']);
252  $this->tpl->parseCurrentBlock();
253  }
254  $this->tpl->setVariable("ANSWERED", $data['answered']);
255  $this->tpl->setVariable("WORKING_TIME", $data['working_time']);
256  $this->tpl->setVariable("DETAILED", $data['details']);
257  }
258 
259  public function hasSpecialColumn($name)
260  {
261  return in_array($name, $this->specialcolumns);
262  }
263 
264  public function setSpecialColumns($arr)
265  {
266  $this->specialcolumns = $arr;
267  }
268 
269 }
270 ?>