ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWebDAVMountInstructionsUploadGUI Class Reference
+ Collaboration diagram for ilWebDAVMountInstructionsUploadGUI:

Public Member Functions

 __construct (ilObjWebDAV $webdav_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

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVMountInstructionsUploadGUI::__construct ( ilObjWebDAV  $webdav_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->webdav_settings = $webdav_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
$lng
$log
Definition: result.php:15
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteDocument()

ilWebDAVMountInstructionsUploadGUI::deleteDocument ( )
protected

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

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

◆ 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->webdav_settings->getRefId())) {
60  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
61  }
62 
63  if ($cmd == 'delete') {
64  $cmd .= 'Document';
65  }
66  if ($cmd == '' || !method_exists($this, $cmd)) {
67  $cmd = 'showDocuments';
68  }
69  $this->$cmd();
70  }

◆ getDocumentByServerRequest()

ilWebDAVMountInstructionsUploadGUI::getDocumentByServerRequest ( )
protected

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

204  {
205  return $this->httpState->request() - getParsedBody()['instructions_id'] ?? [];
206  }

◆ getDocumentForm()

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

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

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

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

106  {
107  if ($a_document->getId() > 0) {
108  $this->ctrl->setParameter($this, 'doc_id', $a_document->getId());
109 
110  $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_EDIT_DOCUMENT_FORM);
111  $save_command = self::ACTION_SAVE_EDIT_DOCUMENT_FORM;
112  } else {
113  $form_action = $this->ctrl->getFormAction($this, self::ACTION_SAVE_ADD_DOCUMENT_FORM);
114  $save_command = self::ACTION_SAVE_ADD_DOCUMENT_FORM;
115  }
116 
118  $a_document,
119  $this->mount_instructions_repository,
121  $this->user,
122  $this->file_systems->temp(),
123  $this->file_upload,
124  $form_action,
125  $save_command,
126  'showDocuments',
127  $this->rbacsystem->checkAccess('write', $this->webdav_settings->getRefId())
128  );
129 
130  return $form;
131  }
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 158 of file class.ilWebDAVMountInstructionsUploadGUI.php.

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

159  {
160  if (!$this->rbacsystem->checkAccess('write', $this->webdav_settings->getRefId())) {
161  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
162  }
163 
165  if ($form->saveObject()) {
166  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
167  if ($form->hasTranslatedInfo()) {
168  ilUtil::sendInfo($form->getTranslatedInfo(), true);
169  }
170  $this->ctrl->redirect($this, 'showDocuments');
171  } elseif ($form->hasTranslatedError()) {
172  ilUtil::sendFailure($form->getTranslatedError(), true);
173  }
174 
175  $html = $form->getHTML();
176  $this->tpl->setContent($html);
177  }
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 220 of file class.ilWebDAVMountInstructionsUploadGUI.php.

References showDocuments().

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

◆ saveEditDocumentForm()

ilWebDAVMountInstructionsUploadGUI::saveEditDocumentForm ( )
protected

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

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

183  {
184  if (!$this->rbacsystem->checkAccess('write', $this->webdav_settings->getRefId())) {
185  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
186  }
187 
188  $form = $this->getDocumentForm(new ilWebDAVMountInstructionsDocument((int) $_REQUEST['webdav_id']));
189  if ($form->updateObject()) {
190  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
191  if ($form->hasTranslatedInfo()) {
192  ilUtil::sendInfo($form->getTranslatedInfo(), true);
193  }
194  $this->ctrl->redirect($this, 'showDocuments');
195  } elseif ($form->hasTranslatedError()) {
196  ilUtil::sendFailure($form->getTranslatedError(), true);
197  }
198 
199  $html = $form->getHTML();
200  $this->tpl->setContent($html);
201  }
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 133 of file class.ilWebDAVMountInstructionsUploadGUI.php.

References getDocumentForm().

134  {
135  if (!$this->rbacsystem->checkAccess('write', $this->webdav_settings->getRefId())) {
136  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
137  }
138 
140  $this->tpl->setContent($form->getHTML());
141  }
getDocumentForm(ilWebDAVMountInstructionsDocument $a_document)
+ Here is the call graph for this function:

◆ showDocuments()

ilWebDAVMountInstructionsUploadGUI::showDocuments ( )
protected
Exceptions
ilTemplateException

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

References ilLinkButton\getInstance().

Referenced by saveDocumentSorting().

75  : void
76  {
77  if ($this->rbacsystem->checkAccess('write', $this->webdav_settings->getRefId())) {
78  $addDocumentBtn = ilLinkButton::getInstance();
79  $addDocumentBtn->setPrimary(true);
80  $addDocumentBtn->setUrl($this->ctrl->getLinkTarget($this, 'showAddDocumentForm'));
81  $addDocumentBtn->setCaption('webdav_add_instructions_btn_label');
82  $this->toolbar->addStickyItem($addDocumentBtn);
83  }
84 
85  $uri_builder = new ilWebDAVUriBuilder($this->http_state->request());
86 
87  $document_tbl_gui = new ilWebDAVMountInstructionsDocumentTableGUI(
88  $this,
89  $uri_builder,
90  'showDocuments',
91  $this->ui_factory,
92  $this->ui_renderer,
93  $this->rbacsystem->checkAccess('write', $this->webdav_settings->getRefId())
94  );
95  $document_tbl_gui->setProvider(new ilWebDAVMountInstructionsTableDataProvider($this->mount_instructions_repository));
96  $document_tbl_gui->populate();
97 
98  $this->tpl->setContent($document_tbl_gui->getHTML());
99  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showEditDocumentForm()

ilWebDAVMountInstructionsUploadGUI::showEditDocumentForm ( )
protected

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

References getDocumentForm().

144  {
145  if (!$this->rbacsystem->checkAccess('write', $this->webdav_settings->getRefId())) {
146  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
147  }
148 
149  $document_id = $_REQUEST['webdav_id'];
150  $document = $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id);
151  $form = $this->getDocumentForm($document);
152  $this->tpl->setContent($form->getHTML());
153  }
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: