ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
Handler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\Data\Factory as DataFactory;
25use ILIAS\HTTP\Services as HTTPServices;
28use ILIAS\UI\Component\Table\Data as DataTable;
29use ilLanguage;
30
31readonly class Handler implements HandlerInterface
32{
33 protected const string TABLE_ID = "sc_groups";
34 public const string TABLE_COL_TITLE = 'title';
35 public const string TABLE_COL_DESCRIPTION = 'description';
36 public const string TABLE_COL_LAST_UPDATE = 'last_update';
37 public const string TABLE_COL_SOLVED_TASKS = 'sysc_completed_num';
38 public const string TABLE_COL_UNSOLVED_TASKS = 'sysc_failed_num';
39 protected const string LNG_TABLE_COL_TITLE = 'title';
40 protected const string LNG_TABLE_COL_DESCRIPTION = 'description';
41 protected const string LNG_TABLE_COL_LAST_UPDATE = 'last_update';
42 protected const string LNG_TABLE_COL_SOLVED_TASKS = 'sysc_completed_num';
43 protected const string LNG_TABLE_COL_UNSOLVED_TASKS = 'sysc_failed_num';
44 protected const string LNG_TABLE_TITLE = 'sysc_overview';
45
46 protected DataTable $table;
47
48 public function __construct(
49 protected DataFactory $data_factory,
50 protected UIServices $ui,
51 protected ilLanguage $lng,
52 protected HTTPServices $http,
53 protected DataRetrievalInterface $data_retrieval
54 ) {
55 }
56
57 final protected function getColumns(): array
58 {
59 return [
60 self::TABLE_COL_TITLE => $this->ui->factory()->table()->column()->link(
61 $this->lng->txt(self::LNG_TABLE_COL_TITLE)
62 )->withIsSortable(true),
63 self::TABLE_COL_DESCRIPTION => $this->ui->factory()->table()->column()->text(
64 $this->lng->txt(self::LNG_TABLE_COL_DESCRIPTION)
65 )->withIsSortable(true),
66 self::TABLE_COL_LAST_UPDATE => $this->ui->factory()->table()->column()->text(
67 $this->lng->txt(self::LNG_TABLE_COL_LAST_UPDATE)
68 )->withIsSortable(true),
69 self::TABLE_COL_SOLVED_TASKS => $this->ui->factory()->table()->column()->number(
70 $this->lng->txt(self::LNG_TABLE_COL_SOLVED_TASKS)
71 )->withIsSortable(true),
72 self::TABLE_COL_UNSOLVED_TASKS => $this->ui->factory()->table()->column()->number(
73 $this->lng->txt(self::LNG_TABLE_COL_UNSOLVED_TASKS)
74 )->withIsSortable(true)
75 ];
76 }
77
78 final protected function getTable(): DataTable
79 {
80 if (!isset($this->table)) {
81 $this->table = $this->ui->factory()->table()->data(
82 $this->data_retrieval,
83 $this->lng->txt(self::LNG_TABLE_TITLE),
84 $this->getColumns(),
85 )->withId(self::TABLE_ID)->withRequest($this->http->request());
86 }
87 return $this->table;
88 }
89
90 final public function getHTML(): string
91 {
92 return $this->ui->renderer()->render([$this->getTable()]);
93 }
94}
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
Builds data types.
Definition: Factory.php:36
Class Services.
Definition: Services.php:43
__construct(protected DataFactory $data_factory, protected UIServices $ui, protected ilLanguage $lng, protected HTTPServices $http, protected DataRetrievalInterface $data_retrieval)
Definition: Handler.php:48
language handling
This describes a Data Table.
Definition: Data.php:33
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:26