ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\WebDAV\Mount\UploadGUI Class Reference

@ilCtrl_isCalledBy ILIAS\WebDAV\Mount\UploadGUI: ilObjWebDAVGUI More...

+ Collaboration diagram for ILIAS\WebDAV\Mount\UploadGUI:

Public Member Functions

 __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)
 
 executeCommand ()
 
 setRefId (int $ref_id)
 
 saveDocumentSorting ()
 

Data Fields

const string ACTION_SAVE_ADD_DOCUMENT_FORM = 'saveAddDocumentForm'
 
const string ACTION_SAVE_EDIT_DOCUMENT_FORM = 'saveEditDocumentForm'
 

Protected Member Functions

 showDocuments ()
 
 getDocumentForm (Document $a_document)
 
 showAddDocumentForm ()
 
 showEditDocumentForm ()
 
 saveAddDocumentForm ()
 
 saveEditDocumentForm ()
 
 deleteDocument ()
 

Private Attributes

const string P_DOCUMENT_ID = 'document_id'
 
UIFactory $ui_factory
 
Renderer $ui_renderer
 
int $webdav_object_ref_id
 

Detailed Description

@ilCtrl_isCalledBy ILIAS\WebDAV\Mount\UploadGUI: ilObjWebDAVGUI

Definition at line 42 of file UploadGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\WebDAV\Mount\UploadGUI::__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 
)

Definition at line 52 of file UploadGUI.php.

66 {
67 $this->ui_factory = $ui->factory();
68 $this->ui_renderer = $ui->renderer();
69
70 $this->lng->loadLanguageModule('meta');
71 }
renderer()
Get a renderer for UI components.
Definition: UIServices.php:44
factory()
Get the factory that crafts UI components.
Definition: UIServices.php:36

References ILIAS\DI\UIServices\factory(), ILIAS\Repository\lng(), and ILIAS\DI\UIServices\renderer().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteDocument()

ILIAS\WebDAV\Mount\UploadGUI::deleteDocument ( )
protected

Definition at line 217 of file UploadGUI.php.

217 : void
218 {
219 if (!$this->rbacsystem->checkAccess('delete', $this->webdav_object_ref_id)) {
220 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
221 }
222
223 $document_id = $this->http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->refinery->kindlyTo()->int());
224
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');
228 }
error(string $a_errmsg)
static http()
Fetches the global http state from ILIAS.

References ILIAS\Repository\ctrl(), error(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\WebDAV\Mount\UploadGUI::executeCommand ( )

Definition at line 73 of file UploadGUI.php.

73 : void
74 {
75 $cmd = $this->ctrl->getCmd();
76
77 if (!$this->rbacsystem->checkAccess('read', $this->webdav_object_ref_id)) {
78 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
79 }
80
81 if ($cmd === 'delete') {
82 $cmd .= 'Document';
83 }
84 if ($cmd === '' || !method_exists($this, $cmd)) {
85 $cmd = 'showDocuments';
86 }
87 $this->$cmd();
88 }

References ILIAS\Repository\ctrl(), error(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getDocumentForm()

ILIAS\WebDAV\Mount\UploadGUI::getDocumentForm ( Document  $a_document)
protected

Definition at line 124 of file UploadGUI.php.

124 : DocumentFormGUI
125 {
126 if ($a_document->getId() > 0) {
127 $this->ctrl->setParameter($this, self::P_DOCUMENT_ID, $a_document->getId());
128
129 $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_EDIT_DOCUMENT_FORM);
131 } else {
132 $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
134 }
135
136 return new DocumentFormGUI(
137 $a_document,
138 $this->mount_instructions_repository,
139 new DocumentPurifier(),
140 $this->user,
141 $this->file_systems->temp(),
142 $this->file_upload,
143 $form_action,
144 $save_command,
145 'showDocuments',
146 $this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)
147 );
148 }
const string ACTION_SAVE_ADD_DOCUMENT_FORM
Definition: UploadGUI.php:44
const string ACTION_SAVE_EDIT_DOCUMENT_FORM
Definition: UploadGUI.php:45

References ILIAS\WebDAV\Mount\UploadGUI\ACTION_SAVE_ADD_DOCUMENT_FORM, ILIAS\WebDAV\Mount\UploadGUI\ACTION_SAVE_EDIT_DOCUMENT_FORM, ILIAS\Repository\ctrl(), ILIAS\WebDAV\Mount\Document\getId(), and ILIAS\Repository\user().

Referenced by ILIAS\WebDAV\Mount\UploadGUI\saveAddDocumentForm(), ILIAS\WebDAV\Mount\UploadGUI\saveEditDocumentForm(), ILIAS\WebDAV\Mount\UploadGUI\showAddDocumentForm(), and ILIAS\WebDAV\Mount\UploadGUI\showEditDocumentForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAddDocumentForm()

ILIAS\WebDAV\Mount\UploadGUI::saveAddDocumentForm ( )
protected

Definition at line 172 of file UploadGUI.php.

172 : void
173 {
174 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
175 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
176 }
177
178 $form = $this->getDocumentForm(new Document());
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);
183 }
184 $this->ctrl->redirect($this, 'showDocuments');
185 } elseif ($form->hasTranslatedError()) {
186 $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError(), true);
187 }
188
189 $html = $form->getHTML();
190 $this->tpl->setContent($html);
191 }
getDocumentForm(Document $a_document)
Definition: UploadGUI.php:124

