19 declare(strict_types=1);
64 private readonly
Closure $criterion_as_component,
66 private readonly
UI $ui,
68 private readonly
object $gui,
77 $this->request = $request ?: $DIC->http()->request();
78 $this->data_factory = $data_factory ?:
new Factory();
79 $this->
ctrl = $ctrl ?: $DIC->ctrl();
80 $this->ui_renderer = $ui_renderer ?: $DIC->ui()->renderer();
81 $this->
user = $user ?: $DIC->user();
82 $this->usr_timezone = new \DateTimeZone($this->
user->getTimeZone());
89 $uiTable = $this->
ui->create()->table();
92 $date_format = $this->data_factory->dateFormat()->withTime12($this->
user->getDateFormat());
94 $date_format = $this->data_factory->dateFormat()->withTime24($this->
user->getDateFormat());
97 $table = $uiTable->ordering(
99 (
new URI((
string) $this->request->getUri()))->withParameter(
'cmd',
'saveOrder'),
100 $this->
ui->txt(
'tbl_docs_title'),
102 'title' => $uiTable->column()->text($this->
ui->txt(
'tbl_docs_head_title')),
103 'created' => $uiTable->column()->date($this->
ui->txt(
'tbl_docs_head_created'), $date_format),
104 'change' => $uiTable->column()->date($this->
ui->txt(
'tbl_docs_head_last_change'), $date_format),
105 'criteria' => $uiTable->column()->text($this->
ui->txt(
'tbl_docs_head_criteria')),
108 ->withId(
'legalDocsTable')
109 ->withRequest($this->request);
111 if ($this->edit_links) {
120 array $visible_column_ids
122 foreach ($this->
repository->all() as $document) {
129 $criterion_components = [];
130 foreach ($document->
criteria() as $criterion) {
131 $criterion_components[] = $this->
ui->create()->legacy()->content(
'<div style="display: flex; gap: 1rem;">');
134 if ($this->edit_links) {
135 $delete_modal = $this->
ui->create()->modal()->interruptive(
136 $this->
ui->txt(
'doc_detach_crit_confirm_title'),
137 $this->
ui->txt(
'doc_sure_detach_crit'),
138 $this->edit_links->deleteCriterion($document, $criterion)
141 $dropdown = $this->
ui->create()->dropdown()->standard([
142 $this->
ui->create()->button()->shy(
143 $this->
ui->txt(
'edit'),
144 $this->edit_links->editCriterion($document, $criterion)
146 $this->
ui->create()->button()->shy(
147 $this->
ui->txt(
'delete'),
149 )->withOnClick($delete_modal->getShowSignal())
152 $criterion_components[] = $delete_modal;
153 $criterion_components[] = $dropdown;
156 $criterion_components[] = $this->
ui->create()->legacy()->content(
'</div>');
160 'id' => $document->
id(),
161 'title' => $this->ui_renderer->render($this->
modal->create($document->
content())),
162 'created' => $document->
meta()->creation()->time()->setTimezone($this->usr_timezone),
163 'change' => $document->
meta()->lastModification()->time()->setTimezone($this->usr_timezone),
164 'criteria' => $this->ui_renderer->render($criterion_components),
171 return ($this->criterion_as_component)($criterion->
content());
181 return $this->ui_renderer->render($this->table);
190 self::CMD_DELETE_DOCUMENTS => $this->buildTableAction(self::CMD_DELETE_DOCUMENTS, $this->
ui->txt(
'delete'),
true),
191 self::CMD_EDIT_DOCUMENT => $this->buildTableAction(self::CMD_EDIT_DOCUMENT, $this->
ui->txt(
'edit')),
192 self::CMD_ADD_CRITERION => $this->buildTableAction(
193 self::CMD_ADD_CRITERION,
194 $this->
ui->txt(
'tbl_docs_action_add_criterion')
196 self::CMD_DELETE_DOCUMENT => $this->buildTableAction(self::CMD_DELETE_DOCUMENT, $this->
ui->txt(
'delete')),
200 private function buildTableAction(
string $cmd,
string $title,
bool $multi =
false):
Single|
Multi 202 $uri = $this->data_factory->uri(
203 ILIAS_HTTP_PATH .
'/' . $this->
ctrl->getLinkTarget($this->gui, $cmd)
213 $action_parameter_token,
215 ] = (
new URLBuilder($uri))->acquireParameters(
222 return $this->
ui->create()->table()->action()->multi(
224 $url_builder->withParameter($action_parameter_token, $cmd),
229 return $this->
ui->create()->table()->action()->single(
231 $url_builder->withParameter($action_parameter_token, $cmd),
getRows(OrderingRowBuilder $row_builder, array $visible_column_ids)
This is called by the (ordering-)table to retrieve rows; map data-records to rows using the $row_buil...
readonly Factory $data_factory
repository()
description: > Example for rendering a repository card
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readonly Renderer $ui_renderer
criterionName(Criterion $criterion)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This describes a Table to specify the order of its data (rows).
const CMD_DELETE_DOCUMENT
DateTimeZone $usr_timezone
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildTableRow(OrderingRowBuilder $row_builder, Document $document)
const CMD_DELETE_DOCUMENTS
__construct(private readonly Closure $criterion_as_component, private readonly DocumentRepository $repository, private readonly UI $ui, private readonly DocumentModal $modal, private readonly object $gui, private readonly ?EditLinks $edit_links=null, ServerRequestInterface|RequestInterface|null $request=null, ?Factory $data_factory=null, ?ilCtrlInterface $ctrl=null, ?Renderer $ui_renderer=null, ?ilObjUser $user=null)
modal(string $title="", string $cancel_label="")
readonly ilCtrlInterface $ctrl
buildOrderingRow(string $id, array $record)
readonly ServerRequestInterface RequestInterface $request