19declare(strict_types=1);
26use Psr\Http\Message\ServerRequestInterface;
53 $r =
$DIC[
'ui.renderer'];
59 $df = new \ILIAS\Data\Factory();
60 $request =
$DIC->http()->request();
67 'word' =>
$f->table()->column()->text(
"Word")
68 ->withHighlight(
true),
69 'phrase' =>
$f->table()->column()->text(
"Phrase")
70 ->withIsOptional(
true,
false)
78 $url_builder =
new URLBuilder($df->uri($request->getUri()->__toString()));
79 $query_params_namespace = [
'orderingtable',
'example'];
80 list($url_builder, $action_parameter_token, $row_id_token) = $url_builder->acquireParameters(
81 $query_params_namespace,
86 $f->table()->action()->standard(
88 $url_builder->withParameter($action_parameter_token,
"edit"),
97 $data_retrieval =
new class (
$f, $r) implements
I\OrderingRetrieval {
98 protected array $records;
104 $this->records = $this->initRecords();
107 public function getRows(
108 I\OrderingRowBuilder $row_builder,
109 array $visible_column_ids
111 $records = array_values($this->records);
112 foreach ($this->records as $position_index => $record) {
113 $row_id = (string) $record[
'id'];
114 yield $row_builder->buildOrderingRow($row_id, $record);
118 protected function initRecords(): array
121 [
'A is for apple',
'it’s red and its green'],
122 [
'B is for ball',
'and it bounces between'],
123 [
'C is for cat',
'it’s licking its paws'],
124 [
'D is for dog',
'it loves playing with balls'],
125 [
'E is for elephant',
'bigger than me'],
126 [
'F is for fish',
'he’s missing the sea'],
127 [
'G for gorilla',
'he’s big and he’s strong'],
128 [
'H is for home',
'and that’s where I belong'],
129 [
'I is for insect',
'flying around'],
130 [
'J is for jumping',
'jump up and down'],
134 foreach ($r as $record) {
135 list($word, $phrase) = $record;
136 $id = substr($word, 0, 1);
149 public function setOrder(array $ordered): void
152 foreach ($ordered as
$id) {
153 $r[(string)
$id] = $this->records[(
string)
$id];
160 $target = (
new URI((
string) $request->getUri()))->withParameter(
'ordering_example', 1);
161 $table =
$f->table()->ordering($data_retrieval, $target,
'ordering table', $columns)
162 ->withActions($actions)
163 ->withRequest($request);
166 if ($request->getMethod() ==
"POST"
170 if (
$data = $table->getData()) {
171 $out[] =
$f->legacy()->content(
'<pre>' . print_r(
$data,
true) .
'</pre>');
173 $data_retrieval->setOrder(
$data);
177 return $r->render(
$out);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
The scope of this class is split ilias-conform URI's into components.
__construct()
Constructor setup ILIAS global object @access public.
An entity that renders components to a string output.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.