References ILIAS\Repository\ctrl(), error(), ILIAS\WebDAV\Mount\UploadGUI\getDocumentForm(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveDocumentSorting()

ILIAS\WebDAV\Mount\UploadGUI::saveDocumentSorting ( )

Definition at line 230 of file UploadGUI.php.

230 : void
231 {
232 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
233 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
234 }
235
236 $sorting = $this->http->request()->getParsedBody()['sorting'] ?? [];
237 if (!is_array($sorting) || $sorting === []) {
238 $this->showDocuments();
239 return;
240 }
241
242 asort($sorting, SORT_NUMERIC);
243
244 $position = 0;
245 foreach (array_keys($sorting) as $document_id) {
246 if (!is_numeric($document_id)) {
247 continue;
248 }
249
250 $this->mount_instructions_repository->updateSortingValueById((int) $document_id, ++$position);
251 }
252
253 $this->tpl->setOnScreenMessage('success', $this->lng->txt('webdav_saved_sorting'), true);
254 $this->ctrl->redirect($this);
255 }

References ILIAS\Repository\ctrl(), error(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\WebDAV\Mount\UploadGUI\showDocuments().

+ Here is the call graph for this function:

◆ saveEditDocumentForm()

ILIAS\WebDAV\Mount\UploadGUI::saveEditDocumentForm ( )
protected

Definition at line 193 of file UploadGUI.php.

193 : void
194 {
195 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
196 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
197 }
198
199 $document_id = $this->http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->refinery->kindlyTo()->int());
200 $form = $this->getDocumentForm(
201 $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id)
202 );
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);
207 }
208 $this->ctrl->redirect($this, 'showDocuments');
209 } elseif ($form->hasTranslatedError()) {
210 $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError(), true);
211 }
212
213 $html = $form->getHTML();
214 $this->tpl->setContent($html);
215 }

References ILIAS\Repository\ctrl(), error(), ILIAS\WebDAV\Mount\UploadGUI\getDocumentForm(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ setRefId()

ILIAS\WebDAV\Mount\UploadGUI::setRefId ( int  $ref_id)

Definition at line 90 of file UploadGUI.php.

90 : void
91 {
92 $this->webdav_object_ref_id = $ref_id;
93 }
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ showAddDocumentForm()

ILIAS\WebDAV\Mount\UploadGUI::showAddDocumentForm ( )
protected

Definition at line 150 of file UploadGUI.php.

150 : void
151 {
152 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
153 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
154 }
155
156 $form = $this->getDocumentForm(new Document());
157 $this->tpl->setContent($form->getHTML());
158 }

References error(), ILIAS\WebDAV\Mount\UploadGUI\getDocumentForm(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ showDocuments()

ILIAS\WebDAV\Mount\UploadGUI::showDocuments ( )
protected

Definition at line 95 of file UploadGUI.php.

95 : void
96 {
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')
101 );
102 $this->toolbar->addStickyItem($document_button);
103 }
104
105 $uri_builder = new UriBuilder($this->http->request(), new Config());
106
107 $document_tbl_gui = new DocumentTableGUI(
108 $this,
109 $uri_builder,
110 'showDocuments',
111 $this->ui_factory,
112 $this->ui_renderer,
113 $this->http->request(),
114 $this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)
115 );
116 $document_tbl_gui->setProvider(
117 new TableDataProvider($this->mount_instructions_repository)
118 );
119 $document_tbl_gui->populate();
120
121 $this->tpl->setContent($document_tbl_gui->getHTML());
122 }

References ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by ILIAS\WebDAV\Mount\UploadGUI\saveDocumentSorting().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showEditDocumentForm()

ILIAS\WebDAV\Mount\UploadGUI::showEditDocumentForm ( )
protected

Definition at line 160 of file UploadGUI.php.

160 : void
161 {
162 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
163 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
164 }
165
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);
168 $form = $this->getDocumentForm($document);
169 $this->tpl->setContent($form->getHTML());
170 }

References error(), ILIAS\WebDAV\Mount\UploadGUI\getDocumentForm(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Field Documentation

◆ $ui_factory

UIFactory ILIAS\WebDAV\Mount\UploadGUI::$ui_factory
private

Definition at line 48 of file UploadGUI.php.

◆ $ui_renderer

Renderer ILIAS\WebDAV\Mount\UploadGUI::$ui_renderer
private

Definition at line 49 of file UploadGUI.php.

◆ $webdav_object_ref_id

int ILIAS\WebDAV\Mount\UploadGUI::$webdav_object_ref_id
private

Definition at line 50 of file UploadGUI.php.

◆ ACTION_SAVE_ADD_DOCUMENT_FORM

const string ILIAS\WebDAV\Mount\UploadGUI::ACTION_SAVE_ADD_DOCUMENT_FORM = 'saveAddDocumentForm'

Definition at line 44 of file UploadGUI.php.

Referenced by ILIAS\WebDAV\Mount\UploadGUI\getDocumentForm().

◆ ACTION_SAVE_EDIT_DOCUMENT_FORM

const string ILIAS\WebDAV\Mount\UploadGUI::ACTION_SAVE_EDIT_DOCUMENT_FORM = 'saveEditDocumentForm'

Definition at line 45 of file UploadGUI.php.

Referenced by ILIAS\WebDAV\Mount\UploadGUI\getDocumentForm().

◆ P_DOCUMENT_ID

const string ILIAS\WebDAV\Mount\UploadGUI::P_DOCUMENT_ID = 'document_id'
private

Definition at line 46 of file UploadGUI.php.


The documentation for this class was generated from the following file: