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  $columns = [
19  't1' => $f->table()->column()->text("some text")
20  ];
21 
22  $dummy_records = [
23  ['t1' => 'this is some text'],
24  ['t1' => 'this is some other text']
25  ];
26 
27  $data_retrieval = new class ($dummy_records) implements I\DataRetrieval {
28  protected array $records;
29 
30  public function __construct(array $dummy_records)
31  {
32  $this->records = $dummy_records;
33  }
34 
35  public function getRows(
36  I\DataRowBuilder $row_builder,
37  array $visible_column_ids,
38  Range $range,
39  Order $order,
40  ?array $filter_data,
41  ?array $additional_parameters
42  ): \Generator {
43  foreach ($this->records as $idx => $record) {
44  $row_id = '';
45  yield $row_builder->buildDataRow($row_id, $record);
46  }
47  }
48 
49  public function getTotalRowCount(
50  ?array $filter_data,
51  ?array $additional_parameters
52  ): ?int {
53  return count($this->records);
54  }
55  };
56 
57  $table = $f->table()->data('Text Columns', $columns, $data_retrieval)
58  ->withRequest($DIC->http()->request());
59  return $r->render($table);
60 }
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