ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 
36  $data_retrieval = new class ($dummy_records) implements I\DataRetrieval {
37  protected array $records;
38 
39  public function __construct(
40  array $dummy_records
41  ) {
42  $this->records = $dummy_records;
43  }
44 
45  public function getRows(
46  I\DataRowBuilder $row_builder,
47  array $visible_column_ids,
48  Range $range,
49  Order $order,
50  ?array $filter_data,
51  ?array $additional_parameters
52  ): \Generator {
53  foreach ($this->records as $number) {
54  $row_id = '';
55  $record['b1'] = $number > 10;
56  $record['b2'] = $record['b1'];
57  $record['b3'] = $record['b1'];
58  $record['b4'] = $record['b1'];
59  yield $row_builder->buildDataRow($row_id, $record);
60  }
61  }
62 
63  public function getTotalRowCount(
64  ?array $filter_data,
65  ?array $additional_parameters
66  ): ?int {
67  return count($this->records);
68  }
69  };
70 
71  $table = $f->table()->data('Boolean Columns', $columns, $data_retrieval)
72  ->withRequest($DIC->http()->request());
73  return $r->render($table);
74 }
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
A simple class to express a range of whole positive numbers.
Definition: Range.php:30
$r