ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMemberExportFileTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21
27{
28 public function __construct(object $a_parent_obj, string $a_parent_cmd, ilFileSystemAbstractionStorage $a_fss_export)
29 {
30 $this->setId('memexp');
31 parent::__construct($a_parent_obj, $a_parent_cmd);
32
33 $this->setTitle($this->lng->txt('ps_export_files'));
34 $this->addColumn('', '', '1');
35 $this->addColumn($this->lng->txt('type'), 'type');
36 $this->addColumn($this->lng->txt('ps_size'), 'size');
37 $this->addColumn($this->lng->txt('date'), 'date');
38 $this->addColumn($this->lng->txt('action'), '');
39
40 $this->setDefaultOrderField('date');
41 $this->setDefaultOrderDirection('desc');
42
43 $this->setRowTemplate('tpl.mem_export_file_row.html', 'components/ILIAS/Membership');
44 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
45 $this->addMultiCommand('confirmDeleteExportFile', $this->lng->txt('delete'));
46 $this->setSelectAllCheckbox('id[]');
47 $this->getFiles($a_fss_export);
48 }
49
50 public function numericOrdering(string $a_field): bool
51 {
52 return in_array($a_field, array('size', 'date'));
53 }
54
55 protected function getFiles(ilFileSystemAbstractionStorage $a_fss_export): void
56 {
57 $data = [];
58 foreach ($a_fss_export->getMemberExportFiles() as $exp_file) {
59 $data[] = [
60 'id' => md5($exp_file['name']),
61 'type' => strtoupper($exp_file["type"]),
62 'date' => $exp_file['timest'],
63 'size' => $exp_file['size']
64 ];
65 }
66
67 $this->setData($data);
68 }
69
70 protected function fillRow(array $a_set): void
71 {
72 global $DIC;
73
74 $ilCtrl = $DIC['ilCtrl'];
75
76 $this->tpl->setVariable('VAL_ID', $a_set['id']);
77 $this->tpl->setVariable('VAL_TYPE', $a_set['type']);
78 $this->tpl->setVariable('VAL_SIZE', ilUtil::formatSize($a_set['size']));
79 $this->tpl->setVariable(
80 'VAL_DATE',
82 );
83
84 $ilCtrl->setParameter($this->getParentObject(), 'fl', $a_set['id']);
85 $url = $ilCtrl->getLinkTarget($this->getParentObject(), 'downloadExportFile');
86 $ilCtrl->setParameter($this->getParentObject(), 'fl', '');
87
88 $this->tpl->setVariable('URL_DOWNLOAD', $url);
89 $this->tpl->setVariable('TXT_DOWNLOAD', $this->lng->txt('download'));
90 }
91}
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
Table presentation of membership export files.
getFiles(ilFileSystemAbstractionStorage $a_fss_export)
numericOrdering(string $a_field)
Should this field be sorted numeric?
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $a_parent_obj, string $a_parent_cmd, ilFileSystemAbstractionStorage $a_fss_export)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
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.
static formatSize(int $size, string $a_mode='short', ?ilLanguage $a_lng=null)
Returns the specified file size value in a human friendly form.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68