ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
large.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
10use Psr\Http\Message\ServerRequestInterface;
14
28function large()
29{
30 global $DIC;
31
35 $f = $DIC['ui.factory'];
36
40 $r = $DIC['ui.renderer'];
41
45 $refinery = $DIC['refinery'];
46 $df = new \ILIAS\Data\Factory();
47 $request = $DIC->http()->request();
48 $request_wrapper = $DIC->http()->wrapper()->query();
49
50 $columns = [
51 'entry' => $f->table()->column()->text("some entry")
52 ];
53
54 $url_builder = new URLBuilder($df->uri($request->getUri()->__toString()));
55 $query_params_namespace = ['datatable', 'example', 'large'];
56 list($url_builder, $action_parameter_token, $row_id_token) = $url_builder->acquireParameters(
57 $query_params_namespace,
58 "table_action",
59 "a_quiet_longish_parameter_name_to_quickly_exceed_url_limits"
60 );
61
62 $actions = [
63 $f->table()->action()->standard(
64 'some action',
65 $url_builder->withParameter($action_parameter_token, "edit"),
66 $row_id_token
67 )
68 ];
69
70 $data_retrieval = new class ($f, $r) implements I\DataRetrieval {
71 protected array $records;
72
73 public function __construct(
74 protected \ILIAS\UI\Factory $ui_factory,
75 protected \ILIAS\UI\Renderer $ui_renderer
76 ) {
77 $this->records = $this->initRecords();
78 }
79
80 public function getRows(
81 I\DataRowBuilder $row_builder,
82 array $visible_column_ids,
83 Range $range,
84 Order $order,
85 ?array $filter_data,
86 ?array $additional_parameters
87 ): \Generator {
88 $records = array_values($this->records);
89 foreach ($this->records as $record) {
90 $row_id = (string) $record['id'];
91 yield $row_builder->buildDataRow($row_id, $record);
92 }
93 }
94
95 public function getTotalRowCount(
96 ?array $filter_data,
97 ?array $additional_parameters
98 ): ?int {
99 return count($this->records);
100 }
101
102 protected function initRecords(): array
103 {
104 $records = [];
105 foreach (array_map('strval', range(0, 9)) as $r) {
106 $id = str_repeat($r, 1000);
107 $records[$id] = [
108 'id' => $id,
109 'entry' => substr($id, 0, 50),
110 ];
111 }
112 return $records;
113 }
114 };
115
116 $target = (new URI((string) $request->getUri()))->withParameter('ordering_example', 4);
117 $table = $f->table()->data($data_retrieval, 'large ids data table', $columns)
118 ->withActions($actions)
119 ->withRequest($request);
120
121 return $r->render($table);
122}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26