ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSurveyMaintenanceTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
10{
11 protected $counter;
12 protected $confirmdelete;
13
21 public function __construct($a_parent_obj, $a_parent_cmd, $confirmdelete = false)
22 {
23 global $DIC;
24
25 parent::__construct($a_parent_obj, $a_parent_cmd);
26
27 $lng = $DIC->language();
28 $ilCtrl = $DIC->ctrl();
29
30 $this->lng = $lng;
31 $this->ctrl = $ilCtrl;
32 $this->counter = 1;
33 $this->confirmdelete = $confirmdelete;
34
35 $this->setFormName('maintenanceform');
36 $this->setStyle('table', 'fullwidth');
37
38 if (!$confirmdelete) {
39 $this->addColumn('', '', '1%', true);
40 }
41 $this->addColumn($this->lng->txt("name"), 'name', '');
42 $this->addColumn($this->lng->txt("login"), 'login', '');
43 $this->addColumn($this->lng->txt("last_access"), 'last_access', '');
44 $this->addColumn($this->lng->txt("workingtime"), 'workingtime', '');
45 $this->addColumn($this->lng->txt("svy_status"), '', '');
46 $this->addColumn($this->lng->txt("survey_results_finished"), 'finished', '');
47
48 $this->setRowTemplate("tpl.il_svy_svy_maintenance_row.html", "Modules/Survey/Participants");
49
50 if ($confirmdelete) {
51 $this->addCommandButton('confirmDeleteSelectedUserData', $this->lng->txt('confirm'));
52 $this->addCommandButton('cancelDeleteSelectedUserData', $this->lng->txt('cancel'));
53 } else {
54 $this->addMultiCommand('deleteSingleUserResults', $this->lng->txt('svy_remove_participants'));
55 }
56
57 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
58
59 $this->setDefaultOrderField("name");
60 $this->setDefaultOrderDirection("asc");
61
62 $this->setShowRowsSelector(true);
63
64 if ($confirmdelete) {
65 $this->disable('sort');
66 $this->disable('select_all');
67 } else {
68 $this->setPrefix('chbUser');
69 $this->setSelectAllCheckbox('chbUser');
70 $this->enable('sort');
71 $this->enable('select_all');
72 }
73 $this->enable('header');
74 }
75
83 public function fillRow($data)
84 {
85 if (!$this->confirmdelete) {
86 $this->tpl->setCurrentBlock('checkbox');
87 if ($data["invited"]) {
88 $this->tpl->setVariable("CB_USER_ID", "inv" . $data['usr_id']);
89 } else {
90 $this->tpl->setVariable("CB_USER_ID", $data['id']);
91 }
92 $this->tpl->parseCurrentBlock();
93 } else {
94 $this->tpl->setCurrentBlock('hidden');
95 if ($data["invited"]) {
96 $this->tpl->setVariable("HIDDEN_USER_ID", "inv" . $data['usr_id']);
97 } else {
98 $this->tpl->setVariable("HIDDEN_USER_ID", $data['id']);
99 }
100 $this->tpl->parseCurrentBlock();
101 }
102 $this->tpl->setVariable("USER_ID", $data["id"]);
103 $this->tpl->setVariable("VALUE_USER_NAME", $data['name']);
104 $this->tpl->setVariable("VALUE_USER_LOGIN", $data['login']);
105 $this->tpl->setVariable("LAST_ACCESS", ilDatePresentation::formatDate(new ilDateTime($data['last_access'], IL_CAL_UNIX)));
106 $this->tpl->setVariable("WORKINGTIME", $this->formatTime($data['workingtime']));
107
108 $state = $this->lng->txt("svy_status_in_progress");
109 if ($data['last_access'] == "" && $data["invited"]) {
110 $state = $this->lng->txt("svy_status_invited");
111 }
112 if ($data["finished"] !== false) {
113 $state = $this->lng->txt("svy_status_finished");
114 }
115 $this->tpl->setVariable("STATUS", $state);
116
117 if ($data["finished"] !== null) {
118 if ($data["finished"] !== false) {
119 $finished .= ilDatePresentation::formatDate(new ilDateTime($data["finished"], IL_CAL_UNIX));
120 } else {
121 $finished = "-";
122 }
123 $this->tpl->setVariable("FINISHED", $finished);
124 } else {
125 $this->tpl->setVariable("FINISHED", "&nbsp;");
126 }
127 }
128
129 protected function formatTime($timeinseconds)
130 {
131 if (is_null($timeinseconds)) {
132 return " ";
133 } elseif ($timeinseconds == 0) {
134 return $this->lng->txt('not_available');
135 } else {
136 return sprintf("%02d:%02d:%02d", ($timeinseconds / 3600), ($timeinseconds / 60) % 60, $timeinseconds % 60);
137 }
138 }
139
145 public function numericOrdering($a_field)
146 {
147 switch ($a_field) {
148 case 'workingtime':
149 return true;
150
151 default:
152 return false;
153 }
154 }
155}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
__construct($a_parent_obj, $a_parent_cmd, $confirmdelete=false)
Constructor.
Class ilTable2GUI.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
disable($a_module_name)
diesables particular modules of table
setStyle($a_element, $a_style)
enable($a_module_name)
enables particular modules of table
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc