ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTestPersonalDefaultSettingsTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 public function __construct(ilObjTestGUI $parent_obj, string $cmd)
27 {
28 $this->setId('tst_pers_def_set_' . $parent_obj->getObject()->getId());
29
31
32 $this->setTitle($this->lng->txt('tst_defaults_available'));
33 $this->setNoEntriesText($this->lng->txt('tst_defaults_not_defined'));
34 $this->setFormAction($this->ctrl->getFormAction($parent_obj, $cmd));
35
36 $this->setRowTemplate('tpl.il_as_tst_defaults_row.html', 'components/ILIAS/Test');
37
38 $this->setShowRowsSelector(true);
39 $this->setSelectAllCheckbox('chb_defaults');
40 $this->setFormName('formDefaults');
41 $this->addMultiCommand('deleteDefaults', $this->lng->txt('delete'));
42 $this->addMultiCommand('applyDefaults', $this->lng->txt('apply_def_settings_to_tst'));
43 $this->initColumns();
44 }
45
46 private function initColumns(): void
47 {
48 $this->addColumn('', '', '1px', true);
49 $this->addColumn($this->lng->txt('title'), 'name', '80%');
50 $this->addColumn($this->lng->txt('date'), 'tstamp', '19%');
51 }
52
53 public function fillRow(array $a_set): void
54 {
55 parent::fillRow([
56 'name' => $a_set['name'],
57 'checkbox' => ilLegacyFormElementsUtil::formCheckbox(false, 'chb_defaults[]', (string) $a_set['test_defaults_id']),
58 'tstamp' => ilDatePresentation::formatDate(new ilDateTime($a_set['tstamp'], IL_CAL_UNIX))
59 ]);
60 }
61
62 public function numericOrdering(string $a_field): bool
63 {
64 return in_array($a_field, [
65 'tstamp'
66 ]);
67 }
68}
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
Class ilObjTestGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormName(string $a_name="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setNoEntriesText(string $a_text)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
numericOrdering(string $a_field)
Should this field be sorted numeric?
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc