ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWebDAVMountInstructionsUploadGUI Class Reference
+ Collaboration diagram for ilWebDAVMountInstructionsUploadGUI:

Public Member Functions

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

Data Fields

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

Protected Member Functions

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

Private Attributes

UIFactory $ui_factory
 
Renderer $ui_renderer
 
int $webdav_object_ref_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVMountInstructionsUploadGUI::__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 
)

Definition at line 41 of file class.ilWebDAVMountInstructionsUploadGUI.php.

56 {
57 $this->ui_factory = $ui->factory();
58 $this->ui_renderer = $ui->renderer();
59
60 $this->lng->loadLanguageModule('meta');
61 }
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()

ilWebDAVMountInstructionsUploadGUI::deleteDocument ( )
protected

Definition at line 222 of file class.ilWebDAVMountInstructionsUploadGUI.php.

222 : void
223 {
224 if (!$this->rbacsystem->checkAccess('delete', $this->webdav_object_ref_id)) {
225 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
226 }
227
228 $document_id = $this->http->wrapper()->query()->retrieve('document_id', $this->refinery->kindlyTo()->int());
229
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');
233 }
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()

ilWebDAVMountInstructionsUploadGUI::executeCommand ( )

Definition at line 66 of file class.ilWebDAVMountInstructionsUploadGUI.php.

66 : void
67 {
68 $cmd = $this->ctrl->getCmd();
69
70 if (!$this->rbacsystem->checkAccess('read', $this->webdav_object_ref_id)) {
71 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
72 }
73
74 if ($cmd == 'delete') {
75 $cmd .= 'Document';
76 }
77 if ($cmd == '' || !method_exists($this, $cmd)) {
78 $cmd = 'showDocuments';
79 }
80 $this->$cmd();
81 }

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

+ Here is the call graph for this function:

◆ getDocumentForm()

ilWebDAVMountInstructionsUploadGUI::getDocumentForm ( ilWebDAVMountInstructionsDocument  $a_document)
protected

Definition at line 120 of file class.ilWebDAVMountInstructionsUploadGUI.php.

123 if ($a_document->getId() > 0) {
124 $this->ctrl->setParameter($this, 'doc_id', $a_document->getId());
125
126 $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_EDIT_DOCUMENT_FORM);
128 } else {
129 $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
131 }
132
134 $a_document,
135 $this->mount_instructions_repository,
137 $this->user,
138 $this->file_systems->temp(),
139 $this->file_upload,
140 $form_action,
141 $save_command,
142 'showDocuments',
143 $this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)
144 );
145
146 return $form;
147 }

References ACTION_SAVE_EDIT_DOCUMENT_FORM, ILIAS\Repository\ctrl(), and ilWebDAVMountInstructionsDocument\getId().

+ Here is the call graph for this function:

◆ saveAddDocumentForm()

ilWebDAVMountInstructionsUploadGUI::saveAddDocumentForm ( )
protected

Definition at line 174 of file class.ilWebDAVMountInstructionsUploadGUI.php.

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

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

+ Here is the call graph for this function:

◆ saveDocumentSorting()

ilWebDAVMountInstructionsUploadGUI::saveDocumentSorting ( )

Definition at line 235 of file class.ilWebDAVMountInstructionsUploadGUI.php.

235 : void
236 {
237 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
238 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
239 }
240
241 $sorting = $this->http->request()->getParsedBody()['sorting'] ?? [];
242 if (!is_array($sorting) || [] === $sorting) {
243 $this->showDocuments();
244 return;
245 }
246
247 // Sort array by give sort value
248 asort($sorting, SORT_NUMERIC);
249
250 $position = 0;
251 foreach (array_keys($sorting) as $document_id) {
252 // Only accept numbers
253 if (!is_numeric($document_id)) {
254 continue;
255 }
256
257 $this->mount_instructions_repository->updateSortingValueById((int) $document_id, ++$position);
258 }
259
260 $this->tpl->setOnScreenMessage('success', $this->lng->txt('webdav_saved_sorting'), true);
261 $this->ctrl->redirect($this);
262 }

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

+ Here is the call graph for this function:

◆ saveEditDocumentForm()

