19declare(strict_types=1);
50 $r =
$DIC[
'ui.renderer'];
57 $df = new \ILIAS\Data\Factory();
58 $request =
$DIC->http()->request();
62 'id' =>
$f->table()->column()->number(
"ID"),
63 'letter' =>
$f->table()->column()->text(
"Letter")
67 $data_retrieval =
new class (
$f, $r) implements
I\OrderingRetrieval {
68 protected array $records;
71 protected \
ILIAS\UI\Factory $ui_factory,
72 protected \
ILIAS\UI\Renderer $ui_renderer
74 $this->records = $this->initRecords();
77 public function getRows(
78 I\OrderingRowBuilder $row_builder,
79 array $visible_column_ids
81 $records = array_values($this->records);
82 foreach ($this->records as $position_index => $record) {
83 yield $row_builder->buildOrderingRow((
string) $record[
'id'], $record);
87 protected function initRecords(): array
93 $records[(string)
$id] = [
'id' =>
$id,
'letter' => chr(
$id)];
101 public function setOrder(array $ordered): void
104 foreach ($ordered as
$id) {
105 $r[(string)
$id] = $this->records[(
string)
$id];
116 $target = (
new URI((
string) $request->getUri()))->withParameter(
'ordering_example', 3);
117 $table =
$f->table()->ordering($data_retrieval, $target,
'sort the letters', $columns)
118 ->withRequest($request);
124 if ($request->getMethod() ==
"POST"
128 $data = $table->withRequest($request)->getData();
129 if (
$data === range(65, 68)) {
130 $data_retrieval->setOrder(
$data);
131 $out[] =
$f->messageBox()->success(
"ok. great ordering!");
133 $out[] =
$f->messageBox()->failure(
"nah. try again.");
137 return $r->render(
$out);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
The scope of this class is split ilias-conform URI's into components.
__construct()
Constructor setup ILIAS global object @access public.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.