ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
OrderingRetrieval.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
27class OrderingRetrieval implements Table\OrderingRetrieval
28{
29 public function __construct(
30 protected RetrievalInterface $retrieval,
31 protected array $actions,
32 protected ?\Closure $active_action_closure,
33 protected ?\Closure $row_transformer
34 ) {
35 }
36
37 public function getRows(
38 OrderingRowBuilder $row_builder,
39 array $visible_column_ids
40 ): \Generator {
41 foreach ($this->retrieval->getData(
42 $visible_column_ids
43 ) as $data) {
44 if ($this->row_transformer) {
45 $table_data = ($this->row_transformer)($data);
46 } else {
47 $table_data = $data;
48 }
49 $row = $row_builder->buildOrderingRow((string) $data["id"], $table_data);
50 if ($this->active_action_closure) {
51 foreach ($this->actions as $action) {
52 if (!($this->active_action_closure)($action, $data)) {
53 $row = $row->withDisabledAction($action);
54 }
55 }
56 }
57 yield $row;
58 }
59 }
60}
getRows(OrderingRowBuilder $row_builder, array $visible_column_ids)
__construct(protected RetrievalInterface $retrieval, protected array $actions, protected ?\Closure $active_action_closure, protected ?\Closure $row_transformer)
buildOrderingRow(string $id, array $record)