ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
PageLayoutRetrieval.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2023 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5declare(strict_types=1);
6
7namespace ILIAS\COPage\Layout;
8
12use ILIAS\Repository\RetrievalBase;
13use ilPageLayout;
14
16{
17 use RetrievalBase;
18
19 public function getData(
20 array $fields,
21 ?Range $range = null,
22 ?Order $order = null,
23 array $filter = [],
24 array $parameters = []
25 ): \Generator {
26 $data = $this->collectData();
27
28 // Apply ordering if specified
29 $data = $this->applyOrder($data, $order);
30
31 // Apply range (pagination) if specified
32 $data = $this->applyRange($data, $range);
33
34 foreach ($data as $row) {
35 yield $row;
36 }
37 }
38
39 public function count(
40 array $filter,
41 array $parameters
42 ): int {
43 return count($this->collectData());
44 }
45
46 protected function collectData(): array
47 {
49 foreach ($data as $k => $v) {
50 $data[$k]["id"] = $v["layout_id"];
51 }
52 return $data;
53 }
54
55 public function isFieldNumeric(string $field): bool
56 {
57 return $field === "layout_id" || $field === "id";
58 }
59}
getData(array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
count(array $filter, array $parameters)
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...
static getLayoutsAsArray(int $a_active=0)
return['delivery_method'=> 'php',]
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...