ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\LegalDocuments\Table\DocumentTable Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\Table\DocumentTable:
+ Collaboration diagram for ILIAS\LegalDocuments\Table\DocumentTable:

Public Member Functions

 __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)
 
 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_builder e.g. More...
 
 criterionName (Criterion $criterion)
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 
 render ()
 
 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_builder e.g. More...
 

Data Fields

const CMD_EDIT_DOCUMENT = 'editDocument'
 
const CMD_DELETE_DOCUMENT = 'deleteDocument'
 
const CMD_DELETE_DOCUMENTS = 'deleteDocuments'
 
const CMD_ADD_CRITERION = 'addCriterion'
 

Private Member Functions

 buildTable ()
 
 buildTableRow (OrderingRowBuilder $row_builder, Document $document)
 
 buildTableActions ()
 

Private Attributes

readonly ServerRequestInterface RequestInterface $request
 
readonly Factory $data_factory
 
readonly ilCtrlInterface $ctrl
 
readonly Ordering $table
 
readonly Renderer $ui_renderer
 
readonly ilObjUser $user
 
readonly DateTimeZone $usr_timezone
 
array $modals = []
 

Detailed Description

Definition at line 48 of file DocumentTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\Table\DocumentTable::__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 
)

Definition at line 66 of file DocumentTable.php.

78 {
79 global $DIC;
80 $this->request = $request ?: $DIC->http()->request();
81 $this->data_factory = $data_factory ?: new Factory();
82 $this->ctrl = $ctrl ?: $DIC->ctrl();
83 $this->ui_renderer = $ui_renderer ?: $DIC->ui()->renderer();
84 $this->user = $user ?: $DIC->user();
85 $this->usr_timezone = new \DateTimeZone($this->user->getTimeZone());
86
87 $this->table = $this->buildTable();
88 }
Builds data types.
Definition: Factory.php:36
readonly ServerRequestInterface RequestInterface $request
global $DIC
Definition: shib_login.php:26

