ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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("tst_finished"),'finished', '');
59 $this->addColumn($this->lng->txt("last_access"),'access', '');
60
61 $this->actionsColumnRequired = false;
62 if( !$this->testQuestionSetDepenciesBroken )
63 {
64 $this->actionsColumnRequired = true;
65
66 $this->addColumn('','', '');
67 }
68
69 $this->setTitle($this->lng->txt('tst_participating_users'));
70 $this->setRowTemplate("tpl.il_as_tst_participants_row.html", "Modules/Test");
71
72 if( !$this->anonymity && !$this->testQuestionSetDepenciesBroken )
73 {
74 $this->addMultiCommand('showPassOverview', $this->lng->txt('show_pass_overview'));
75 $this->addMultiCommand('showUserAnswers', $this->lng->txt('show_user_answers'));
76 $this->addMultiCommand('showDetailedResults', $this->lng->txt('show_detailed_results'));
77 }
78 $this->addMultiCommand('deleteSingleUserResults', $this->lng->txt('delete_user_data'));
79
80 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
81
82 if (!$this->anonymity)
83 {
84 $this->setDefaultOrderField("login");
85 }
86 else
87 {
88 $this->setDefaultOrderField("access");
89 }
90 $this->setDefaultOrderDirection("asc");
91 $this->setSelectAllCheckbox('chbUser');
92
93 $this->enable('header');
94 $this->enable('sort');
95 $this->enable('select_all');
96
97 $this->setShowRowsSelector(true);
98 }
99
107 public function fillRow($data)
108 {
109 $finished = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"".$this->lng->txt("ok")."\" />";
110 $started = "<img border=\"0\" align=\"middle\" src=\"".ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"".$this->lng->txt("ok")."\" />" ;
111 $passes = ($data['maxpass']) ? (($data['maxpass'] == 1) ? sprintf($this->lng->txt("pass_finished"), $data['maxpass']) : sprintf($this->lng->txt("passes_finished"), $data['maxpass'])) : '';
112 $this->tpl->setVariable("USER_ID", $data['usr_id']);
113 $this->tpl->setVariable("LOGIN", $data['login']);
114 $this->tpl->setVariable("FULLNAME", $data['name']);
115 /*
116 $this->tpl->setVariable("FIRSTNAME", $data['firstname']);
117 $this->tpl->setVariable("LASTNAME", $data['lastname']);
118 */
119 $this->tpl->setVariable("STARTED", ($data['started']) ? $started : '');
120 $this->tpl->setVariable("PASSES", $passes);
121 $this->tpl->setVariable("FINISHED", ($data['finished']) ? $finished : '');
122 $this->tpl->setVariable("ACCESS", ilDatePresentation::formatDate(new ilDateTime($data['access'],IL_CAL_DATETIME)));
123
124 if( $data['active_id'] > 0 && !$this->testQuestionSetDepenciesBroken )
125 {
126 $this->tpl->setCurrentBlock('action_results');
127 $this->tpl->setVariable("RESULTS", $data['result']);
128 $this->tpl->setVariable("RESULTS_TEXT", ilUtil::prepareFormOutput($this->lng->txt('tst_show_results')));
129 $this->tpl->parseCurrentBlock();
130 }
131
132 if( $this->actionsColumnRequired )
133 {
134 $this->tpl->setCurrentBlock('actions_column');
135 $this->tpl->parseCurrentBlock();
136 }
137 }
138
142 function initFilter()
143 {
144 global $lng;
145
146 // title/description
147 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
148 $ti = new ilSelectInputGUI($lng->txt("selection"), "selection");
149 $ti->setOptions(
150 array(
151 'all' => $lng->txt('all_participants'),
152 'withSolutions' => $lng->txt('with_solutions_participants'),
153 'withoutSolutions' => $lng->txt('without_solutions_participants')
154 )
155 );
156 $this->addFilterItem($ti);
157 $ti->readFromSession(); // get currenty value from session (always after addFilterItem())
158 $this->filter["title"] = $ti->getValue();
159 }
160
164 public function numericOrdering($field)
165 {
166 return in_array($field, array(
167 'access', 'maxpass'
168 ));
169 }
170}
const IL_CAL_DATETIME
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.
setFormName($a_formname)
Set Form name.
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.
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:40