ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSurveyResultsUserTableGUI.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 $is_anonymized;
37 
45  public function __construct($a_parent_obj, $a_parent_cmd, $is_anonymized)
46  {
47  global $DIC;
48 
49  $this->setId("svy_usr");
50  parent::__construct($a_parent_obj, $a_parent_cmd);
51 
52  $lng = $DIC->language();
53  $ilCtrl = $DIC->ctrl();
54 
55  $this->is_anonymized = $is_anonymized;
56  $this->lng = $lng;
57  $this->ctrl = $ilCtrl;
58  $this->counter = 1;
59 
60  $this->setFormName('invitegroups');
61  $this->setStyle('table', 'fullwidth');
62 
63  $this->addColumn($this->lng->txt("username"), 'username', '');
64  $this->addColumn($this->lng->txt("question"), '', '');
65  $this->addColumn($this->lng->txt("results"), '', '');
66  $this->addColumn($this->lng->txt("workingtime"), 'workingtime', '');
67  $this->addColumn($this->lng->txt("survey_results_finished"), 'finished', '');
68 
69  $this->setRowTemplate("tpl.il_svy_svy_results_user_row.html", "Modules/Survey");
70 
71  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
72 
73  $this->setDefaultOrderField('username');
74 
75  $this->setShowRowsSelector(true);
76 
77  $this->enable('header');
78  $this->disable('select_all');
79  }
80 
81  protected function formatTime($timeinseconds)
82  {
83  if (is_null($timeinseconds)) {
84  return " ";
85  } elseif ($timeinseconds == 0) {
86  return $this->lng->txt('not_available');
87  } else {
88  return sprintf("%02d:%02d:%02d", ($timeinseconds / 3600), ($timeinseconds / 60) % 60, $timeinseconds % 60);
89  }
90  }
91 
99  public function fillRow($data)
100  {
101  $this->tpl->setVariable("USERNAME", $data['username']);
102  $this->tpl->setVariable("QUESTION", $data['question']);
103  $this->tpl->setVariable("RESULTS", $data['results']
104  ? implode("<br />", $data['results'])
106  $this->tpl->setVariable("WORKINGTIME", $this->formatTime($data['workingtime']));
107 
108  if ($data["finished"] !== null) {
109  if ($data["finished"] !== false) {
110  $finished .= ilDatePresentation::formatDate(new ilDateTime($data["finished"], IL_CAL_UNIX));
111  } else {
112  $finished = "-";
113  }
114  $this->tpl->setVariable("FINISHED", $finished);
115  } else {
116  $this->tpl->setVariable("FINISHED", "&nbsp;");
117  }
118 
119  if ($data["subitems"]) {
120  $this->tpl->setCurrentBlock("tbl_content");
121  $this->tpl->parseCurrentBlock();
122 
123  foreach ($data["subitems"] as $subitem) {
124  $this->fillRow($subitem);
125 
126  $this->tpl->setCurrentBlock("tbl_content");
127  $this->css_row = ($this->css_row != "tblrow1")
128  ? "tblrow1"
129  : "tblrow2";
130  $this->tpl->setVariable("CSS_ROW", $this->css_row);
131  $this->tpl->parseCurrentBlock();
132  }
133  }
134  }
135 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setStyle($a_element, $a_style)
global $DIC
Definition: saml.php:7
static getSurveySkippedValue()
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
enable($a_module_name)
enables particular modules of table
Date and time handling
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
__construct($a_parent_obj, $a_parent_cmd, $is_anonymized)
Constructor.
setFormName($a_formname="")
Set Form name.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.