ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilWebDAVMountInstructionsUploadGUI Class Reference
+ Collaboration diagram for ilWebDAVMountInstructionsUploadGUI:

Public Member Functions

 __construct (ilObjFileAccessSettings $file_access_settings, ilGlobalPageTemplate $tpl, ilObjUser $user, ilCtrl $ctrl, ilLanguage $lng, ilRbacSystem $rbacsystem, ilErrorHandling $error, ilLogger $log, ilToolbarGUI $toolbar, GlobalHttpState $http_state, Factory $ui_factory, Renderer $ui_renderer, Filesystems $file_systems, FileUpload $file_upload, ilWebDAVMountInstructionsRepository $mount_instructions_repository)
 
 executeCommand ()
 
 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 ()
 
 getDocumentByServerRequest ()
 
 deleteDocument ()
 

Detailed Description

Author
@ilCtrl_isCalledBy ilWebDAVMountInstructionsUploadGUI: ilObjFileAccessSettingsGui

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

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVMountInstructionsUploadGUI::__construct ( ilObjFileAccessSettings  $file_access_settings,
ilGlobalPageTemplate  $tpl,
ilObjUser  $user,
ilCtrl  $ctrl,
ilLanguage  $lng,
ilRbacSystem  $rbacsystem,
ilErrorHandling  $error,
ilLogger  $log,
ilToolbarGUI  $toolbar,
GlobalHttpState  $http_state,
Factory  $ui_factory,
Renderer  $ui_renderer,
Filesystems  $file_systems,
FileUpload  $file_upload,
ilWebDAVMountInstructionsRepository  $mount_instructions_repository 
)

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

34 {
35 $this->file_access_settings = $file_access_settings;
36 $this->tpl = $tpl;
37 $this->ctrl = $ctrl;
38 $this->lng = $lng;
39 $this->rbacsystem = $rbacsystem;
40 $this->error = $error;
41 $this->user = $user;
42 $this->log = $log;
43 $this->toolbar = $toolbar;
44 $this->http_state = $http_state;
45 $this->ui_factory = $ui_factory;
46 $this->ui_renderer = $ui_renderer;
47 $this->file_systems = $file_systems;
48 $this->file_upload = $file_upload;
49 $this->mount_instructions_repository = $mount_instructions_repository;
50 }
user()
Definition: user.php:4
error($a_errmsg)
set error message @access public
$log
Definition: result.php:15
$lng
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $lng, $log, $tpl, error(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ deleteDocument()

ilWebDAVMountInstructionsUploadGUI::deleteDocument ( )
protected

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

206 {
207 if (!$this->rbacsystem->checkAccess('delete', $this->file_access_settings->getRefId())) {
208 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
209 } else {
210 $webdav_id = $_REQUEST['webdav_id'];
211 $this->mount_instructions_repository->deleteMountInstructionsById($webdav_id);
212 ilUtil::sendSuccess($this->lng->txt('deleted_successfully'), true);
213 $this->ctrl->redirect($this, 'showDocuments');
214 }
215 }

References error().

+ Here is the call graph for this function:

◆ executeCommand()

ilWebDAVMountInstructionsUploadGUI::executeCommand ( )

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

55 : void
56 {
57 $cmd = $this->ctrl->getCmd();
58
59 if (!$this->rbacsystem->checkAccess('read', $this->file_access_settings->getRefId())) {
60 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
61 }
62
63 if ($cmd == '' || !method_exists($this, $cmd)) {
64 $cmd = 'showDocuments';
65 }
66 $this->$cmd();
67 }

References error().

+ Here is the call graph for this function:

◆ getDocumentByServerRequest()

ilWebDAVMountInstructionsUploadGUI::getDocumentByServerRequest ( )
protected

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

201 {
202 return $this->httpState->request() - getParsedBody()['instructions_id'] ?? [];
203 }

◆ getDocumentForm()

ilWebDAVMountInstructionsUploadGUI::getDocumentForm ( ilWebDAVMountInstructionsDocument  $a_document)
protected
Parameters
ilWebDAVMountInstructionsDocument$a_document
Returns
ilWebDAVMountInstructionsDocumentFormGUI

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

103 {
104 if ($a_document->getId() > 0) {
105 $this->ctrl->setParameter($this, 'doc_id', $a_document->getId());
106
107 $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_EDIT_DOCUMENT_FORM);
109 } else {
110 $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
112 }
113
115 $a_document,
116 $this->mount_instructions_repository,
118 $this->user,
119 $this->file_systems->temp(),
120 $this->file_upload,
121 $form_action,
122 $save_command,
123 'showDocuments',
124 $this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())
125 );
126
127 return $form;
128 }

References ACTION_SAVE_ADD_DOCUMENT_FORM, ACTION_SAVE_EDIT_DOCUMENT_FORM, ilWebDAVMountInstructionsDocument\getId(), and user().

Referenced by saveAddDocumentForm(), saveEditDocumentForm(), showAddDocumentForm(), and showEditDocumentForm().

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

◆ saveAddDocumentForm()

ilWebDAVMountInstructionsUploadGUI::saveAddDocumentForm ( )
protected

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

