ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
disabled.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 use ILIAS\Data\URI;
26 
37 function disabled()
38 {
39  global $DIC;
40 
44  $f = $DIC['ui.factory'];
45 
49  $r = $DIC['ui.renderer'];
50 
51  $request = $DIC->http()->request();
52 
53  $columns = [
54  'id' => $f->table()->column()->number("ID"),
55  'letter' => $f->table()->column()->text("Letter")
56  ->withHighlight(true)
57  ];
58 
59  $data_retrieval = new class ($f, $r) implements I\OrderingRetrieval {
60  protected array $records;
61 
62  public function __construct(
63  protected \ILIAS\UI\Factory $ui_factory,
64  protected \ILIAS\UI\Renderer $ui_renderer
65  ) {
66  $this->records = $this->initRecords();
67  }
68 
69  public function getRows(
70  I\OrderingRowBuilder $row_builder,
71  array $visible_column_ids
72  ): \Generator {
73  foreach (array_values($this->records) as $record) {
74  yield $row_builder->buildOrderingRow((string) $record['id'], $record);
75  }
76  }
77 
78  protected function initRecords(): array
79  {
80  $r = range(65, 68);
81  shuffle($r);
82  return array_map(fn($id) => ['id' => $id,'letter' => chr($id)], $r);
83  }
84  };
85 
89  $target = (new URI((string) $request->getUri()));
90  $table = $f->table()->ordering($data_retrieval, $target, 'ordering table with disabled ordering', $columns)
91  ->withOrderingDisabled(true)
92  ->withRequest($request);
93 
94  return $r->render($table);
95 }
Interface Observer Contains several chained tasks and infos about them.
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76
global $DIC
Definition: shib_login.php:22
disabled()
description: > This example shows how to create and render a disabled URL input field and attach it ...
Definition: disabled.php:34
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$r