19declare(strict_types=1);
58 $this->
ctrl = $DIC->ctrl();
59 $this->current_user =
$DIC->user();
60 $this->db =
$DIC->database();
61 $this->
http = $DIC->http();
63 $this->main_tpl =
$DIC->ui()->mainTemplate();
64 $this->rbac_review =
$DIC->rbac()->review();
65 $this->
access = $DIC->access();
67 $this->
toolbar = $DIC->toolbar();
68 $this->ui_factory =
$DIC->ui()->factory();
69 $this->ui_renderer =
$DIC->ui()->renderer();
70 $this->
tabs = $DIC->tabs();
71 $this->ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
78 switch ($this->
ctrl->getCmd(self::CMD_INDEX)) {
105 $this->main_tpl->setOnScreenMessage(
107 $this->
language->txt(
"permission_denied"),
110 $this->
ctrl->redirect($this);
116 return $this->
access->checkAccess(
"write",
"", $this->ref_id);
123 $this->ui_factory->button()->primary(
124 $this->language->txt(
"add_upload_policy"),
125 $this->ctrl->getLinkTargetByClass(self::class, self::CMD_ADD_UPLOAD_POLICY)
131 $this->upload_policy_db_repository,
142 $this->main_tpl->setContent(
143 $this->ui_renderer->render($policies_table->getComponents())
149 $this->
tabs->clearTargets();
150 $this->
tabs->setBackTarget(
152 $this->ctrl->getLinkTargetByClass(self::class, self::CMD_INDEX)
156 $this->upload_policy_db_repository,
165 $form_panel_title = ($is_update) ?
166 $this->
language->txt(
'edit_upload_policy') :
167 $this->
language->txt(
'add_upload_policy');
169 $this->main_tpl->setContent(
170 $this->ui_renderer->render(
171 $this->ui_factory->panel()->standard(
173 [$policy_form_ui->getForm()]
182 $this->upload_policy_db_repository,
190 $policy_form = $policy_form_ui->getForm();
191 $policy_form = $policy_form->withRequest($this->
http->request());
192 $data = $policy_form->getData();
194 if (
$data !==
null) {
195 $date_now =
new DateTimeImmutable();
211 $this->current_user->getId(),
215 $this->upload_policy_db_repository->store($upload_policy);
217 $this->
ctrl->redirectByClass(self::class, self::CMD_INDEX);
220 $this->main_tpl->setContent($this->ui_renderer->render($policy_form));
225 $deletion_successful =
false;
228 $policy_id = $this->
http->wrapper()->query()->retrieve(
232 $policy = $this->upload_policy_db_repository->get($policy_id);
233 if ($policy !==
null) {
234 $this->upload_policy_db_repository->delete($policy);
235 $deletion_successful =
true;
239 if ($deletion_successful) {
240 $this->main_tpl->setOnScreenMessage(
242 $this->
language->txt(
'policy_deletion_successful'),
246 $this->main_tpl->setOnScreenMessage(
248 $this->
language->txt(
'policy_deletion_failure_not_found'),
253 $this->
ctrl->redirectByClass(self::class, self::CMD_INDEX);
Builds a Color from either hex- or rgb values.
const SCOPE_DEFINITION_GLOBAL
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
UploadPolicyDBRepository $upload_policy_db_repository
const CMD_SAVE_UPLOAD_POLICY
RefineryFactory $refinery
gotoUploadPolicyForm(bool $is_update=false)
ilGlobalTemplateInterface $main_tpl
hasWriteAccessOrRedirect()
const CMD_DELETE_UPLOAD_POLICY
const CMD_EDIT_UPLOAD_POLICY
const CMD_ADD_UPLOAD_POLICY
ilRbacReview $rbac_review
const MESSAGE_TYPE_SUCCESS
const MESSAGE_TYPE_FAILURE
An entity that renders components to a string output.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
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.