156 {
157 if (!$this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())) {
158 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
159 }
160
162 if ($form->saveObject()) {
163 ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
164 if ($form->hasTranslatedInfo()) {
165 ilUtil::sendInfo($form->getTranslatedInfo(), true);
166 }
167 $this->ctrl->redirect($this, 'showDocuments');
168 } elseif ($form->hasTranslatedError()) {
169 ilUtil::sendFailure($form->getTranslatedError(), true);
170 }
171
172 $html = $form->getHTML();
173 $this->tpl->setContent($html);
174 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)

References error(), getDocumentForm(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ saveDocumentSorting()

ilWebDAVMountInstructionsUploadGUI::saveDocumentSorting ( )

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

218 {
219 if (!$this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())) {
220 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
221 }
222
223 $sorting = $this->http_state->request()->getParsedBody()['sorting'] ?? [];
224 if (!is_array($sorting) || 0 === count($sorting)) {
225 $this->showDocuments();
226 return;
227 }
228
229 // Sort array by give sort value
230 asort($sorting, SORT_NUMERIC);
231
232 $position = 0;
233 foreach ($sorting as $document_id => $ignored_sort_value) {
234
235 // Only accept numbers
236 if (!is_numeric($document_id)) {
237 continue;
238 }
239
240 $this->mount_instructions_repository->updateSortingValueById((int) $document_id, ++$position);
241 }
242
243 ilUtil::sendSuccess($this->lng->txt('webdav_saved_sorting'), true);
244 $this->ctrl->redirect($this);
245 }

References error(), and showDocuments().

+ Here is the call graph for this function:

◆ saveEditDocumentForm()

ilWebDAVMountInstructionsUploadGUI::saveEditDocumentForm ( )
protected

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

180 {
181 if (!$this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())) {
182 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
183 }
184
185 $form = $this->getDocumentForm(new ilWebDAVMountInstructionsDocument((int) $_REQUEST['webdav_id']));
186 if ($form->updateObject()) {
187 ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
188 if ($form->hasTranslatedInfo()) {
189 ilUtil::sendInfo($form->getTranslatedInfo(), true);
190 }
191 $this->ctrl->redirect($this, 'showDocuments');
192 } elseif ($form->hasTranslatedError()) {
193 ilUtil::sendFailure($form->getTranslatedError(), true);
194 }
195
196 $html = $form->getHTML();
197 $this->tpl->setContent($html);
198 }

References error(), getDocumentForm(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ showAddDocumentForm()

ilWebDAVMountInstructionsUploadGUI::showAddDocumentForm ( )
protected

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

131 {
132 if (!$this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())) {
133 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
134 }
135
137 $this->tpl->setContent($form->getHTML());
138 }

References error(), and getDocumentForm().

+ Here is the call graph for this function:

◆ showDocuments()

ilWebDAVMountInstructionsUploadGUI::showDocuments ( )
protected
Exceptions
ilTemplateException

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

72 : void
73 {
74 if ($this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())) {
75 $addDocumentBtn = ilLinkButton::getInstance();
76 $addDocumentBtn->setPrimary(true);
77 $addDocumentBtn->setUrl($this->ctrl->getLinkTarget($this, 'showAddDocumentForm'));
78 $addDocumentBtn->setCaption('webdav_add_instructions_btn_label');
79 $this->toolbar->addStickyItem($addDocumentBtn);
80 }
81
82 $uri_builder = new ilWebDAVUriBuilder($this->http_state->request());
83
84 $document_tbl_gui = new ilWebDAVMountInstructionsDocumentTableGUI(
85 $this,
86 $uri_builder,
87 'showDocuments',
88 $this->ui_factory,
89 $this->ui_renderer,
90 $this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())
91 );
92 $document_tbl_gui->setProvider(new ilWebDAVMountInstructionsTableDataProvider($this->mount_instructions_repository));
93 $document_tbl_gui->populate();
94
95 $this->tpl->setContent($document_tbl_gui->getHTML());
96 }
static getInstance()
Factory.

References ilLinkButton\getInstance().

Referenced by saveDocumentSorting().

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

◆ showEditDocumentForm()

ilWebDAVMountInstructionsUploadGUI::showEditDocumentForm ( )
protected

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

141 {
142 if (!$this->rbacsystem->checkAccess('write', $this->file_access_settings->getRefId())) {
143 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
144 }
145
146 $document_id = $_REQUEST['webdav_id'];
147 $document = $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id);
148 $form = $this->getDocumentForm($document);
149 $this->tpl->setContent($form->getHTML());
150 }

References error(), and getDocumentForm().

+ Here is the call graph for this function:

Field Documentation

◆ ACTION_SAVE_ADD_DOCUMENT_FORM

const ilWebDAVMountInstructionsUploadGUI::ACTION_SAVE_ADD_DOCUMENT_FORM = 'saveAddDocumentForm'

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

Referenced by getDocumentForm().

◆ ACTION_SAVE_EDIT_DOCUMENT_FORM

const ilWebDAVMountInstructionsUploadGUI::ACTION_SAVE_EDIT_DOCUMENT_FORM = 'saveEditDocumentForm'

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

Referenced by getDocumentForm().


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