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 $columns = [
41 't1' => $f->table()->column()->text("some text")
42 ];
43
44 $dummy_records = [
45 ['t1' => 'this is some text'],
46 ['t1' => 'this is some other text']
47 ];
48
49 $data_retrieval = new class ($dummy_records) implements I\DataRetrieval {
50 protected array $records;
51
52 public function __construct(array $dummy_records)
53 {
54 $this->records = $dummy_records;
55 }
56
57 public function getRows(
58 I\DataRowBuilder $row_builder,
59 array $visible_column_ids,
61 Order $order,
62 mixed $additional_viewcontrol_data,
63 mixed $filter_data,
64 mixed $additional_parameters
65 ): \Generator {
66 foreach ($this->records as $idx => $record) {
67 $row_id = '';
68 yield $row_builder->buildDataRow($row_id, $record);
69 }
70 }
71
72 public function getTotalRowCount(
73 mixed $additional_viewcontrol_data,
74 mixed $filter_data,
75 mixed $additional_parameters
76 ): ?int {
77 return count($this->records);
78 }
79 };
80
81 $table = $f->table()->data($data_retrieval, 'Text Columns', $columns)
82 ->withRequest($DIC->http()->request());
83 return $r->render($table);
84}
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