ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
TableRetrieval.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27
28class TableRetrieval implements Table\DataRetrieval
29{
30 public function __construct(
31 protected RetrievalInterface $retrieval,
32 protected array $actions,
33 protected ?\Closure $active_action_closure,
34 protected ?\Closure $row_transformer
35 ) {
36 }
37
38 public function getRows(
39 Table\DataRowBuilder $row_builder,
40 array $visible_column_ids,
42 Order $order,
43 mixed $additional_viewcontrol_data,
44 mixed $filter_data,
45 mixed $additional_parameters
46 ): \Generator {
47 foreach ($this->retrieval->getData(
48 $visible_column_ids,
49 $range,
50 $order,
51 $filter_data ?? [],
52 $additional_parameters ?? []
53 ) as $data) {
54 if ($this->row_transformer) {
55 $table_data = ($this->row_transformer)($data);
56 } else {
57 $table_data = $data;
58 }
59 $row = $row_builder->buildDataRow((string) $data["id"], $table_data);
60 if ($this->active_action_closure) {
61 foreach ($this->actions as $action) {
62 if (!($this->active_action_closure)($action, $data)) {
63 $row = $row->withDisabledAction($action);
64 }
65 }
66 }
67 yield $row;
68 }
69 }
70
71 public function getTotalRowCount(
72 mixed $additional_viewcontrol_data,
73 mixed $filter_data,
74 mixed $additional_parameters
75 ): ?int {
76 return $this->retrieval->count(
77 $filter_data ?? [],
78 $additional_parameters ?? []
79 );
80 }
81}
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
getTotalRowCount(mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
getRows(Table\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
__construct(protected RetrievalInterface $retrieval, protected array $actions, protected ?\Closure $active_action_closure, protected ?\Closure $row_transformer)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...