ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ObjectTableBuilder.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 ilObjUser;
27use ILIAS\HTTP\Services as HTTP;
30
32{
33 public const string TITLE_COLUMN = 'title';
34 public const string MEMBER_COUNT_COLUMN = 'count';
35 public const string LIST_USERS_ACTION = 'listUsers';
36 public const string ADD_ROLE_ACTION = 'addRole';
37
38 public function __construct(
39 protected string $search_type,
40 protected bool $has_add_role_action,
41 protected ObjectDataRetrieval $data_retrieval,
42 protected ilLanguage $lng,
43 protected UIFactory $ui_factory,
44 protected HTTP $http,
45 protected ilObjUser $user
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::TITLE_COLUMN] =
56 $this->ui_factory->table()->column()->text($this->lng->txt('title'))->withIsSortable(true);
58 $this->ui_factory->table()->column()->number($this->lng->txt('members'))->withIsSortable(true);
59
60 $actions = [];
61 $actions[self::LIST_USERS_ACTION] = $this->ui_factory->table()->action()->multi(
62 $this->lng->txt('grp_list_members'),
63 $url_builder->withParameter($action_token, self::LIST_USERS_ACTION),
64 $id_token
65 );
66 if ($this->has_add_role_action) {
67 $actions[self::ADD_ROLE_ACTION] = $this->ui_factory->table()->action()->multi(
68 $this->search_type === 'role' ? $this->lng->txt('add_role') : $this->lng->txt('add_member_role'),
69 $url_builder->withParameter($action_token, self::ADD_ROLE_ACTION),
70 $id_token
71 );
72 }
73
74 return $this->ui_factory->table()->data(
75 $this->data_retrieval,
76 $this->lng->txt('search_results'),
77 $columns
78 )->withId('rep_search_obj_' . $this->user->getId())
79 ->withActions($actions)
80 ->withRequest($this->http->request());
81 }
82}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Class Services.
Definition: Services.php:43
__construct(protected string $search_type, protected bool $has_add_role_action, protected ObjectDataRetrieval $data_retrieval, protected ilLanguage $lng, protected UIFactory $ui_factory, protected HTTP $http, protected ilObjUser $user)
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
Definition: URLBuilder.php:166
language handling
User class.
This describes a Data Table.
Definition: Data.php:33
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:26