ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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
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.

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

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  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
user()
Definition: user.php:4
$lng
$log
Definition: result.php:15
+ 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  }

◆ 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  }

◆ 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.

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

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

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);
108  $save_command = self::ACTION_SAVE_EDIT_DOCUMENT_FORM;
109  } else {
110  $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
111  $save_command = 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  }
user()
Definition: user.php:4
+ 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.

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

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 sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ saveDocumentSorting()

ilWebDAVMountInstructionsUploadGUI::saveDocumentSorting ( )

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

References showDocuments().

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  }
+ Here is the call graph for this function:

◆ saveEditDocumentForm()

ilWebDAVMountInstructionsUploadGUI::saveEditDocumentForm ( )
protected

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

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

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  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ showAddDocumentForm()

ilWebDAVMountInstructionsUploadGUI::showAddDocumentForm ( )
protected

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

References getDocumentForm().

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  }
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)
+ Here is the call graph for this function:

◆ showDocuments()

ilWebDAVMountInstructionsUploadGUI::showDocuments ( )
protected
Exceptions
ilTemplateException

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

References ilLinkButton\getInstance().

Referenced by saveDocumentSorting().

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  }
+ 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.

References getDocumentForm().

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  }
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)
+ 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.

◆ ACTION_SAVE_EDIT_DOCUMENT_FORM

const ilWebDAVMountInstructionsUploadGUI::ACTION_SAVE_EDIT_DOCUMENT_FORM = 'saveEditDocumentForm'

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


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