ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ObjectsRetrieval.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 use ilObject;
29 use ilObjectFactory;
31 
33 {
34  use RetrievalBase;
35 
36  public function __construct(
37  protected ilContainerStartObjects $start_objects
38  ) {
39  }
40 
41  public function getData(
42  array $fields,
43  ?Range $range = null,
44  ?Order $order = null,
45  array $filter = [],
46  array $parameters = []
47  ): \Generator {
48  foreach ($this->start_objects->getStartObjects() as $start_id => $item) {
49  $data = [];
50  $tmp_obj = ilObjectFactory::getInstanceByRefId($item['item_ref_id']);
51 
52  $data['id'] = $start_id;
53  $data['title'] = $tmp_obj->getTitle();
54  $data['type'] = $tmp_obj->getType();
55 
56  if ($tmp_obj->getDescription() !== '') {
57  $data['description'] = $tmp_obj->getDescription();
58  }
59 
60  yield $data;
61  }
62  }
63 
64  public function count(
65  array $filter,
66  array $parameters
67  ): int {
68  return count($this->start_objects->getStartObjects());
69  }
70 
71  public function isFieldNumeric(string $field): bool
72  {
73  return $field === 'id';
74  }
75 }
getData(array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
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
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
__construct(protected ilContainerStartObjects $start_objects)
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28