19 declare(strict_types=1);
41 private illanguage
$lng,
50 return $this->test_obj;
55 $this->test_obj = $test_obj;
61 $this->
getTestObj()->getProcessingTimeInSeconds() > 0
69 ilObjTestGUI::accessViolationRedirect();
72 switch ($this->
ctrl->getNextClass($this)) {
75 $command = $this->
ctrl->getCmd(self::CMD_SHOW_LIST) .
'Cmd';
84 $tabel_gui->addCommandButton(self::CMD_SHOW_FORM, $this->
lng->txt(
'timing'));
87 $participant_list->initializeFromDbRows($this->
getTestObj()->getTestParticipants());
89 $filtered_participant_list = $participant_list->getAccessFilteredList(
90 $this->participant_access_filter->getManageParticipantsUserFilter($this->getTestObj()->getRefId())
93 $addons = $this->
getTestObj()->getTimeExtensionsOfParticipants();
95 $table_data = array();
96 foreach ($filtered_participant_list as $participant) {
100 'login' => $participant->getLogin(),
101 'name' => $this->
lng->txt(
"anonymous")
104 $time = $this->
getTestObj()->getStartingTimeOfUser($participant->getActiveId());
110 $table_row[
'started'] = $started;
113 $participant_id = $participant->getActiveId();
114 if (array_key_exists($participant_id, $addons) && $addons[$participant_id] > 0) {
115 $table_row[
'extratime'] = $addons[$participant_id];
119 $table_row[
'name'] = $participant->getLastname() .
', ' . $participant->getFirstname();
122 $table_data[] = $table_row;
125 $tabel_gui->setData($table_data);
127 $this->main_tpl->setContent($this->
ctrl->getHTML($tabel_gui));
139 $form->setFormAction($this->
ctrl->getFormAction($this));
140 $form->setTableWidth(
"100%");
141 $form->setId(
"tst_change_workingtime");
142 $form->setTitle($this->
lng->txt(
"tst_change_workingtime"));
145 $participant_list->initializeFromDbRows($this->
getTestObj()->getTestParticipants());
147 $filtered_participants_list = $participant_list->getAccessFilteredList(
148 $this->participant_access_filter->getManageParticipantsUserFilter($this->getTestObj()->getRefId())
151 $addons = $this->
getTestObj()->getTimeExtensionsOfParticipants();
153 $participantslist_input =
new ilSelectInputGUI($this->
lng->txt(
'participants'),
"participant");
156 '' => $this->
lng->txt(
'please_select'),
157 '0' => $this->
lng->txt(
'all_participants')
160 foreach ($filtered_participants_list as $participant) {
164 $name = $this->
lng->txt(
"anonymous");
166 $name = $participant->getLastname() .
', ' . $participant->getFirstname();
169 $time = $this->
getTestObj()->getStartingTimeOfUser($participant->getActiveId());
174 $participant_id = $participant->getActiveId();
175 if (array_key_exists($participant_id, $addons) && $addons[$participant_id] > 0) {
176 $started .=
", " . $this->
lng->txt(
'extratime') .
': ' . $addons[$participant_id] .
' ' . $this->
lng->txt(
'minutes');
179 $options[$participant->getActiveId()] = $participant->getLogin() .
' (' . $name .
')' . $started;
183 $participantslist_input->setOptions($options);
184 $form->addItem($participantslist_input);
188 $extratime->setInfo($this->
lng->txt(
'tst_extratime_info'));
189 $extratime->setRequired(
true);
190 $extratime->setMinValue(0);
191 $extratime->setMinvalueShouldBeGreater(
false);
192 $extratime->setSuffix($this->
lng->txt(
'minutes'));
193 $extratime->setSize(5);
194 $form->addItem($extratime);
196 if (is_array($_POST) && isset($_POST[
'cmd'][
'timing']) && $_POST[
'cmd'][
'timing'] !=
'') {
197 $form->setValuesByArray($_POST);
200 $form->addCommandButton(self::CMD_SET_TIMING, $this->
lng->txt(
"save"));
201 $form->addCommandButton(self::CMD_SHOW_LIST, $this->
lng->txt(
"cancel"));
210 if ($form->checkInput()) {
212 $form->getInput(
'participant'),
213 $form->getInput(
'extratime')
216 $this->main_tpl->setOnScreenMessage(
'success', sprintf($this->
lng->txt(
'tst_extratime_added'), $form->getInput(
'extratime')),
true);
217 $this->
ctrl->redirect($this, self::CMD_SHOW_LIST);
220 $this->main_tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
isExtraTimeFeatureAvailable()
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
Class ilTimingOverviewTableGUI.
setTestObj(ilObjTest $test_obj)
__construct(private ilObjTest $test_obj, private ilObjUser $user, private ilCtrl $ctrl, private illanguage $lng, private ilDBInterface $db, private ilGlobalTemplateInterface $main_tpl, private ilTestParticipantAccessFilterFactory $participant_access_filter)