ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSurveyResultsCumulatedTableGUI.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  private $totalcount;
44  public function __construct($a_parent_obj, $a_parent_cmd, $detail)
45  {
46  $this->setId("svy_cum");
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->counter = 1;
54  $this->totalcount = 0;
55 
56  $this->setFormName('invitegroups');
57  $this->setStyle('table', 'fullwidth');
58 
59  $this->addColumn($this->lng->txt("title"),'title', '');
60  foreach ($this->getSelectedColumns() as $c)
61  {
62  if (strcmp($c, 'question') == 0) $this->addColumn($this->lng->txt("question"),'question', '');
63  if (strcmp($c, 'question_type') == 0) $this->addColumn($this->lng->txt("question_type"),'question_type', '');
64  if (strcmp($c, 'users_answered') == 0) $this->addColumn($this->lng->txt("users_answered"),'users_answered', '');
65  if (strcmp($c, 'users_skipped') == 0) $this->addColumn($this->lng->txt("users_skipped"),'users_skipped', '');
66  if (strcmp($c, 'mode') == 0) $this->addColumn($this->lng->txt("mode"),'mode', '');
67  if (strcmp($c, 'mode_nr_of_selections') == 0) $this->addColumn($this->lng->txt("mode_nr_of_selections"),'mode_nr_of_selections', '');
68  if (strcmp($c, 'median') == 0) $this->addColumn($this->lng->txt("median"),'median', '');
69  if (strcmp($c, 'arithmetic_mean') == 0) $this->addColumn($this->lng->txt("arithmetic_mean"),'arithmetic_mean', '');
70  }
71 
72  $this->setRowTemplate("tpl.il_svy_svy_results_cumulated_row.html", "Modules/Survey");
73 
74  $this->addCommandButton('printEvaluation', $this->lng->txt('print'), 'javascript:window.print();');
75 
76  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
77 
78  $this->enable('header');
79  $this->disable('sort');
80  $this->disable('select_all');
81  }
82 
84  {
85  global $lng;
86  $cols["question"] = array(
87  "txt" => $lng->txt("question"),
88  "default" => true
89  );
90  $cols["question_type"] = array(
91  "txt" => $lng->txt("question_type"),
92  "default" => true
93  );
94  $cols["users_answered"] = array(
95  "txt" => $lng->txt("users_answered"),
96  "default" => true
97  );
98  $cols["users_skipped"] = array(
99  "txt" => $lng->txt("users_skipped"),
100  "default" => true
101  );
102  $cols["mode"] = array(
103  "txt" => $lng->txt("mode"),
104  "default" => true
105  );
106  $cols["mode_nr_of_selections"] = array(
107  "txt" => $lng->txt("mode_nr_of_selections"),
108  "default" => true
109  );
110  $cols["median"] = array(
111  "txt" => $lng->txt("median"),
112  "default" => true
113  );
114  $cols["arithmetic_mean"] = array(
115  "txt" => $lng->txt("arithmetic_mean"),
116  "default" => true
117  );
118  return $cols;
119  }
120 
128  public function fillRow($data)
129  {
130  if (strlen($data['counter']))
131  {
132  $this->tpl->setCurrentBlock('counter');
133  $this->tpl->setVariable("COUNTER", $data['counter']);
134  $this->tpl->parseCurrentBlock();
135  $this->totalcount++;
136  }
137  $this->tpl->setVariable("TITLE", $data['title']);
138  $this->tpl->setVariable("CSS_ROW", ($this->totalcount % 2 == 1) ? 'tblrow1' : 'tblrow2');
139  foreach ($this->getSelectedColumns() as $c)
140  {
141  if (strcmp($c, 'question') == 0)
142  {
143  $this->tpl->setCurrentBlock('question');
144  $this->tpl->setVariable("QUESTION", $data['question']);
145  $this->tpl->parseCurrentBlock();
146  }
147  if (strcmp($c, 'question_type') == 0)
148  {
149  $this->tpl->setCurrentBlock('question_type');
150  $this->tpl->setVariable("QUESTION_TYPE", $data['question_type']);
151  $this->tpl->parseCurrentBlock();
152  }
153  if (strcmp($c, 'users_answered') == 0)
154  {
155  $this->tpl->setCurrentBlock('users_answered');
156  $this->tpl->setVariable("USERS_ANSWERED", $data['users_answered']);
157  $this->tpl->parseCurrentBlock();
158  }
159  if (strcmp($c, 'users_skipped') == 0)
160  {
161  $this->tpl->setCurrentBlock('users_skipped');
162  $this->tpl->setVariable("USERS_SKIPPED", $data['users_skipped']);
163  $this->tpl->parseCurrentBlock();
164  }
165  if (strcmp($c, 'mode') == 0)
166  {
167  $this->tpl->setCurrentBlock('mode');
168  $this->tpl->setVariable("MODE", $data['mode']);
169  $this->tpl->parseCurrentBlock();
170  }
171  if (strcmp($c, 'mode_nr_of_selections') == 0)
172  {
173  $this->tpl->setCurrentBlock('mode_nr_of_selections');
174  $this->tpl->setVariable("MODE_NR_OF_SELECTIONS", strlen($data['mode_nr_of_selections']) ? $data['mode_nr_of_selections'] : 0);
175  $this->tpl->parseCurrentBlock();
176  }
177  if (strcmp($c, 'median') == 0)
178  {
179  $this->tpl->setCurrentBlock('median');
180  $this->tpl->setVariable("MEDIAN", $data['median']);
181  $this->tpl->parseCurrentBlock();
182  }
183  if (strcmp($c, 'arithmetic_mean') == 0)
184  {
185  $this->tpl->setCurrentBlock('arithmetic_mean');
186  $this->tpl->setVariable("ARITHMETIC_MEAN", $data['arithmetic_mean']);
187  $this->tpl->parseCurrentBlock();
188  }
189  }
190  }
191 }
192 ?>