ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
TableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Calendar\Manage;
22
23use ILIAS\UI\Factory as UIFactory;
24use ILIAS\UI\Component\Table\Data as DataTable;
25use ilLanguage;
26use ILIAS\HTTP\Services as HTTP;
29
31{
32 public const string TYPE_COLUMN = 'type';
33 public const string TITLE_COLUMN = 'title';
34
35 public const string ACTION_EDIT = 'edit';
36 public const string ACTION_IMPORT = 'import';
37 public const string ACTION_SHARE = 'share';
38 public const string ACTION_SYNCHRONIZE = 'synchronize';
39 public const string ACTION_DELETE = 'delete';
40
41 public function __construct(
42 protected DataRetrieval $data_retrieval,
43 protected ilLanguage $lng,
44 protected UIFactory $ui_factory,
45 protected HTTP $http
46 ) {
47 }
48
49 public function get(
50 URLBuilder $url_builder,
51 URLBuilderToken $id_token,
52 URLBuilderToken $action_token
53 ): DataTable {
54 $columns = [];
55 $columns[self::TYPE_COLUMN] = $this->ui_factory->table()->column()->statusIcon(
56 $this->lng->txt('type')
57 )->withIsSortable(true);
58 $columns[self::TITLE_COLUMN] = $this->ui_factory->table()->column()->text(
59 $this->lng->txt('title')
60 )->withIsSortable(true);
61
62 $actions = [];
63 $actions[self::ACTION_EDIT] = $this->ui_factory->table()->action()->standard(
64 $this->lng->txt('settings'),
65 $url_builder->withParameter($action_token, self::ACTION_EDIT),
66 $id_token
67 );
68 $actions[self::ACTION_IMPORT] = $this->ui_factory->table()->action()->standard(
69 $this->lng->txt('cal_import_appointments'),
70 $url_builder->withParameter($action_token, self::ACTION_IMPORT),
71 $id_token
72 );
73 $actions[self::ACTION_SHARE] = $this->ui_factory->table()->action()->standard(
74 $this->lng->txt('cal_share'),
75 $url_builder->withParameter($action_token, self::ACTION_SHARE),
76 $id_token
77 );
78 $actions[self::ACTION_SYNCHRONIZE] = $this->ui_factory->table()->action()->standard(
79 $this->lng->txt('cal_cal_synchronize'),
80 $url_builder->withParameter($action_token, self::ACTION_SYNCHRONIZE),
81 $id_token
82 );
83 $actions[self::ACTION_DELETE] = $this->ui_factory->table()->action()->standard(
84 $this->lng->txt('delete'),
85 $url_builder->withParameter($action_token, self::ACTION_DELETE),
86 $id_token
87 );
88
89 return $this->ui_factory->table()->data(
90 $this->data_retrieval,
91 $this->lng->txt('cal_manage'),
92 $columns
93 )->withActions($actions)->withRequest($this->http->request())->withId('calmng');
94 }
95}
__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