19 declare(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,
'doc_id', $a_document->
getId());
126 $form_action = $this->
ctrl->getFormAction($this, self::ACTION_SAVE_EDIT_DOCUMENT_FORM);
127 $save_command = self::ACTION_SAVE_EDIT_DOCUMENT_FORM;
129 $form_action = $this->
ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
130 $save_command = 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)
151 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
152 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
156 $this->tpl->setContent($form->getHTML());
161 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
162 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
165 $document_id = $this->
http->wrapper()->query()->retrieve(
'document_id', $this->
refinery->kindlyTo()->int());
166 $document = $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id);
168 $this->tpl->setContent($form->getHTML());
176 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
177 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
181 if ($form->saveObject()) {
182 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
183 if ($form->hasTranslatedInfo()) {
184 $this->tpl->setOnScreenMessage(
'info', $form->getTranslatedInfo(),
true);
186 $this->
ctrl->redirect($this,
'showDocuments');
187 } elseif ($form->hasTranslatedError()) {
188 $this->tpl->setOnScreenMessage(
'failure', $form->getTranslatedError(),
true);
191 $html = $form->getHTML();
192 $this->tpl->setContent($html);
200 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
201 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
204 $document_id = $this->
http->wrapper()->query()->retrieve(
'document_id', $this->
refinery->kindlyTo()->int());
206 $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id)
208 if ($form->updateObject()) {
209 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
210 if ($form->hasTranslatedInfo()) {
211 $this->tpl->setOnScreenMessage(
'info', $form->getTranslatedInfo(),
true);
213 $this->
ctrl->redirect($this,
'showDocuments');
214 } elseif ($form->hasTranslatedError()) {
215 $this->tpl->setOnScreenMessage(
'failure', $form->getTranslatedError(),
true);
218 $html = $form->getHTML();
219 $this->tpl->setContent($html);
224 if (!$this->rbacsystem->checkAccess(
'delete', $this->webdav_object_ref_id)) {
225 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
228 $document_id = $this->
http->wrapper()->query()->retrieve(
'document_id', $this->
refinery->kindlyTo()->int());
230 $this->mount_instructions_repository->deleteMountInstructionsById($document_id);
231 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'deleted_successfully'),
true);
232 $this->
ctrl->redirect($this,
'showDocuments');
237 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
238 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
241 $sorting = $this->
http->request()->getParsedBody()[
'sorting'] ?? [];
242 if (!is_array($sorting) || [] === $sorting) {
248 asort($sorting, SORT_NUMERIC);
251 foreach (array_keys($sorting) as $document_id) {
253 if (!is_numeric($document_id)) {
257 $this->mount_instructions_repository->updateSortingValueById((
int) $document_id, ++$position);
260 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'webdav_saved_sorting'),
true);
261 $this->
ctrl->redirect($this);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides fluid interface to RBAC services.
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)
__construct(private ilGlobalTemplateInterface $tpl, private ilObjUser $user, private ilCtrlInterface $ctrl, private ilLanguage $lng, private ilRbacSystem $rbacsystem, private ilErrorHandling $error, private ilLogger $log, private ilToolbarGUI $toolbar, private Services $http, private RefineryFactory $refinery, UIServices $ui, private Filesystems $file_systems, private FileUpload $file_upload, private ilWebDAVMountInstructionsRepository $mount_instructions_repository)
static http()
Fetches the global http state from ILIAS.
int $webdav_object_ref_id
renderer()
Get a renderer for UI components.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ACTION_SAVE_ADD_DOCUMENT_FORM
const ACTION_SAVE_EDIT_DOCUMENT_FORM
factory()
Get the factory that crafts UI components.
The Filesystems interface defines the access methods which can be used to fetch the different filesys...