ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 mixed $additional_viewcontrol_data,
86 mixed $filter_data,
87 mixed $additional_parameters
88 ): \Generator {
89 $records = array_values($this->records);
90 foreach ($this->records as $record) {
91 $row_id = (string) $record['id'];
92 yield $row_builder->buildDataRow($row_id, $record);
93 }
94 }
95
96 public function getTotalRowCount(
97 mixed $additional_viewcontrol_data,
98 mixed $filter_data,
99 mixed $additional_parameters
100 ): ?int {
101 return count($this->records);
102 }
103
104 protected function initRecords(): array
105 {
106 $records = [];
107 foreach (array_map('strval', range(0, 9)) as $r) {
108 $id = str_repeat($r, 1000);
109 $records[$id] = [
110 'id' => $id,
111 'entry' => substr($id, 0, 50),
112 ];
113 }
114 return $records;
115 }
116 };
117
118 $target = (new URI((string) $request->getUri()))->withParameter('ordering_example', 4);
119 $table = $f->table()->data($data_retrieval, 'large ids data table', $columns)
120 ->withActions($actions)
121 ->withRequest($request);
122
123 return $r->render($table);
124}
$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