19declare(strict_types=1);
49 protected HttpServices
$http,
54 protected UIFactory $ui_factory,
56 protected bool $write_access
60 $table = $this->ui_factory->table()->presentation(
61 $this->
language->txt(
'upload_policies'),
62 [$this->getViewControl()],
74 "policy_no_validity_limitation_set"
80 ->withImportantFields(
82 $this->
language->txt(
'policy_upload_limit') => $upload_limit_text,
83 $this->language->txt(
'policy_audience') => $audience_text,
84 $this->language->txt(
'active') => $active_text
88 $ui_factory->listing()->descriptive(
90 $this->language->txt(
'policy_upload_limit') => $upload_limit_text,
91 $this->language->txt(
'policy_audience') => $audience_text,
92 $this->language->txt(
'active') => $active_text,
93 $this->language->txt(
'policy_scope') => $scope_text,
94 $this->language->txt(
'policy_valid_until') => $valid_until_text,
99 if (
null !== ($dropdown = $actions[$record->
getPolicyId()] ??
null)) {
105 )->withData($policies);
124 if (!$this->write_access) {
128 foreach ($policies as $policy) {
130 $this->
ctrl->setParameterByClass(
131 ilUploadLimitsOverviewGUI::class,
133 $policy->getPolicyId()
137 $dropdowns[$policy->getPolicyId()] = $this->ui_factory->dropdown()->standard(
139 $this->ui_factory->button()->shy(
140 $this->language->txt(
'edit'),
141 $this->ctrl->getLinkTargetByClass(
142 ilUploadLimitsOverviewGUI::class,
146 $this->ui_factory->button()->shy(
147 $this->language->txt(
'delete'),
148 $deletion_modal->getShowSignal()
159 protected function filterData(
string $filter_value, array
$data): array
162 switch ($filter_value) {
164 $active_value =
true;
167 $active_value =
false;
177 foreach (
$data as $data_entry) {
178 if ($data_entry->isActive() === $active_value) {
179 $filtered_data[] = $data_entry;
182 return $filtered_data;
187 switch ($audience_type) {
189 $audience_text = $this->
language->txt(
'all_global_roles');
191 if (!empty($audience_data[
'global_roles'])) {
192 $roles = $this->rbac_review->getRolesForIDs($audience_data[
'global_roles'],
false);
194 foreach ($roles as $role) {
196 $audience_text .=
" \"" . $role[
'title'] .
"\"";
198 $audience_text .=
",";
205 $audience_text = $this->
language->txt(
'all_users');
209 return $audience_text;
214 $target = $this->
ctrl->getLinkTargetByClass(
215 ilUploadLimitsOverviewGUI::class,
220 if ($this->
http->wrapper()->query()->has(self::ACTIVE_FILTER_PARAM)) {
221 $active_control_element = $this->
http->wrapper()->query()->retrieve(
222 self::ACTIVE_FILTER_PARAM,
223 $this->
refinery->kindlyTo()->string()
227 $actions_prefix = $target .
"&" . self::ACTIVE_FILTER_PARAM .
"=";
234 return $this->ui_factory->viewControl()->mode($actions,
'policy_filter')->withActive(
235 $this->
language->txt($active_control_element)
245 "policy_no_validity_limitation_set"
248 $deletion_items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
250 $this->language->txt(
'title'),
254 $deletion_items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
256 $this->language->txt(
'policy_upload_limit'),
260 $deletion_items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
262 $this->language->txt(
'policy_audience'),
266 $deletion_items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
268 $this->language->txt(
'active'),
272 $deletion_items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
274 $this->language->txt(
'policy_scope'),
278 $deletion_items[] = $this->ui_factory->modal()->interruptiveItem()->keyValue(
280 $this->language->txt(
'policy_valid_until'),
284 return $this->ui_factory->modal()->interruptive(
286 $this->language->txt(
'policy_confirm_deletion'),
287 $this->ctrl->getLinkTargetByClass(
288 ilUploadLimitsOverviewGUI::class,
291 )->withAffectedItems(
293 )->withActionButtonLabel($this->
language->txt(
'delete'));
301 $policy_data = $this->upload_policy_db_repository->getAll();
303 if ($this->
http->wrapper()->query()->has(self::ACTIVE_FILTER_PARAM)) {
304 return $this->filterData(
305 $this->
http->wrapper()->query()->retrieve(
306 self::ACTIVE_FILTER_PARAM,
307 $this->refinery->kindlyTo()->string()
Builds a Color from either hex- or rgb values.
__construct(protected UploadPolicyDBRepository $upload_policy_db_repository, protected ilCtrlInterface $ctrl, protected HttpServices $http, protected ilLanguage $language, protected ilGlobalTemplateInterface $main_tpl, protected ilRbacReview $rbac_review, protected RefineryFactory $refinery, protected UIFactory $ui_factory, protected Renderer $ui_renderer, protected bool $write_access)
buildPolicyActions(array $policies)
getAudienceText(int $audience_type, array $audience_data)
const ACTIVE_FILTER_PARAM
getDeletionConfirmationModal(UploadPolicy $record)
const ACTIVE_FILTER_INACTIVE
const ACTIVE_FILTER_ACTIVE
const AUDIENCE_TYPE_GLOBAL_ROLE
const AUDIENCE_TYPE_ALL_USERS
class ilRbacReview Contains Review functions of core Rbac.
const CMD_DELETE_UPLOAD_POLICY
const CMD_EDIT_UPLOAD_POLICY
A component is the most general form of an entity in the UI.
This describes commonalities between all types of Dropdowns.
This describes a Row used in Presentation Table.
withAction($action)
Get a row like this with a button or a dropdown for actions in the expanded row.
withHeadline(string $headline)
Get a row like this with the given headline.
This describes a Mode Control.
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
Class ilChatroomConfigFileHandler \ILIAS\Chatroom\classes.