ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUserExportFileTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 private const USER_EXPORT_TABLE_ID = 'usr_export_table';
27 private const USER_EXPORT_FORM_NAME = 'usr_export_form';
28
29 private ?ilLogger $logger = null;
30
31 public function __construct(
32 object $a_parent_obj,
33 string $a_parent_cmd = "",
34 $a_template_context = ""
35 ) {
36 global $DIC;
37
38 $this->setId(self::USER_EXPORT_TABLE_ID);
39 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
40
41 $this->logger = $DIC->logger()->user();
42 }
43
44 public function init(): void
45 {
46 $this->lng->loadLanguageModule('usr');
47 $this->setFormName(self::USER_EXPORT_FORM_NAME);
48 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
49
50 $this->addColumn('', '');
51 $this->addColumn($this->lng->txt('userfolder_export_file'), 'file', '50%');
52 $this->addColumn($this->lng->txt('userfolder_export_file_size'), 'size_sort', '25%');
53 $this->addColumn($this->lng->txt('date'), 'dt_sort', '25%');
54
55
56 $this->setDefaultOrderField('dt');
57 $this->setDefaultOrderDirection('desc');
58
59 $this->setRowTemplate('tpl.usr_export_file_row.html', 'components/ILIAS/User');
61
62 $this->addMultiCommand(
63 'downloadExportFile',
64 $this->lng->txt('download')
65 );
66
67 $this->addMultiCommand(
68 'confirmDeleteExportFile',
69 $this->lng->txt('delete')
70 );
71 $this->setSelectAllCheckbox('file');
72 $this->enable('num_info');
73 }
74
75 public function numericOrdering(string $a_field): bool
76 {
77 switch ($a_field) {
78 case 'size_sort':
79 case 'dt_sort':
80 return true;
81 }
82 return false;
83 }
84
88 protected function fillRow(array $a_set): void // Missing array type.
89 {
90 $this->tpl->setVariable('CHECKBOX_ID', $a_set['file']);
91 $this->tpl->setVariable('TXT_FILENAME', $a_set['file']);
92 $this->tpl->setVariable('TXT_SIZE', $a_set['size']);
93 $this->tpl->setVariable('TXT_DATE', $a_set['date']);
94 }
95
96 public function parse(array $export_files): void // Missing array type.
97 {
98 $files = [];
99 $counter = 0;
100 foreach ($export_files as $file_info) {
101 $this->logger->dump($file_info, \ilLogLevel::NOTICE);
102
103 $file_info_parts = explode('_', $file_info['filename']);
104 $dt = $file_info_parts[0];
105
106 $dt_obj = new \ilDateTime($dt, IL_CAL_UNIX);
107
108 $files[$counter]['file'] = $file_info['filename'];
109 $files[$counter]['size'] = $file_info['filesize'];
110 $files[$counter]['size_sort'] = $file_info['filesize'];
111 $files[$counter]['date'] = \ilDatePresentation::formatDate($dt_obj);
112 $files[$counter]['dt_sort'] = $dt;
113 ++$counter;
114 }
115
116 $this->logger->dump($files, \ilLogLevel::NOTICE);
117 $this->setData($files);
118 }
119}
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,)
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
determineOffsetAndOrder(bool $a_omit_offset=false)
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)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
enable(string $a_module_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
numericOrdering(string $a_field)
Should this field be sorted numeric?
__construct(object $a_parent_obj, string $a_parent_cmd="", $a_template_context="")
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$counter