ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
UserTableBuilder.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 NAME_COLUMN = 'name';
34 public const string LOGIN_COLUMN = 'login';
35 public const string SHARE_READ_ONLY_ACTION = 'shareAssign';
36 public const string SHARE_EDITABLE_ACTION = 'shareAssignEditable';
37
38 public function __construct(
39 protected UserDataRetrieval $data_retrieval,
40 protected ilLanguage $lng,
41 protected UIFactory $ui_factory,
42 protected HTTP $http
43 ) {
44 }
45
46 public function get(
47 URLBuilder $url_builder,
48 URLBuilderToken $id_token,
49 URLBuilderToken $action_token
50 ): DataTable {
51 $columns = [];
52 $columns[self::NAME_COLUMN] = $this->ui_factory->table()->column()->text(
53 $this->lng->txt('name')
54 )->withIsSortable(true);
55 $columns[self::LOGIN_COLUMN] = $this->ui_factory->table()->column()->text(
56 $this->lng->txt('login')
57 )->withIsSortable(true);
58
59 $actions = [];
60 $actions[self::SHARE_READ_ONLY_ACTION] = $this->ui_factory->table()->action()->standard(
61 $this->lng->txt('cal_share_cal'),
62 $url_builder->withParameter($action_token, self::SHARE_READ_ONLY_ACTION),
63 $id_token
64 );
65 $actions[self::SHARE_EDITABLE_ACTION] = $this->ui_factory->table()->action()->standard(
66 $this->lng->txt('cal_share_cal_editable'),
67 $url_builder->withParameter($action_token, self::SHARE_EDITABLE_ACTION),
68 $id_token
69 );
70
71
72 return $this->ui_factory->table()->data(
73 $this->data_retrieval,
74 $this->lng->txt('cal_share_search_usr_header'),
75 $columns
76 )->withActions($actions)->withRequest($this->http->request());
77 }
78}
__construct(protected UserDataRetrieval $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