ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.ilMailAttachmentTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 public function __construct(?object $a_parent_obj, string $a_parent_cmd)
28 {
29 $this->setId('mail_attachments');
30
31 $this->setDefaultOrderDirection('ASC');
32 $this->setDefaultOrderField('filename');
33
34 parent::__construct($a_parent_obj, $a_parent_cmd);
35
36 $this->setTitle($this->lng->txt('attachment'));
37 $this->setNoEntriesText($this->lng->txt('marked_entries'));
38
39 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyFilter'));
40
41 $this->setSelectAllCheckbox('filename[]');
42
43 $this->setRowTemplate('tpl.mail_attachment_row.html', 'Services/Mail');
44
45 $this->addMultiCommand('saveAttachments', $this->lng->txt('adopt'));
46 $this->addMultiCommand('deleteAttachments', $this->lng->txt('delete'));
47
48 $this->addCommandButton('cancelSaveAttachments', $this->lng->txt('cancel'));
49
50 $this->addColumn($this->lng->txt(''), '', '1px', true);
51 $this->addColumn($this->lng->txt('mail_file_name'), 'filename');
52 $this->addColumn($this->lng->txt('mail_file_size'), 'filesize');
53 $this->addColumn($this->lng->txt('create_date'), 'filecreatedate');
54 // Show all attachments on one page
55 $this->setLimit(PHP_INT_MAX);
56 }
57
58 protected function fillRow(array $a_set): void
59 {
63 $this->tpl->setVariable(
64 'VAL_CHECKBOX',
65 ilLegacyFormElementsUtil::formCheckbox($a_set['checked'], 'filename[]', urlencode($a_set['filename']))
66 );
67 $this->tpl->setVariable(
68 'VAL_FILENAME',
69 $this->formatValue('filename', $a_set['filename'])
70 );
71 $this->tpl->setVariable(
72 'VAL_FILESIZE',
73 $this->formatValue('filesize', (string) $a_set['filesize'])
74 );
75 $this->tpl->setVariable(
76 'VAL_FILECREATEDATE',
77 $this->formatValue('filecreatedate', (string) $a_set['filecreatedate'])
78 );
79 }
80
81 public function numericOrdering(string $a_field): bool
82 {
83 return $a_field === 'filesize' || $a_field === 'filecreatedate';
84 }
85
86 protected function formatValue(string $column, string $value): ?string
87 {
88 switch ($column) {
89 case 'filecreatedate':
91
92 case 'filesize':
93 return ilUtil::formatSize((int) $value, 'long');
94
95 default:
96 return $value;
97 }
98 }
99}
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
numericOrdering(string $a_field)
Should this field be sorted numeric?
fillRow(array $a_set)
Standard Version of Fill Row.
formatValue(string $column, string $value)
__construct(?object $a_parent_obj, string $a_parent_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
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)
setNoEntriesText(string $a_text)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
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