ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilTestPersonalDefaultSettingsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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 
30  parent::__construct($parent_obj, $cmd);
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 }
setNoEntriesText(string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
const IL_CAL_UNIX
setFormName(string $a_name="")
setId(string $a_val)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
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)
addMultiCommand(string $a_cmd, string $a_text)