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