ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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 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

const string P_DOCUMENT_ID = 'document_id'
 
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 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 42 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 220 of file class.ilWebDAVMountInstructionsUploadGUI.php.

220 : void
221 {
222 if (!$this->rbacsystem->checkAccess('delete', $this->webdav_object_ref_id)) {
223 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
224 }
225
226 $document_id = $this->http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->refinery->kindlyTo()->int());
227
228 $this->mount_instructions_repository->deleteMountInstructionsById($document_id);
229 $this->tpl->setOnScreenMessage('success', $this->lng->txt('deleted_successfully'), true);
230 $this->ctrl->redirect($this, 'showDocuments');
231 }
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, self::P_DOCUMENT_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 }

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 172 of file class.ilWebDAVMountInstructionsUploadGUI.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
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(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 233 of file class.ilWebDAVMountInstructionsUploadGUI.php.

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

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 196 of file class.ilWebDAVMountInstructionsUploadGUI.php.

196 : void
197 {
198 if (!$this->rbacsystem->checkAccess('write', $this->webdav_object_ref_id)) {
199 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
200 }
201
202 $document_id = $this->http->wrapper()->query()->retrieve(self::P_DOCUMENT_ID, $this->refinery->kindlyTo()->int());
203 $form = $this->getDocumentForm(
204 $this->mount_instructions_repository->getMountInstructionsDocumentById($document_id)
205 );
206 if ($form->updateObject()) {
207 $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
208 if ($form->hasTranslatedInfo()) {
209 $this->tpl->setOnScreenMessage('info', $form->getTranslatedInfo(), true);
210 }
211 $this->ctrl->redirect($this, 'showDocuments');
212 } elseif ($form->hasTranslatedError()) {
213 $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError(), true);
214 }
215
216 $html = $form->getHTML();
217 $this->tpl->setContent($html);
218 }

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 147 of file class.ilWebDAVMountInstructionsUploadGUI.php.

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

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 157 of file class.ilWebDAVMountInstructionsUploadGUI.php.

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

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 38 of file class.ilWebDAVMountInstructionsUploadGUI.php.

◆ $ui_renderer

Renderer ilWebDAVMountInstructionsUploadGUI::$ui_renderer
private

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

◆ $webdav_object_ref_id

int ilWebDAVMountInstructionsUploadGUI::$webdav_object_ref_id
private

Definition at line 40 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().

◆ P_DOCUMENT_ID

const string ilWebDAVMountInstructionsUploadGUI::P_DOCUMENT_ID = 'document_id'
private

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


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