References ILIAS\LegalDocuments\Table\DocumentTable\$data_factory, $DIC, ILIAS\LegalDocuments\Table\DocumentTable\$request, ILIAS\LegalDocuments\Table\DocumentTable\$ui_renderer, ILIAS\LegalDocuments\Table\DocumentTable\buildTable(), ILIAS\Repository\ctrl(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildTable()

ILIAS\LegalDocuments\Table\DocumentTable::buildTable ( )
private

Definition at line 90 of file DocumentTable.php.

90 : Ordering
91 {
92 $uiTable = $this->ui->create()->table();
93
94 if ((int) $this->user->getTimeFormat() === ilCalendarSettings::TIME_FORMAT_12) {
95 $date_format = $this->data_factory->dateFormat()->withTime12($this->user->getDateFormat());
96 } else {
97 $date_format = $this->data_factory->dateFormat()->withTime24($this->user->getDateFormat());
98 }
99
100 $table = $uiTable->ordering(
101 $this,
102 (new URI((string) $this->request->getUri()))->withParameter('cmd', 'saveOrder'),
103 $this->ui->txt('tbl_docs_title'),
104 [
105 'title' => $uiTable->column()->text($this->ui->txt('tbl_docs_head_title')),
106 'created' => $uiTable->column()->date($this->ui->txt('tbl_docs_head_created'), $date_format),
107 'change' => $uiTable->column()->date($this->ui->txt('tbl_docs_head_last_change'), $date_format),
108 'criteria' => $uiTable->column()->text($this->ui->txt('tbl_docs_head_criteria')),
109 ],
110 )
111 ->withId('legalDocsTable')
112 ->withRequest($this->request);
113
114 if ($this->edit_links) {
116 }
117
118 return $table;
119 }
This describes a Table to specify the order of its data (rows).
Definition: Ordering.php:29
withId(string $id)
The DataTable comes with a storage to keep e.g.

References ILIAS\LegalDocuments\Table\DocumentTable\$table, ILIAS\LegalDocuments\Table\DocumentTable\buildTableActions(), ilCalendarSettings\TIME_FORMAT_12, ILIAS\Repository\ui(), ILIAS\Repository\user(), and ILIAS\UI\Component\Table\Ordering\withActions().

Referenced by ILIAS\LegalDocuments\Table\DocumentTable\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTableActions()

ILIAS\LegalDocuments\Table\DocumentTable::buildTableActions ( )
private
Returns
array{deleteDocuments: Multi, editDocument: Single, addCriterion: Single, deleteDocument: Single}

Definition at line 197 of file DocumentTable.php.

197 : array
198 {
199 return [
200 self::CMD_DELETE_DOCUMENTS => $this->buildTableAction(self::CMD_DELETE_DOCUMENTS, $this->ui->txt('delete'), true),
201 self::CMD_EDIT_DOCUMENT => $this->buildTableAction(self::CMD_EDIT_DOCUMENT, $this->ui->txt('edit')),
202 self::CMD_ADD_CRITERION => $this->buildTableAction(
203 self::CMD_ADD_CRITERION,
204 $this->ui->txt('tbl_docs_action_add_criterion')
205 ),
206 self::CMD_DELETE_DOCUMENT => $this->buildTableAction(self::CMD_DELETE_DOCUMENT, $this->ui->txt('delete')),
207 ];
208 }

References ILIAS\Repository\ui().

Referenced by ILIAS\LegalDocuments\Table\DocumentTable\buildTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTableRow()

ILIAS\LegalDocuments\Table\DocumentTable::buildTableRow ( OrderingRowBuilder  $row_builder,
Document  $document 
)
private

Definition at line 130 of file DocumentTable.php.

130 : OrderingRow
131 {
132 $criterion_components = [];
133 foreach ($document->criteria() as $criterion) {
134 $criterion_components[] = $this->ui->create()->legacy()->content('<div style="display: flex; gap: 1rem;">');
135 $criterion_components[] = $this->criterionName($criterion);
136
137 if ($this->edit_links) {
138 $delete_modal = $this->ui->create()->modal()->interruptive(
139 $this->ui->txt('doc_detach_crit_confirm_title'),
140 $this->ui->txt('doc_sure_detach_crit'),
141 $this->edit_links->deleteCriterion($document, $criterion)
142 );
143
144 $dropdown = $this->ui->create()->dropdown()->standard([
145 $this->ui->create()->button()->shy(
146 $this->ui->txt('edit'),
147 $this->edit_links->editCriterion($document, $criterion)
148 ),
149 $this->ui->create()->button()->shy(
150 $this->ui->txt('delete'),
151 ''
152 )->withOnClick($delete_modal->getShowSignal())
153 ]);
154
155 $this->modals[] = $delete_modal;
156 $criterion_components[] = $dropdown;
157 }
158
159 $criterion_components[] = $this->ui->create()->legacy()->content('</div>');
160 }
161
162 $table_row = [
163 'id' => $document->id(),
164 'title' => $this->ui_renderer->render($this->modal->create($document->content())),
165 'created' => $document->meta()->creation()->time()->setTimezone($this->usr_timezone),
166 'change' => $document->meta()->lastModification()->time()->setTimezone($this->usr_timezone),
167 'criteria' => $this->ui_renderer->render($criterion_components),
168 ];
169 return $row_builder->buildOrderingRow((string) $document->id(), $table_row);
170 }
buildOrderingRow(string $id, array $record)
modal(string $title="", string $cancel_label="")

References ILIAS\UI\Component\Table\OrderingRowBuilder\buildOrderingRow(), ILIAS\LegalDocuments\Value\Document\content(), ILIAS\LegalDocuments\Value\Document\criteria(), ILIAS\LegalDocuments\Value\Document\id(), ILIAS\LegalDocuments\Value\Document\meta(), ILIAS\Repository\modal(), and ILIAS\Repository\ui().

Referenced by ILIAS\LegalDocuments\Table\DocumentTable\getRows().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ criterionName()

ILIAS\LegalDocuments\Table\DocumentTable::criterionName ( Criterion  $criterion)

Definition at line 172 of file DocumentTable.php.

172 : Component
173 {
174 return ($this->criterion_as_component)($criterion->content());
175 }

References ILIAS\LegalDocuments\Value\Criterion\content().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\LegalDocuments\Table\DocumentTable::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_builder e.g.

yield $row_builder->buildOrderingRow($row_id, $record).

Implements ILIAS\UI\Component\Table\OrderingRetrieval.

Definition at line 121 of file DocumentTable.php.

124 : Generator {
125 foreach ($this->repository->all() as $document) {
126 yield $this->buildTableRow($row_builder, $document);
127 }
128 }
buildTableRow(OrderingRowBuilder $row_builder, Document $document)

References ILIAS\LegalDocuments\Table\DocumentTable\buildTableRow().

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\LegalDocuments\Table\DocumentTable::getTotalRowCount ( mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)

Definition at line 177 of file DocumentTable.php.

181 : ?int {
182 return $this->repository->countAll();
183 }

◆ render()

ILIAS\LegalDocuments\Table\DocumentTable::render ( )

Definition at line 185 of file DocumentTable.php.

185 : string
186 {
187 // This MUST be rendered BEFORE $this->modal->components(),
188 // because the components are filled within the rendering process.
189 $html = $this->ui_renderer->render($this->table);
190
191 return $html . $this->ui_renderer->render([...$this->modal->popComponents(), ...$this->modals]);
192 }

References ILIAS\Repository\modal().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

readonly ilCtrlInterface ILIAS\LegalDocuments\Table\DocumentTable::$ctrl
private

Definition at line 57 of file DocumentTable.php.

◆ $data_factory

readonly Factory ILIAS\LegalDocuments\Table\DocumentTable::$data_factory
private

◆ $modals

array ILIAS\LegalDocuments\Table\DocumentTable::$modals = []
private

Definition at line 64 of file DocumentTable.php.

◆ $request

readonly ServerRequestInterface RequestInterface ILIAS\LegalDocuments\Table\DocumentTable::$request
private

◆ $table

readonly Ordering ILIAS\LegalDocuments\Table\DocumentTable::$table
private

◆ $ui_renderer

readonly Renderer ILIAS\LegalDocuments\Table\DocumentTable::$ui_renderer
private

◆ $user

readonly ilObjUser ILIAS\LegalDocuments\Table\DocumentTable::$user
private

Definition at line 60 of file DocumentTable.php.

◆ $usr_timezone

readonly DateTimeZone ILIAS\LegalDocuments\Table\DocumentTable::$usr_timezone
private

Definition at line 61 of file DocumentTable.php.

◆ CMD_ADD_CRITERION

const ILIAS\LegalDocuments\Table\DocumentTable::CMD_ADD_CRITERION = 'addCriterion'

Definition at line 53 of file DocumentTable.php.

◆ CMD_DELETE_DOCUMENT

const ILIAS\LegalDocuments\Table\DocumentTable::CMD_DELETE_DOCUMENT = 'deleteDocument'

Definition at line 51 of file DocumentTable.php.

◆ CMD_DELETE_DOCUMENTS

const ILIAS\LegalDocuments\Table\DocumentTable::CMD_DELETE_DOCUMENTS = 'deleteDocuments'

Definition at line 52 of file DocumentTable.php.

◆ CMD_EDIT_DOCUMENT

const ILIAS\LegalDocuments\Table\DocumentTable::CMD_EDIT_DOCUMENT = 'editDocument'

Definition at line 50 of file DocumentTable.php.


The documentation for this class was generated from the following file: