19declare(strict_types=1);
65 private Repository $mount_instructions_repository
67 $this->ui_factory = $ui->
factory();
68 $this->ui_renderer = $ui->
renderer();
70 $this->
lng->loadLanguageModule(
'meta');
75 $cmd = $this->
ctrl->getCmd();
77 if (!$this->rbacsystem->checkAccess(
'read', $this->webdav_object_ref_id)) {
78 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
81 if ($cmd ===
'delete') {
84 if ($cmd ===
'' || !method_exists($this, $cmd)) {
85 $cmd =
'showDocuments';
92 $this->webdav_object_ref_id =
$ref_id;
97 if ($this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
98 $document_button = $this->ui_factory->link()->standard(
99 $this->
lng->txt(
'webdav_add_instructions_btn_label'),
100 $this->ctrl->getLinkTarget($this,
'showAddDocumentForm')
102 $this->
toolbar->addStickyItem($document_button);
113 $this->
http->request(),
114 $this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)
116 $document_tbl_gui->setProvider(
119 $document_tbl_gui->populate();
121 $this->tpl->setContent($document_tbl_gui->getHTML());
126 if ($a_document->
getId() > 0) {
127 $this->
ctrl->setParameter($this, self::P_DOCUMENT_ID, $a_document->
getId());
129 $form_action = $this->
ctrl->getFormAction($this, self::ACTION_SAVE_EDIT_DOCUMENT_FORM);
132 $form_action = $this->
ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
138 $this->mount_instructions_repository,
141 $this->file_systems->temp(),
146 $this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)
152 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
153 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
157 $this->tpl->setContent($form->getHTML());
162 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
163 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
166 $document_id = $this->
http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->
refinery->kindlyTo()->int());
167 $document = $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id);
169 $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);
195 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
196 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
199 $document_id = $this->
http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->
refinery->kindlyTo()->int());
201 $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id)
203 if ($form->updateObject()) {
204 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
205 if ($form->hasTranslatedInfo()) {
206 $this->tpl->setOnScreenMessage(
'info', $form->getTranslatedInfo(),
true);
208 $this->
ctrl->redirect($this,
'showDocuments');
209 } elseif ($form->hasTranslatedError()) {
210 $this->tpl->setOnScreenMessage(
'failure', $form->getTranslatedError(),
true);
213 $html = $form->getHTML();
214 $this->tpl->setContent($html);
219 if (!$this->rbacsystem->checkAccess(
'delete', $this->webdav_object_ref_id)) {
220 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
223 $document_id = $this->
http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->
refinery->kindlyTo()->int());
225 $this->mount_instructions_repository->deleteMountInstructionsById($document_id);
226 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'deleted_successfully'),
true);
227 $this->
ctrl->redirect($this,
'showDocuments');
232 if (!$this->rbacsystem->checkAccess(
'write', $this->webdav_object_ref_id)) {
233 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
236 $sorting = $this->
http->request()->getParsedBody()[
'sorting'] ?? [];
237 if (!is_array($sorting) || $sorting === []) {
242 asort($sorting, SORT_NUMERIC);
245 foreach (array_keys($sorting) as $document_id) {
246 if (!is_numeric($document_id)) {
250 $this->mount_instructions_repository->updateSortingValueById((
int) $document_id, ++$position);
253 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'webdav_saved_sorting'),
true);
254 $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.
@ilCtrl_isCalledBy ILIAS\WebDAV\Mount\UploadGUI: ilObjWebDAVGUI
int $webdav_object_ref_id
getDocumentForm(Document $a_document)
const string ACTION_SAVE_ADD_DOCUMENT_FORM
__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 Repository $mount_instructions_repository)
const string ACTION_SAVE_EDIT_DOCUMENT_FORM
const string P_DOCUMENT_ID
Error Handling & global info handling.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
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.