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
26use ILIAS\HTTP\Services as HTTPServices;
27use ILIAS\UI\Component\Table\Data as DataTable;
28use ilLanguage;
29
30class Handler implements HandlerInterface
31{
32 protected const string LNG_TABLE_COL_TITLE = 'title';
33 protected const string LNG_TABLE_COL_SUGGESTION = 'crs_timings_short_start_end';
34 protected const string LNG_TABLE_COL_TIMINGS_PLANNED = 'crs_timings_planned_start';
35 protected const string LNG_TABLE_TITLE = 'timings_of';
36 protected const string TABLE_ID = 'tmgsvw';
37
38 protected DataTable $table;
39
40 public function __construct(
41 protected readonly UIServices $ui,
42 protected readonly HTTPServices $http,
43 protected readonly DataRetrievalInterface $data_retrieval,
44 protected readonly ilLanguage $lng,
45 ) {
46 }
47
48 final protected function getColumns(): array
49 {
50 return [
51 self::TABLE_COL_TITLE => $this->ui->factory()->table()->column()->link(
52 $this->lng->txt(self::LNG_TABLE_COL_TITLE)
53 ),
54 self::TABLE_COL_SUGGESTION => $this->ui->factory()->table()->column()->timeSpan(
55 $this->lng->txt(self::LNG_TABLE_COL_SUGGESTION),
56 $this->data_retrieval->getDateFormat()
57 ),
58 self::TABLE_COL_TIMINGS_PLANNED => $this->ui->factory()->table()->column()->timeSpan(
59 $this->lng->txt(self::LNG_TABLE_COL_TIMINGS_PLANNED),
60 $this->data_retrieval->getDateFormat()
61 )
62 ];
63 }
64
65 final protected function buildTableTitle(): string
66 {
67 return $this->lng->txt(self::LNG_TABLE_TITLE) . ': ' . $this->data_retrieval->getUsername();
68 }
69
70 final protected function initTable(): void
71 {
72 if (isset($this->table)) {
73 return;
74 }
75 $this->table = $this->ui->factory()->table()->data(
76 $this->data_retrieval,
77 $this->buildTableTitle(),
78 $this->getColumns(),
79 )
80 ->withId(self::TABLE_ID)
81 ->withRequest($this->http->request());
82 }
83
84 final public function getHTML(): string
85 {
86 $this->initTable();
87 return $this->ui->renderer()->render([$this->table]);
88 }
89}
__construct(protected readonly UIServices $ui, protected readonly HTTPServices $http, protected readonly DataRetrievalInterface $data_retrieval, protected readonly ilLanguage $lng,)
Definition: Handler.php:40
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
Class Services.
Definition: Services.php:43
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