ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
OrderingRetrieval.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Repository\Table;
22 
26 
27 class 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 }
__construct(protected RetrievalInterface $retrieval, protected array $actions, protected ?\Closure $active_action_closure, protected ?\Closure $row_transformer)
getRows(OrderingRowBuilder $row_builder, array $visible_column_ids)
buildOrderingRow(string $id, array $record)