ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
TableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\UI\Factory as UIFactory;
24use ILIAS\UI\Component\Table\Data as DataTable;
25use ilLanguage;
26use ILIAS\HTTP\Services as HTTP;
30
32{
33 public const string TYPE_COLUMN = 'type';
34 public const string TITLE_COLUMN = 'title';
35 public const string DESCRIPTION_COLUMN = 'description';
36 public const string WRITABLE_COLUMN = 'writable';
37 public const string DEASSIGN_ACTION = 'shareDeassign';
38
39 public function __construct(
40 protected DataRetrieval $data_retrieval,
41 protected ilLanguage $lng,
42 protected UIFactory $ui_factory,
43 protected HTTP $http
44 ) {
45 }
46
47 public function get(
48 URLBuilder $url_builder,
49 URLBuilderToken $id_token,
50 URLBuilderToken $action_token
51 ): DataTable {
52 $columns = [];
53 $columns[self::TYPE_COLUMN] = $this->ui_factory->table()->column()->statusIcon(
54 $this->lng->txt('type')
55 )->withIsSortable(true);
56 $columns[self::TITLE_COLUMN] = $this->ui_factory->table()->column()->text(
57 $this->lng->txt('title')
58 )->withIsSortable(true);
59 $columns[self::DESCRIPTION_COLUMN] = $this->ui_factory->table()->column()->text(
60 $this->lng->txt('description')
61 )->withIsSortable(false);
62 $columns[self::WRITABLE_COLUMN] = $this->ui_factory->table()->column()->status(
63 $this->lng->txt('cal_shared_access_table_col')
64 )->withIsSortable(true);
65
66 $actions = [];
67 $actions[self::DEASSIGN_ACTION] = $this->ui_factory->table()->action()->standard(
68 $this->lng->txt('cal_unshare_cal'),
69 $url_builder->withParameter($action_token, self::DEASSIGN_ACTION),
70 $id_token
71 );
72
73 return $this->ui_factory->table()->data(
74 $this->data_retrieval,
75 $this->lng->txt('cal_cal_shared_with'),
76 $columns
77 )->withActions($actions)->withRequest($this->http->request());
78 }
79}
__construct(protected DataRetrieval $data_retrieval, protected ilLanguage $lng, protected UIFactory $ui_factory, protected HTTP $http)
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Class Services.
Definition: Services.php:43
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
Definition: URLBuilder.php:166
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