ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilTestFixedParticipantsTableGUI.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
27 public function __construct($a_parent_obj, $a_parent_cmd, $testQuestionSetDepenciesBroken, $anonymity, $nrOfDatasets)
28 {
29 $this->setId('tst_fixed_participants_' . $a_parent_obj->object->getRefId());
30 parent::__construct($a_parent_obj, $a_parent_cmd);
31
32 global $lng, $ilCtrl;
33
34 $this->lng = $lng;
35 $this->ctrl = $ilCtrl;
36
37 $this->testQuestionSetDepenciesBroken = $testQuestionSetDepenciesBroken;
38 $this->anonymity = $anonymity;
39 $this->setFormName('export');
40 $this->setStyle('table', 'fullwidth');
41
42 $this->addColumn('', 'f', '1%');
43 $this->addColumn($this->lng->txt("name"), 'name', '');
44 $this->addColumn($this->lng->txt("login"), 'login', '');
45 /*
46 $this->addColumn($this->lng->txt("lastname"),'lastname', '');
47 $this->addColumn($this->lng->txt("firstname"),'firstname', '');
48 */
49 $this->addColumn($this->lng->txt("clientip"), 'clientip', '');
50 $this->addColumn($this->lng->txt("tst_started"), 'started', '');
51 $this->addColumn($this->lng->txt("tst_nr_of_tries_of_user"), 'passes', '');
52 $this->addColumn($this->lng->txt("unfinished_passes"), 'unfinished_passes', '');
53 $this->addColumn($this->lng->txt("tst_finished"), 'finished', '');
54 $this->addColumn($this->lng->txt("last_access"), 'access', '');
55
56 $this->actionsColumnRequired = false;
57 if (!$this->testQuestionSetDepenciesBroken) {
58 $this->actionsColumnRequired = true;
59
60 $this->addColumn('', 'results', '');
61 }
62
63 $this->setTitle($this->lng->txt('tst_participating_users'));
64 $this->setDescription($this->lng->txt("fixed_participants_hint"));
65 $this->setRowTemplate("tpl.il_as_tst_fixed_participants_row.html", "Modules/Test");
66
67 $this->addMultiCommand('saveClientIP', $this->lng->txt('save'));
68 $this->addMultiCommand('removeParticipant', $this->lng->txt('remove_as_participant'));
69 if (!$this->anonymity && !$this->testQuestionSetDepenciesBroken) {
70 $this->addMultiCommand('showPassOverview', $this->lng->txt('show_pass_overview'));
71 $this->addMultiCommand('showUserAnswers', $this->lng->txt('show_user_answers'));
72 $this->addMultiCommand('showDetailedResults', $this->lng->txt('show_detailed_results'));
73 }
74 $this->addMultiCommand('deleteSingleUserResults', $this->lng->txt('delete_user_data'));
75
76 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
77
78 if (!$this->anonymity) {
79 $this->setDefaultOrderField("login");
80 } else {
81 $this->setDefaultOrderField("access");
82 }
83 $this->setDefaultOrderDirection("asc");
84 $this->setSelectAllCheckbox('chbUser');
85
86 $this->setShowRowsSelector(true);
87
88 $this->enable('header');
89 $this->enable('sort');
90 $this->enable('select_all');
91 }
92
100 public function fillRow($data)
101 {
102 $finished = "<img border=\"0\" align=\"middle\" src=\"" . ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"" . $this->lng->txt("ok") . "\" />";
103 $started = "<img border=\"0\" align=\"middle\" src=\"" . ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"" . $this->lng->txt("ok") . "\" />" ;
104 $passes = ($data['maxpass']) ? (($data['maxpass'] == 1) ? sprintf($this->lng->txt("pass_finished"), $data['maxpass']) : sprintf($this->lng->txt("passes_finished"), $data['maxpass'])) : '';
105 if (strlen($data['clientip'])) {
106 $this->tpl->setVariable("CLIENT_IP", $data['clientip']);
107 }
108 $this->tpl->setVariable("USER_ID", $data['usr_id']);
109 $this->tpl->setVariable("LOGIN", $data['login']);
110 $this->tpl->setVariable("FULLNAME", $data['name']);
111 /*
112 $this->tpl->setVariable("FIRSTNAME", $data['firstname']);
113 $this->tpl->setVariable("LASTNAME", $data['lastname']);
114 */
115 $this->tpl->setVariable("STARTED", ($data['started']) ? $started : '');
116 $this->tpl->setVariable("PASSES", $passes);
117 $unfinished_passes = $data['unfinished'] == 1 ? $this->lng->txt('yes') : $this->lng->txt('no');
118 $this->tpl->setVariable("UNFINISHED_PASSES", $unfinished_passes);
119 $this->tpl->setVariable("FINISHED", ($data['finished']) ? $finished : '');
120 $this->tpl->setVariable("ACCESS", (strlen($data['access'])) ? ilDatePresentation::formatDate(new ilDateTime($data['access'], IL_CAL_DATETIME)) : $this->lng->txt('not_yet_accessed'));
121
122 if ($data['active_id'] > 0 && !$this->testQuestionSetDepenciesBroken) {
123 if ($data['unfinished'] == 1) {
124 $adv = new ilAdvancedSelectionListGUI();
125 $this->tpl->setCurrentBlock('action_results_list');
126 $adv->addItem($this->lng->txt('tst_show_results'), $data['result'], $data['result']);
127 $adv->addItem($this->lng->txt('finish_test'), $data['finish_link'], $data['finish_link']);
128 $this->tpl->setVariable('RESULTS_LIST', $adv->getHTML());
129 } else {
130 $this->tpl->setCurrentBlock('action_results');
131 $this->tpl->setVariable("RESULTS", $data['result']);
132 $this->tpl->setVariable("RESULTS_TEXT", ilUtil::prepareFormOutput($this->lng->txt('tst_show_results')));
133 $this->tpl->parseCurrentBlock();
134 }
135 }
136
137 if ($this->actionsColumnRequired) {
138 $this->tpl->setCurrentBlock('actions_column');
139 $this->tpl->parseCurrentBlock();
140 }
141 }
142
146 public function numericOrdering($field)
147 {
148 return in_array($field, array(
149 'access', 'maxpass'
150 ));
151 }
152}
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, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
Class ilTable2GUI.
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.
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.
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.
setId($a_val)
Set id.
setDescription($a_val)
Set description.
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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18