19declare(strict_types=1);
51 public const string HOME =
'HOME';
53 private \ILIAS\ResourceStorage\Services
$irss;
72 $this->data_factory = new \ILIAS\Data\Factory();
73 $this->ui_renderer =
$DIC->ui()->renderer();
74 $this->
ctrl = $DIC->ctrl();
75 $this->actions = $this->action_builder->getActionProvider()->getSingleActions(
83 if ($this->request->canUserAdministrate()) {
84 foreach ($this->action_builder->getActionProvider()->getTopActions() as $top_action) {
85 if ($top_action->getAction() instanceof
Signal) {
86 $button = $this->ui_factory->button()->shy(
87 $top_action->getLabel(),
91 $button = $this->ui_factory->button()->shy(
92 $top_action->getLabel(),
93 (
string) $top_action->getAction()
100 return $this->ui_factory->dropdown()->standard($buttons);
105 $get_action =
function (
string $path_inside_zip):
string {
106 $this->
ctrl->setParameterByClass(
107 \ilContainerResourceGUI::class,
109 $this->hash($path_inside_zip)
111 return $this->
ctrl->getLinkTargetByClass(
112 \ilContainerResourceGUI::class,
119 $links[] = $this->ui_factory->link()->standard(
120 $this->
language->txt(
'home_directory'),
125 if ($this->request->getPath() !==
'./') {
126 $directories = array_filter(
127 explode(
'/', $this->request->getPath()),
128 static fn(
string $part):
bool => $part !==
''
131 foreach ($directories as $i => $directory) {
132 $path_inside_zip = rtrim(
133 implode(
'/', array_slice($directories, 0, $i + 1)),
136 $links[] = $this->ui_factory->link()->standard(
138 $get_action($path_inside_zip)
142 yield $this->ui_factory->divider()->horizontal();
144 yield $this->ui_factory->breadcrumbs($links);
152 yield $this->ui_factory->panel()->standard(
153 $this->
language->txt(
'title_manage_container'),
155 iterator_to_array($this->upload_builder->getDropZone()),
158 )->withActions($dropdown);
167 $columns[
self::F_TITLE] = $this->ui_factory->table()->column()->text(
169 )->withIsSortable(
true);
171 if ($this->request->getPathStatusInfo() instanceof
PathStatusInfo) {
172 $columns[
self::F_STATUS] = $this->ui_factory->table()->column()->text(
173 $this->
language->txt(self::F_STATUS)
174 )->withIsSortable(
false);
177 $columns[
self::F_SIZE] = $this->ui_factory->table()->column()->text(
179 )->withIsSortable(
true);
182 $this->
language->txt(self::F_MODIFICATION_DATE),
183 $this->data_factory->dateFormat()->germanLong()
184 )->withIsSortable(
true);
186 $columns[
self::F_TYPE] = $this->ui_factory->table()->column()->text(
188 )->withIsSortable(
true);
190 return $this->ui_factory->table()->data(
192 $this->request->getTitle(),
195 $this->
http->request()
197 $this->action_builder->getActions()
199 new Range(0, $this->request->getItemsPerPage())
205 array $visible_column_ids,
208 mixed $additional_viewcontrol_data,
210 mixed $additional_parameters
216 $entries = $this->data_provider->getEntries();
218 $entries = array_slice(
224 foreach ($entries as $entry) {
225 $is_dir = $entry instanceof
Dir;
228 $entry_name = trim((
string) $entry,
'/');
231 $this->
ctrl->setParameterByClass(
232 \ilContainerResourceGUI::class,
234 $this->hash($path_inside_zip)
237 $action = $this->
ctrl->getLinkTargetByClass(
238 \ilContainerResourceGUI::class,
243 ? $this->ui_renderer->render(
244 $this->ui_factory->link()->standard($entry_name, $action)
249 $this->hash($entry->getPathInsideZIP()),
251 self::F_TITLE => $title,
252 self::F_STATUS => $this->request->getPathStatusInfo()?->statusTextForPath(
253 $entry->getPathInsideZIP()
255 self::F_SIZE => $is_dir ?
'' : $this->formatSize($entry->getSize()),
256 self::F_TYPE => $is_dir ?
'' : $entry->getMimeType(),
257 self::F_MODIFICATION_DATE => $entry->getModificationDate(),
261 foreach ($this->actions as $key => $single_action) {
262 if ($is_dir && !$single_action->supportsDirectories()) {
263 $data_row = $data_row->withDisabledAction($key);
266 if ($single_action->getSupportedMimeTypes() !== [
'*']) {
268 $data_row = $data_row->withDisabledAction($key);
270 if (isset($regex_storage[$key])) {
271 $regex = $regex_storage[$key];
273 $mime_type_quoted = [];
274 foreach ($single_action->getSupportedMimeTypes() as $mime_type) {
275 $mime_type_quoted[] = str_replace(
'*',
'.*', preg_quote((
string) $mime_type,
'/'));
278 $regex_storage[$key] = $regex = implode(
'|', $mime_type_quoted);
280 if (!preg_match(
"/($regex)/", $entry->getMimeType())) {
281 $data_row = $data_row->withDisabledAction($key);
292 $sort_field = array_keys($order->
get())[0];
293 $sort_direction = $order->
get()[$sort_field];
297 $this->data_provider->getViewRequest()->setPage((
int) round($start / $length, 0, \RoundingMode::HalfTowardsZero));
298 $this->data_provider->getViewRequest()->setItemsPerPage($length);
300 switch ($sort_field .
'_' . $sort_direction) {
313 case self::F_MODIFICATION_DATE .
'_' .
Order::ASC:
316 case self::F_MODIFICATION_DATE .
'_' .
Order::DESC:
329 mixed $additional_viewcontrol_data,
331 mixed $additional_parameters
333 return $this->data_provider->getTotal();
Builds a Color from either hex- or rgb values.
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.
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e....
ILIAS ResourceStorage Services $irss
const string F_MODIFICATION_DATE
ILIAS Data Factory $data_factory
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...
__construct(private Request $request, private Factory $ui_factory, private \ilLanguage $language, private Services $http, private TableDataProvider $data_provider, private ActionBuilder $action_builder, private ViewControlBuilder $view_control_builder, private UploadBuilder $upload_builder)
initSortingAndOrdering(Range $range, Order $order)
const BY_CREATION_DATE_DESC
const BY_CREATION_DATE_ASC
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withOnClick(Signal $signal)
Get a component like this, triggering a signal of another component on click.
This describes a Standard Dropdown.
buildDataRow(string $id, array $record)
This describes a Data Table.
withRequest(ServerRequestInterface $request)
Rendering the Table must be done using the current Request: it (the request) will be forwarded to the...
This is how the factory for UI elements looks.
An entity that renders components to a string output.
static http()
Fetches the global http state from ILIAS.