ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ContainerFilterRetrieval.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 
29 {
30  use RetrievalBase;
31 
32  public function __construct(
33  protected \ilContainerFilterService $container_filter_service,
34  protected int $ref_id
35  ) {
36  }
37 
38  public function getData(
39  array $fields,
40  ?Range $range = null,
41  ?Order $order = null,
42  array $filter = [],
43  array $parameters = []
44  ): \Generator {
45  $service = $this->container_filter_service;
46  $items = array_map(static function (\ilContainerFilterField $i) use ($service): array {
47  return [
48  "id" => $i->getRecordSetId() . ":" . $i->getFieldId(),
49  "record_set_id" => $i->getRecordSetId(),
50  "record_title" => $service->util()->getContainerRecordTitle($i->getRecordSetId()),
51  "field_title" => $service->util()->getContainerFieldTitle($i->getRecordSetId(), $i->getFieldId())
52  ];
53  }, $service->data()->getFilterSetForRefId($this->ref_id)->getFields());
54 
55  $items = $this->applyOrder($items, $order);
56  $items = $this->applyRange($items, $range);
57 
58  foreach ($items as $item) {
59  yield $item;
60  }
61  }
62 
63  public function count(
64  array $filter,
65  array $parameters
66  ): int {
67  $service = $this->container_filter_service;
68  return count($service->data()->getFilterSetForRefId($this->ref_id)->getFields());
69  }
70 
71  public function isFieldNumeric(string $field): bool
72  {
73  return in_array($field, ["record_set_id"]);
74  }
75 }
__construct(protected \ilContainerFilterService $container_filter_service, protected int $ref_id)
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:28
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
getData(array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28
$service
Definition: ltiservices.php:40