ILIAS  release_8 Revision v8.24
base.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
11
12function base()
13{
14 global $DIC;
15 $f = $DIC['ui.factory'];
16 $r = $DIC['ui.renderer'];
17
18 $dummy_records = [23, 45, 67];
19
20 $columns = [
21 'i1' => $f->table()->column()->statusIcon("icon"),
22 'i2' => $f->table()->column()->statusIcon("chart")
23 ];
24
25 $data_retrieval = new class ($f, $r, $dummy_records) implements I\DataRetrieval {
26 protected \ILIAS\UI\Factory $ui_factory;
27 protected \ILIAS\UI\Renderer $ui_renderer;
28 protected array $records;
29
30 public function __construct(
31 \ILIAS\UI\Factory $ui_factory,
32 \ILIAS\UI\Renderer $ui_renderer,
33 array $records
34 ) {
35 $this->ui_factory = $ui_factory;
36 $this->ui_renderer = $ui_renderer;
37 $this->records = $records;
38 }
39
40 public function getRows(
41 I\DataRowBuilder $row_builder,
42 array $visible_column_ids,
43 Range $range,
44 Order $order,
45 ?array $filter_data,
46 ?array $additional_parameters
47 ): \Generator {
48 foreach ($this->records as $number) {
49 $row_id = '';
50 $record['i1'] = $this->ui_factory->symbol()->icon()->standard('crs', '', 'small');
51 $record['i2'] = $this->ui_factory->symbol()->icon()->custom(
52 'templates/default/images/standard/icon_checked.svg',
53 '',
54 'small'
55 );
56 yield $row_builder->buildDataRow($row_id, $record);
57 }
58 }
59
60 public function getTotalRowCount(
61 ?array $filter_data,
62 ?array $additional_parameters
63 ): ?int {
64 return count($this->records);
65 }
66 };
67
68 $table = $f->table()->data('StatusIcons Columns', $columns, $data_retrieval)
69 ->withRequest($DIC->http()->request());
70 return $r->render($table);
71}
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:13
A simple class to express a range of whole positive numbers.
Definition: Range.php:31
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:62
global $DIC
Definition: feed.php:28
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
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...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.