ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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 (?array $filter_data, ?array $additional_parameters)
 
 render ()
 

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
 
ilObjUser $user
 
DateTimeZone $usr_timezone
 

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 63 of file DocumentTable.php.

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

75  {
76  global $DIC;
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());
83 
84  $this->table = $this->buildTable();
85  }
global $DIC
Definition: shib_login.php:26
readonly ServerRequestInterface RequestInterface $request
+ Here is the call graph for this function:

Member Function Documentation

◆ buildTable()

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

Definition at line 87 of file DocumentTable.php.

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

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

87  : Ordering
88  {
89  $uiTable = $this->ui->create()->table();
90 
91  if ((int) $this->user->getTimeFormat() === ilCalendarSettings::TIME_FORMAT_12) {
92  $date_format = $this->data_factory->dateFormat()->withTime12($this->user->getDateFormat());
93  } else {
94  $date_format = $this->data_factory->dateFormat()->withTime24($this->user->getDateFormat());
95  }
96 
97  $table = $uiTable->ordering(
98  $this,
99  (new URI((string) $this->request->getUri()))->withParameter('cmd', 'saveOrder'),
100  $this->ui->txt('tbl_docs_title'),
101  [
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')),
106  ],
107  )
108  ->withId('legalDocsTable')
109  ->withRequest($this->request);
110 
111  if ($this->edit_links) {
113  }
114 
115  return $table;
116  }
withId(string $id)
The DataTable comes with a storage to keep e.g.
+ 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 187 of file DocumentTable.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\ui().

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

187  : array
188  {
189  return [
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')
195  ),
196  self::CMD_DELETE_DOCUMENT => $this->buildTableAction(self::CMD_DELETE_DOCUMENT, $this->ui->txt('delete')),
197  ];
198  }
+ 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 127 of file DocumentTable.php.

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

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

127  : OrderingRow
128  {
129  $criterion_components = [];
130  foreach ($document->criteria() as $criterion) {
131  $criterion_components[] = $this->ui->create()->legacy()->content('<div style="display: flex; gap: 1rem;">');
132  $criterion_components[] = $this->criterionName($criterion);
133 
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)
139  );
140 
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)
145  ),
146  $this->ui->create()->button()->shy(
147  $this->ui->txt('delete'),
148  ''
149  )->withOnClick($delete_modal->getShowSignal())
150  ]);
151 
152  $criterion_components[] = $delete_modal;
153  $criterion_components[] = $dropdown;
154  }
155 
156  $criterion_components[] = $this->ui->create()->legacy()->content('</div>');
157  }
158 
159  $table_row = [
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),
165  ];
166  return $row_builder->buildOrderingRow((string) $document->id(), $table_row);
167  }
modal(string $title="", string $cancel_label="")
+ 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 169 of file DocumentTable.php.

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

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

169  : Component
170  {
171  return ($this->criterion_as_component)($criterion->content());
172  }
+ Here is the call graph for this function:
+ Here is the caller 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 118 of file DocumentTable.php.

References ILIAS\LegalDocuments\Table\DocumentTable\buildTableRow(), and ILIAS\UI\examples\Deck\repository().

121  : Generator {
122  foreach ($this->repository->all() as $document) {
123  yield $this->buildTableRow($row_builder, $document);
124  }
125  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
buildTableRow(OrderingRowBuilder $row_builder, Document $document)
+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\LegalDocuments\Table\DocumentTable::getTotalRowCount ( ?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 174 of file DocumentTable.php.

References ILIAS\UI\examples\Deck\repository().

174  : ?int
175  {
176  return $this->repository->countAll();
177  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:

◆ render()

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

Definition at line 179 of file DocumentTable.php.

179  : string
180  {
181  return $this->ui_renderer->render($this->table);
182  }

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

Definition at line 56 of file DocumentTable.php.

◆ $request

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

Definition at line 55 of file DocumentTable.php.

◆ $table

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

◆ $ui_renderer

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

Definition at line 59 of file DocumentTable.php.

◆ $user

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

Definition at line 60 of file DocumentTable.php.

◆ $usr_timezone

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: