19declare(strict_types=1);
39 private readonly array $records,
44 private readonly \Psr\Http\Message\ServerRequestInterface $http_request,
46 private readonly
string $parent_cmd,
49 $form_action = $this->df->uri(
51 $this->
ctrl->getLinkTarget($this->parent_gui, $this->parent_cmd)
58 ] = (new \ILIAS\UI\URLBuilder($form_action))->acquireParameters(
59 [
'mail',
'attachments'],
64 $this->data_factory = new \ILIAS\Data\Factory();
69 return $this->ui_factory
73 $this->
lng->txt(
'attachment'),
76 ->withId(str_replace(
'\\',
'', self::class) .
'_' . $this->mode->name)
80 ->withRequest($this->http_request);
89 $date_format = $this->data_factory->dateFormat()->withTime12($this->actor->getDateFormat());
91 $date_format = $this->data_factory->dateFormat()->withTime24($this->actor->getDateFormat());
95 'filename' => $this->ui_factory
98 ->text($this->
lng->txt(
'mail_file_name'))
99 ->withIsSortable(
true),
100 'filesize' => $this->ui_factory
103 ->text($this->
lng->txt(
'mail_file_size'))
104 ->withIsSortable(
true),
105 'filecreatedate' => $this->ui_factory
108 ->date($this->
lng->txt(
'create_date'), $date_format)
109 ->withIsSortable(
true),
121 $actions[
'saveAttachments'] = $this->ui_factory->table()->action()->multi(
122 $this->
lng->txt(
'mail_adopt_selected_attachements'),
123 $this->url_builder->withParameter(
124 $this->action_parameter_token,
125 self::TABLE_ACTION_SAVE_ATTACHMENTS
130 $actions[
'deleteAttachments'] = $this->ui_factory->table()->action()->multi(
131 $this->
lng->txt(
'delete'),
132 $this->url_builder->withParameter(
133 $this->action_parameter_token,
134 self::TABLE_CONFIRM_DELETE_ATTACHMENTS
148 $records = $this->records;
150 [$order_field, $order_direction] = $order->join([],
static fn($ret, $key, $value) => [$key, $value]);
152 usort($records,
static function (array $left, array $right) use ($order_field):
int {
153 if ($order_field ===
'filename') {
154 return ilStr::strCmp($left[$order_field], $right[$order_field]);
157 return $left[$order_field] <=> $right[$order_field];
160 if ($order_direction ===
'DESC') {
161 $records = array_reverse($records);
171 array $visible_column_ids,
174 mixed $additional_viewcontrol_data,
176 mixed $additional_parameters
180 'filename' => $item[
'filename'],
182 'filecreatedate' => (new \DateTimeImmutable(
'@' . $item[
'filecreatedate']))->setTimezone(
183 new \DateTimeZone($this->actor->getTimeZone())
188 ->buildDataRow(urlencode($record[
'filename']), $record);
193 mixed $additional_viewcontrol_data,
195 mixed $additional_parameters
197 return \count($this->records);
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
readonly ILIAS UI URLBuilderToken $row_id_token
__construct(private readonly \ilMailAttachmentGUI $parent_gui, private readonly \ilObjUser $actor, private readonly array $records, private readonly \ILIAS\UI\Factory $ui_factory, private readonly \ILIAS\UI\Renderer $ui_renderer, private readonly \ilLanguage $lng, private readonly \ilCtrlInterface $ctrl, private readonly \Psr\Http\Message\ServerRequestInterface $http_request, private readonly \ILIAS\Data\Factory $df, private readonly string $parent_cmd, private readonly AttachmentManagement $mode)
readonly ILIAS Data Factory $data_factory
getRows(\ILIAS\UI\Component\Table\DataRowBuilder $row_builder, array $visible_column_ids, \ILIAS\Data\Range $range, \ILIAS\Data\Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
readonly ILIAS UI URLBuilderToken $action_parameter_token
readonly ILIAS UI URLBuilder $url_builder
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
getRecords(\ILIAS\Data\Range $range, \ILIAS\Data\Order $order)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static strCmp(string $a, string $b)
Util class various functions, usage as namespace.
static formatSize(int $size, string $a_mode='short', ?ilLanguage $a_lng=null)
Returns the specified file size value in a human friendly form.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.