ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 
34 function 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,
70  Range $range,
71  Order $order,
72  ?array $filter_data,
73  ?array $additional_parameters
74  ): \Generator {
75  foreach ($this->records as $number) {
76  $row_id = '';
77  $record['b1'] = $number > 10;
78  $record['b2'] = $record['b1'];
79  $record['b3'] = $record['b1'];
80  $record['b4'] = $record['b1'];
81  yield $row_builder->buildDataRow($row_id, $record);
82  }
83  }
84 
85  public function getTotalRowCount(
86  ?array $filter_data,
87  ?array $additional_parameters
88  ): ?int {
89  return count($this->records);
90  }
91  };
92 
93  $table = $f->table()->data($data_retrieval, 'Boolean Columns', $columns)
94  ->withRequest($DIC->http()->request());
95  return $r->render($table);
96 }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:28
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76
global $DIC
Definition: shib_login.php:22
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:34
$r