ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTestParticipantsTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
5include_once('./Services/Table/classes/class.ilTable2GUI.php');
6
16{
18 protected $anonymity;
19
21
29 public function __construct($a_parent_obj, $a_parent_cmd, $testQuestionSetDepenciesBroken, $anonymity, $nrOfDatasets)
30 {
31 $this->setId('tst_participants_' . $a_parent_obj->object->getRefId());
32 parent::__construct($a_parent_obj, $a_parent_cmd);
33
34 global $lng, $ilCtrl;
35
36 $this->lng = $lng;
37 $this->ctrl = $ilCtrl;
38
39 $this->initFilter();
40
41 $this->testQuestionSetDepenciesBroken = $testQuestionSetDepenciesBroken;
42 $this->anonymity = $anonymity;
43 $this->setFormName('participantsForm');
44 $this->setStyle('table', 'fullwidth');
45
46 $this->addColumn('','','1%');
47 $this->addColumn($this->lng->txt("name"),'name', '');
48 $this->addColumn($this->lng->txt("login"),'login', '');
49 /*
50 $this->addColumn($this->lng->txt("lastname"),'lastname', '');
51 $this->addColumn($this->lng->txt("firstname"),'firstname', '');
52 */
53 $this->addColumn($this->lng->txt("tst_started"),'started', '');
54
55 // maxpass => passes ;)
56 $this->addColumn($this->lng->txt("tst_nr_of_tries_of_user"),'maxpass', '');
57
58 $this->addColumn($this->lng->txt("unfinished_passes"),'unfinished', '');
59 $this->addColumn($this->lng->txt("tst_finished"),'finished', '');
60 $this->addColumn($this->lng->txt("last_access"),'access', '');
61
62 $this->actionsColumnRequired = false;
63 if( !$this->testQuestionSetDepenciesBroken )
64 {
65 $this->actionsColumnRequired = true;
66
67 $this->addColumn('','', '');
68 }
69
70 $this->setTitle($this->lng->txt('tst_participating_users'));
71 $this->setRowTemplate("tpl.il_as_tst_participants_row.html", "Modules/Test");
72
73 if( !$this->anonymity && !$this->testQuestionSetDepenciesBroken )
74 {
75 $this->addMultiCommand('showPassOverview', $this->lng->txt('show_pass_overview'));
76 $this->addMultiCommand('showUserAnswers', $this->lng->txt('show_user_answers'));
77 $this->addMultiCommand('showDetailedResults', $this->lng->txt('show_detailed_results'));
78 }
79 $this->addMultiCommand('deleteSingleUserResults', $this->lng->txt('delete_user_data'));
80
81 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
82
83 if (!$this->anonymity)
84 {
85 $this->setDefaultOrderField("login");
86 }
87 else
88 {
89 $this->setDefaultOrderField("access");
90 }
91 $this->setDefaultOrderDirection("asc");
92 $this->setSelectAllCheckbox('chbUser');
93
94 $this->enable('header');
95 $this->enable('sort');
96 $this->enable('select_all');
97
98 $this->setShowRowsSelector(true);
99 }
100
108 public function fillRow($data)
109 {
110 $finished = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"".$this->lng->txt("ok")."\" />";
111 $started = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"".$this->lng->txt("ok")."\" />" ;
112 $passes = ($data['maxpass']) ? (($data['maxpass'] == 1) ? sprintf($this->lng->txt("pass_finished"), $data['maxpass']) : sprintf($this->lng->txt("passes_finished"), $data['maxpass'])) : '';
113 $this->tpl->setVariable("USER_ID", $data['usr_id']);
114 $this->tpl->setVariable("LOGIN", $data['login']);
115 $this->tpl->setVariable("FULLNAME", $data['name']);
116 /*
117 $this->tpl->setVariable("FIRSTNAME", $data['firstname']);
118 $this->tpl->setVariable("LASTNAME", $data['lastname']);
119 */
120 $this->tpl->setVariable("STARTED", ($data['started']) ? $started : '');
121 $this->tpl->setVariable("PASSES", $passes);
122 $unfinished_passes = $data['unfinished'] == 1 ? $this->lng->txt('yes') : $this->lng->txt('no');
123 $this->tpl->setVariable("UNFINISHED_PASSES", $unfinished_passes );
124 $this->tpl->setVariable("FINISHED", ($data['finished']) ? $finished : '');
125 $this->tpl->setVariable("ACCESS", ilDatePresentation::formatDate(new ilDateTime($data['access'],IL_CAL_DATETIME)));
126
127 if( $data['active_id'] > 0 && !$this->testQuestionSetDepenciesBroken )
128 {
129 if($data['unfinished'] == 1)
130 {
131 $adv = new ilAdvancedSelectionListGUI();
132 $this->tpl->setCurrentBlock('action_results_list');
133 $adv->addItem($this->lng->txt('tst_show_results'), $data['result'], $data['result']);
134 $adv->addItem($this->lng->txt('finish_test'), $data['finish_link'], $data['finish_link']);
135 $this->tpl->setVariable('RESULTS_LIST', $adv->getHTML());
136 }
137 else
138 {
139 $this->tpl->setCurrentBlock('action_results');
140 $this->tpl->setVariable("RESULTS", $data['result']);
141 $this->tpl->setVariable("RESULTS_TEXT", ilUtil::prepareFormOutput($this->lng->txt('tst_show_results')));
142 $this->tpl->parseCurrentBlock();
143 }
144 }
145
146 if( $this->actionsColumnRequired )
147 {
148 $this->tpl->setCurrentBlock('actions_column');
149 $this->tpl->parseCurrentBlock();
150 }
151 }
152
156 function initFilter()
157 {
158 global $lng;
159
160 // title/description
161 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
162 $ti = new ilSelectInputGUI($lng->txt("selection"), "selection");
163 $ti->setOptions(
164 array(
165 'all' => $lng->txt('all_participants'),
166 'withSolutions' => $lng->txt('with_solutions_participants'),
167 'withoutSolutions' => $lng->txt('without_solutions_participants')
168 )
169 );
170 $this->addFilterItem($ti);
171 $ti->readFromSession(); // get currenty value from session (always after addFilterItem())
172 $this->filter["title"] = $ti->getValue();
173 }
174
178 public function numericOrdering($field)
179 {
180 return in_array($field, array(
181 'access', 'maxpass'
182 ));
183 }
184}
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
User interface class for advanced drop-down selection lists.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
This class represents a selection list property in a property form.
Class ilTable2GUI.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setStyle($a_element, $a_style)
enable($a_module_name)
enables particular modules of table
__construct($a_parent_obj, $a_parent_cmd, $testQuestionSetDepenciesBroken, $anonymity, $nrOfDatasets)
Constructor.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17