19 declare(strict_types=1);
56 protected bool $write_access
60 $table = $this->ui_factory->table()->presentation(
61 $this->
language->txt(
'upload_policies'),
69 $upload_limit_text = $record->getUploadLimitInMB() .
" MB";
70 $active_text = ($record->isActive()) ? $this->
language->txt(
'yes') : $this->
language->txt(
'no');
71 $audience_text = $this->
getAudienceText($record->getAudienceType(), $record->getAudience());
72 $scope_text = $record->getScopeDefinition();
73 $valid_until_text = $record->getValidUntil()?->format(
'd.m.Y') ?? $this->
language->txt(
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(
141 $this->
ctrl->getLinkTargetByClass(
142 ilUploadLimitsOverviewGUI::class,
146 $this->ui_factory->button()->shy(
148 $deletion_modal->getShowSignal()
159 protected function filterData(
string $filter_value, array
$data): array
162 switch ($filter_value) {
163 case self::ACTIVE_FILTER_ACTIVE:
164 $active_value =
true;
166 case self::ACTIVE_FILTER_INACTIVE:
167 $active_value =
false;
169 case self::ACTIVE_FILTER_ALL:
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'] .
"\"";
197 if ($counter !== count($roles)) {
198 $audience_text .=
",";
205 $audience_text = $this->
language->txt(
'all_users');
209 return $audience_text;
214 $target = $this->
ctrl->getLinkTargetByClass(
215 ilUploadLimitsOverviewGUI::class,
219 $active_control_element = self::ACTIVE_FILTER_ALL;
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 .
"=";
229 $this->
language->txt(self::ACTIVE_FILTER_ALL) => $actions_prefix . self::ACTIVE_FILTER_ALL,
230 $this->
language->txt(self::ACTIVE_FILTER_ACTIVE) => $actions_prefix . self::ACTIVE_FILTER_ACTIVE,
231 $this->
language->txt(self::ACTIVE_FILTER_INACTIVE) => $actions_prefix . self::ACTIVE_FILTER_INACTIVE
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(
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(
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()
const ACTIVE_FILTER_ACTIVE
const ACTIVE_FILTER_PARAM
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const AUDIENCE_TYPE_GLOBAL_ROLE
getDeletionConfirmationModal(UploadPolicy $record)
getAudienceText(int $audience_type, array $audience_data)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
const CMD_DELETE_UPLOAD_POLICY
const CMD_EDIT_UPLOAD_POLICY
withHeadline(string $headline)
Get a row like this with the given headline.
const AUDIENCE_TYPE_ALL_USERS
buildPolicyActions(array $policies)
This describes a Row used in Presentation Table.
This describes a Mode Control.
withAction($action)
Get a row like this with a button or a dropdown for actions in the expanded row.
language()
description: > Example for rendring a language glyph.
Class ilChatroomConfigFileHandler .
__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)
const ACTIVE_FILTER_INACTIVE