ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ContainerFilterRetrieval.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ILIAS\Repository\RetrievalBase;
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}
getData(array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
__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:29
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
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...
$ref_id
Definition: ltiauth.php:66
$service
Definition: ltiresult.php:36