19declare(strict_types=1);
57 $this->ui_factory = $ui->
factory();
58 $this->ui_renderer = $ui->
renderer();
60 $this->
lng->loadLanguageModule(
'meta');
68 $cmd = $this->
ctrl->getCmd();
70 if (!$this->rbacsystem->checkAccess(
'read', $this->webdav_object_ref_id)) {
71 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
74 if ($cmd ==
'delete') {
77 if ($cmd ==
'' || !method_exists($this, $cmd)) {
78 $cmd =
'showDocuments';
85 $this->webdav_object_ref_id =
$ref_id;
93 if ($this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
94 $document_button = $this->ui_factory->link()->standard(
95 $this->
lng->txt(
'webdav_add_instructions_btn_label'),
96 $this->ctrl->getLinkTarget($this,
'showAddDocumentForm')
98 $this->
toolbar->addStickyItem($document_button);
109 $this->
http->request(),
110 $this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)
112 $document_tbl_gui->setProvider(
115 $document_tbl_gui->populate();
117 $this->tpl->setContent($document_tbl_gui->getHTML());
123 if ($a_document->
getId() > 0) {
124 $this->
ctrl->setParameter($this, self::P_DOCUMENT_ID, $a_document->
getId());
126 $form_action = $this->
ctrl->getFormAction($this, self::ACTION_SAVE_EDIT_DOCUMENT_FORM);
129 $form_action = $this->
ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
135 $this->mount_instructions_repository,
138 $this->file_systems->temp(),
143 $this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)
149 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
150 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
154 $this->tpl->setContent($form->getHTML());
159 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
160 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
163 $document_id = $this->
http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->
refinery->kindlyTo()->int());
164 $document = $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id);
165 $form = $this->getDocumentForm($document);
166 $this->tpl->setContent($form->getHTML());
174 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
175 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
179 if ($form->saveObject()) {
180 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
181 if ($form->hasTranslatedInfo()) {
182 $this->tpl->setOnScreenMessage(
'info', $form->getTranslatedInfo(),
true);
184 $this->
ctrl->redirect($this,
'showDocuments');
185 } elseif ($form->hasTranslatedError()) {
186 $this->tpl->setOnScreenMessage(
'failure', $form->getTranslatedError(),
true);
189 $html = $form->getHTML();
190 $this->tpl->setContent($html);
198 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
199 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
202 $document_id = $this->
http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->
refinery->kindlyTo()->int());
203 $form = $this->getDocumentForm(
204 $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id)
206 if ($form->updateObject()) {
207 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
208 if ($form->hasTranslatedInfo()) {
209 $this->tpl->setOnScreenMessage(
'info', $form->getTranslatedInfo(),
true);
211 $this->
ctrl->redirect($this,
'showDocuments');
212 } elseif ($form->hasTranslatedError()) {
213 $this->tpl->setOnScreenMessage(
'failure', $form->getTranslatedError(),
true);
216 $html = $form->getHTML();
217 $this->tpl->setContent($html);
222 if (!$this->rbacsystem->checkAccess(
'delete', $this->webdav_object_ref_id)) {
223 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
226 $document_id = $this->
http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->
refinery->kindlyTo()->int());
228 $this->mount_instructions_repository->deleteMountInstructionsById($document_id);
229 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'deleted_successfully'),
true);
230 $this->
ctrl->redirect($this,
'showDocuments');
235 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
236 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
239 $sorting = $this->
http->request()->getParsedBody()[
'sorting'] ?? [];
240 if (!is_array($sorting) || [] === $sorting) {
241 $this->showDocuments();
246 asort($sorting, SORT_NUMERIC);
249 foreach (array_keys($sorting) as $document_id) {
251 if (!is_numeric($document_id)) {
255 $this->mount_instructions_repository->updateSortingValueById((
int) $document_id, ++$position);
258 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'webdav_saved_sorting'),
true);
259 $this->
ctrl->redirect($this);
Provides fluid interface to RBAC services.
renderer()
Get a renderer for UI components.
factory()
Get the factory that crafts UI components.
Builds a Color from either hex- or rgb values.
Error Handling & global info handling.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
int $webdav_object_ref_id
const ACTION_SAVE_ADD_DOCUMENT_FORM
const string P_DOCUMENT_ID
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)
__construct(private ilGlobalTemplateInterface $tpl, private ilObjUser $user, private ilCtrlInterface $ctrl, private ilLanguage $lng, private ilRbacSystem $rbacsystem, private ilErrorHandling $error, private ilToolbarGUI $toolbar, private Services $http, private RefineryFactory $refinery, UIServices $ui, private Filesystems $file_systems, private FileUpload $file_upload, private ilWebDAVMountInstructionsRepository $mount_instructions_repository)
const ACTION_SAVE_EDIT_DOCUMENT_FORM
The Filesystems interface defines the access methods which can be used to fetch the different filesys...
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.
if(!file_exists('../ilias.ini.php'))