ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
base.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27
34function base()
35{
36 global $DIC;
37 $f = $DIC['ui.factory'];
38 $r = $DIC['ui.renderer'];
39
40 $dummy_records = [2, 13, 4, 5, 16, 17];
41
42 $columns = [
43 'b1' => $f->table()->column()->boolean('yes/no', 'yes', 'no'),
44 'b2' => $f->table()->column()->boolean("0/1", "1", "0"),
45 'b3' => $f->table()->column()->boolean(
46 "icon",
47 $f->symbol()->icon()->custom('assets/images/standard/icon_checked.svg', '', 'small'),
48 $f->symbol()->icon()->custom('assets/images/standard/icon_unchecked.svg', '', 'small')
49 ),
50 'b4' => $f->table()->column()->boolean(
51 "glyph",
52 $f->symbol()->glyph()->like(),
53 $f->symbol()->glyph()->dislike()->withHighlight()
54 )
55
56 ];
57
58 $data_retrieval = new class ($dummy_records) implements I\DataRetrieval {
59 protected array $records;
60
61 public function __construct(
62 array $dummy_records
63 ) {
64 $this->records = $dummy_records;
65 }
66
67 public function getRows(
68 I\DataRowBuilder $row_builder,
69 array $visible_column_ids,
71 Order $order,
72 mixed $additional_viewcontrol_data,
73 mixed $filter_data,
74 mixed $additional_parameters
75 ): \Generator {
76 foreach ($this->records as $number) {
77 $row_id = '';
78 $record['b1'] = $number > 10;
79 $record['b2'] = $record['b1'];
80 $record['b3'] = $record['b1'];
81 $record['b4'] = $record['b1'];
82 yield $row_builder->buildDataRow($row_id, $record);
83 }
84 }
85
86 public function getTotalRowCount(
87 mixed $additional_viewcontrol_data,
88 mixed $filter_data,
89 mixed $additional_parameters
90 ): ?int {
91 return count($this->records);
92 }
93 };
94
95 $table = $f->table()->data($data_retrieval, 'Boolean Columns', $columns)
96 ->withRequest($DIC->http()->request());
97 return $r->render($table);
98}
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
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76