ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
11 
18 function base()
19 {
20  global $DIC;
21  $f = $DIC['ui.factory'];
22  $r = $DIC['ui.renderer'];
23 
24  $dummy_records = [2, 13, 4, 5, 16, 17];
25 
26  $columns = [
27  'b1' => $f->table()->column()->boolean('yes/no', 'yes', 'no'),
28  'b2' => $f->table()->column()->boolean("0/1", "1", "0"),
29  'b3' => $f->table()->column()->boolean(
30  "icon",
31  $f->symbol()->icon()->custom('assets/images/standard/icon_checked.svg', '', 'small'),
32  $f->symbol()->icon()->custom('assets/images/standard/icon_unchecked.svg', '', 'small')
33  ),
34  'b4' => $f->table()->column()->boolean(
35  "glyph",
36  $f->symbol()->glyph()->like(),
37  $f->symbol()->glyph()->dislike()->withHighlight()
38  )
39 
40  ];
41 
42  $data_retrieval = new class ($dummy_records) implements I\DataRetrieval {
43  protected array $records;
44 
45  public function __construct(
46  array $dummy_records
47  ) {
48  $this->records = $dummy_records;
49  }
50 
51  public function getRows(
52  I\DataRowBuilder $row_builder,
53  array $visible_column_ids,
54  Range $range,
55  Order $order,
56  ?array $filter_data,
57  ?array $additional_parameters
58  ): \Generator {
59  foreach ($this->records as $number) {
60  $row_id = '';
61  $record['b1'] = $number > 10;
62  $record['b2'] = $record['b1'];
63  $record['b3'] = $record['b1'];
64  $record['b4'] = $record['b1'];
65  yield $row_builder->buildDataRow($row_id, $record);
66  }
67  }
68 
69  public function getTotalRowCount(
70  ?array $filter_data,
71  ?array $additional_parameters
72  ): ?int {
73  return count($this->records);
74  }
75  };
76 
77  $table = $f->table()->data('Boolean Columns', $columns, $data_retrieval)
78  ->withRequest($DIC->http()->request());
79  return $r->render($table);
80 }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:12
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76
global $DIC
Definition: shib_login.php:25
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28
base()
expected output: > ILIAS shows the rendered Component.
Definition: base.php:18
$r