ilWebDAVMountInstructionsUploadGUI::saveEditDocumentForm ( )
protected

Definition at line 198 of file class.ilWebDAVMountInstructionsUploadGUI.php.

198 : void
199 {
200 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
201 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
202 }
203
204 $document_id = $this->http->wrapper()->query()->retrieve('document_id', $this->refinery->kindlyTo()->int());
205 $form = $this->getDocumentForm(
206 $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id)
207 );
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);
212 }
213 $this->ctrl->redirect($this, 'showDocuments');
214 } elseif ($form->hasTranslatedError()) {
215 $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError(), true);
216 }
217
218 $html = $form->getHTML();
219 $this->tpl->setContent($html);
220 }

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

+ Here is the call graph for this function:

◆ setRefId()

ilWebDAVMountInstructionsUploadGUI::setRefId ( int  $ref_id)

Definition at line 83 of file class.ilWebDAVMountInstructionsUploadGUI.php.

83 : void
84 {
85 $this->webdav_object_ref_id = $ref_id;
86 }
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ showAddDocumentForm()

ilWebDAVMountInstructionsUploadGUI::showAddDocumentForm ( )
protected

Definition at line 149 of file class.ilWebDAVMountInstructionsUploadGUI.php.

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

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

+ Here is the call graph for this function:

◆ showDocuments()

ilWebDAVMountInstructionsUploadGUI::showDocuments ( )
protected
Exceptions
ilTemplateException

Definition at line 91 of file class.ilWebDAVMountInstructionsUploadGUI.php.

91 : void
92 {
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')
97 );
98 $this->toolbar->addStickyItem($document_button);
99 }
100
101 $uri_builder = new ilWebDAVUriBuilder($this->http->request());
102
103 $document_tbl_gui = new ilWebDAVMountInstructionsDocumentTableGUI(
104 $this,
105 $uri_builder,
106 'showDocuments',
107 $this->ui_factory,
108 $this->ui_renderer,
109 $this->http->request(),
110 $this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)
111 );
112 $document_tbl_gui->setProvider(
113 new ilWebDAVMountInstructionsTableDataProvider($this->mount_instructions_repository)
114 );
115 $document_tbl_gui->populate();
116
117 $this->tpl->setContent($document_tbl_gui->getHTML());
118 }

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

+ Here is the call graph for this function:

◆ showEditDocumentForm()

ilWebDAVMountInstructionsUploadGUI::showEditDocumentForm ( )
protected

Definition at line 159 of file class.ilWebDAVMountInstructionsUploadGUI.php.

159 : void
160 {
161 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
162 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
163 }
164
165 $document_id = $this->http->wrapper()->query()->retrieve('document_id', $this->refinery->kindlyTo()->int());
166 $document = $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id);
167 $form = $this->getDocumentForm($document);
168 $this->tpl->setContent($form->getHTML());
169 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $ui_factory

UIFactory ilWebDAVMountInstructionsUploadGUI::$ui_factory
private

Definition at line 37 of file class.ilWebDAVMountInstructionsUploadGUI.php.

◆ $ui_renderer

Renderer ilWebDAVMountInstructionsUploadGUI::$ui_renderer
private

Definition at line 38 of file class.ilWebDAVMountInstructionsUploadGUI.php.

◆ $webdav_object_ref_id

int ilWebDAVMountInstructionsUploadGUI::$webdav_object_ref_id
private

Definition at line 39 of file class.ilWebDAVMountInstructionsUploadGUI.php.

◆ ACTION_SAVE_ADD_DOCUMENT_FORM

const ilWebDAVMountInstructionsUploadGUI::ACTION_SAVE_ADD_DOCUMENT_FORM = 'saveAddDocumentForm'

Definition at line 35 of file class.ilWebDAVMountInstructionsUploadGUI.php.

◆ ACTION_SAVE_EDIT_DOCUMENT_FORM

const ilWebDAVMountInstructionsUploadGUI::ACTION_SAVE_EDIT_DOCUMENT_FORM = 'saveEditDocumentForm'

Definition at line 36 of file class.ilWebDAVMountInstructionsUploadGUI.php.

Referenced by getDocumentForm().


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