ILIAS  release_8 Revision v8.24
ilFileVersionsGUI Class Reference

Class ilFileVersionsGUI. More...

+ Collaboration diagram for ilFileVersionsGUI:

Public Member Functions

 __construct (ilObjFile $file)
 ilFileVersionsGUI constructor. More...
 
 executeCommand ()
 
 getFile ()
 

Data Fields

const KEY_FILE_RID = 'file_rid'
 
const KEY_FILE_EXTRACT = 'file_extract'
 
const KEY_FILE_STRUCTURE = 'file_structure'
 
const CMD_DEFAULT = 'index'
 
const CMD_DELETE_VERSIONS = "deleteVersions"
 
const CMD_ROLLBACK_VERSION = "rollbackVersion"
 
const CMD_DOWNLOAD_VERSION = "sendFile"
 
const HIST_ID = 'hist_id'
 
const CMD_CANCEL_DELETE = "cancelDeleteFile"
 
const CMD_CONFIRMED_DELETE_FILE = "confirmDeleteFile"
 
const CMD_CONFIRMED_DELETE_VERSIONS = 'confirmDeleteVersions'
 
const CMD_ADD_NEW_VERSION = 'addNewVersion'
 
const CMD_CREATE_NEW_VERSION = 'saveVersion'
 
const CMD_ADD_REPLACING_VERSION = 'addReplacingVersion'
 
const CMD_CREATE_REPLACING_VERSION = 'createReplacingVersion'
 
const CMD_UNZIP_CURRENT_REVISION = 'unzipCurrentRevision'
 
const CMD_PROCESS_UNZIP = 'processUnzip'
 

Protected Member Functions

 performCommand ()
 
 setBackTab ()
 

Protected Attributes

int $version_id = null
 
ilTree $tree
 
int $parent_id
 

Private Member Functions

 unzipCurrentRevision ()
 
 processUnzip ()
 
 index ()
 
 addVersion (int $mode=ilFileVersionFormGUI::MODE_ADD)
 
 saveVersion (int $mode=ilFileVersionFormGUI::MODE_ADD)
 
 downloadVersion ()
 
 deleteVersions ()
 
 rollbackVersion ()
 
 confirmDeleteVersions ()
 
 confirmDeleteFile ()
 
 getVersionIdsFromRequest ()
 
 getVersionsToKeep (array $version_ids)
 
 hasPermission (string $a_permission)
 bugfix mantis 26007: this function was created to ensure that the access check not only works for repository objects but for workspace objects too More...
 
 getFileZipOptionsForm ()
 
 getFileProcessor (bool $keep_structure)
 
 getCurrentFileRevision ()
 
 getParentIdType ()
 
 isWorkspaceContext ()
 

Private Attributes

ilToolbarGUI $toolbar
 
ILIAS ResourceStorage Services $storage
 
ILIAS DI UIServices $ui
 
ilAccessHandler $access
 
ilWorkspaceAccessHandler $wsp_access
 
int $ref_id
 
ilLanguage $lng
 
Services $http
 
ilTabsGUI $tabs
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilObjFile $file
 
ilFileServicesSettings $file_service_settings
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFileVersionsGUI::__construct ( ilObjFile  $file)

ilFileVersionsGUI constructor.

Definition at line 70 of file class.ilFileVersionsGUI.php.

71 {
72 global $DIC;
73 $this->file = $file;
74 $this->ctrl = $DIC->ctrl();
75 $this->tpl = $DIC->ui()->mainTemplate();
76 $this->tabs = $DIC->tabs();
77 $this->http = $DIC->http();
78 $this->lng = $DIC->language();
79 $this->ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
80 $this->toolbar = $DIC->toolbar();
81 $this->access = $DIC->access();
82 $this->storage = $DIC->resourceStorage();
83 $this->file_service_settings = $DIC->fileServiceSettings();
84 $this->ui = $DIC->ui();
85 if ($this->isWorkspaceContext()) {
86 $this->tree = new ilWorkspaceTree($DIC->user()->getId());
87 } else {
88 $this->tree = $DIC->repositoryTree();
89 }
90
91 $this->parent_id = $this->tree->getParentId($this->file->getRefId()) ?? $this->getParentIdType();
92 $this->wsp_access = new ilWorkspaceAccessHandler($this->tree);
93 $this->version_id = $this->http->wrapper()->query()->has(self::HIST_ID)
94 ? $this->http->wrapper()->query()->retrieve(self::HIST_ID, $DIC->refinery()->kindlyTo()->int())
95 : null;
96 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, $file, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), getParentIdType(), ILIAS\FileDelivery\http(), isWorkspaceContext(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

Member Function Documentation

◆ addVersion()

ilFileVersionsGUI::addVersion ( int  $mode = ilFileVersionFormGUI::MODE_ADD)
private

Definition at line 262 of file class.ilFileVersionsGUI.php.

262 : void
263 {
264 $this->setBackTab();
265
266 $form = new ilFileVersionFormGUI($this, $mode);
267 $this->tpl->setContent($form->getHTML());
268 }
Class ilFileVersionFormGUI.

References setBackTab().

Referenced by performCommand().

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

◆ confirmDeleteFile()

ilFileVersionsGUI::confirmDeleteFile ( )
private

Definition at line 385 of file class.ilFileVersionsGUI.php.

385 : void
386 {
387 $parent_id = $this->tree->getParentId($this->ref_id);
388
389 ilRepUtil::deleteObjects($parent_id, [$this->ref_id]);
390
391 // redirect to parent object
392 $this->ctrl->setParameterByClass(ilRepositoryGUI::class, "ref_id", $parent_id);
393 $this->ctrl->redirectByClass(ilRepositoryGUI::class);
394 }
static deleteObjects(int $a_cur_ref_id, array $a_ids, bool $throw_error_on_already_deleted=true)
Delete objects.

References $parent_id, ILIAS\Repository\ctrl(), and ilRepUtil\deleteObjects().

Referenced by performCommand().

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

◆ confirmDeleteVersions()

ilFileVersionsGUI::confirmDeleteVersions ( )
private

Definition at line 372 of file class.ilFileVersionsGUI.php.

372 : void
373 {
374 // delete versions after confirmation
375 $versions_to_delete = $this->getVersionIdsFromRequest();
376 if (is_array($versions_to_delete) && $versions_to_delete !== []) {
377 $this->file->deleteVersions($versions_to_delete);
378 $this->tpl->setOnScreenMessage('success', $this->lng->txt("file_versions_deleted"), true);
379 }
380
381 $this->ctrl->setParameter($this, self::HIST_ID, "");
382 $this->ctrl->redirect($this, self::CMD_DEFAULT);
383 }

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

Referenced by performCommand().

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

◆ deleteVersions()

ilFileVersionsGUI::deleteVersions ( )
private

Definition at line 292 of file class.ilFileVersionsGUI.php.

292 : void
293 {
294 $version_ids = $this->getVersionIdsFromRequest();
295 $existing_versions = $this->file->getVersions();
296 $remaining_versions = array_udiff(
297 $existing_versions,
298 $version_ids,
299 static function ($a, $b) {
300 if ($a instanceof ilObjFileVersion) {
301 $a = $a->getHistEntryId();
302 }
303 if ($b instanceof ilObjFileVersion) {
304 $b = $b->getHistEntryId();
305 }
306 return $a - $b;
307 }
308 );
309
310 if (count($version_ids) < 1) {
311 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
312 $this->ctrl->redirect($this, self::CMD_DEFAULT);
313 } else {
314 $conf_gui = new ilConfirmationGUI();
315 $conf_gui->setFormAction($this->ctrl->getFormAction($this, self::CMD_DEFAULT));
316 $conf_gui->setCancel($this->lng->txt("cancel"), self::CMD_DEFAULT);
317
318 $icon = ilObject::_getIcon($this->file->getId(), "small", $this->file->getType());
319 $alt = $this->lng->txt("icon") . " " . $this->lng->txt("obj_" . $this->file->getType());
320
321 if (count($remaining_versions) < 1) {
322 // Ask
323 $conf_gui->setHeaderText($this->lng->txt('file_confirm_delete_all_versions'));
324 $conf_gui->setConfirm($this->lng->txt("confirm"), self::CMD_CONFIRMED_DELETE_FILE);
325 $conf_gui->addItem(
326 "id[]",
327 $this->ref_id,
328 $this->file->getTitle(),
329 $icon,
330 $alt
331 );
332 } else {
333 // Ask
334 $conf_gui->setHeaderText($this->lng->txt('file_confirm_delete_versions'));
335 $conf_gui->setConfirm($this->lng->txt("confirm"), self::CMD_CONFIRMED_DELETE_VERSIONS);
336
337 foreach ($this->file->getVersions($version_ids) as $version) {
338 $a_text = $version['filename'] ?? $version->getFilename() ?? $this->file->getTitle();
339 $version_string = $version['hist_id'] ?? $version->getVersion();
340 $a_text .= " (v" . $version_string . ")";
341 $conf_gui->addItem(
342 "hist_id[]",
343 $version['hist_entry_id'],
344 $a_text,
345 $icon,
346 $alt
347 );
348 }
349 }
350
351 $this->tpl->setContent($conf_gui->getHTML());
352 }
353 }
$version
Definition: plugin.php:24
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, $version, ilObject\_getIcon(), ILIAS\Repository\ctrl(), getVersionIdsFromRequest(), and ILIAS\Repository\lng().

Referenced by performCommand().

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

◆ downloadVersion()

ilFileVersionsGUI::downloadVersion ( )
private

Definition at line 284 of file class.ilFileVersionsGUI.php.

284 : void
285 {
286 try {
287 $this->file->sendFile($this->version_id);
288 } catch (FileNotFoundException $e) {
289 }
290 }

References Vendor\Package\$e.

Referenced by performCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilFileVersionsGUI::executeCommand ( )

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

159 : void
160 {
161 // bugfix mantis 26007: use new function hasPermission to ensure that the check also works for workspace files
162 if (!$this->hasPermission('write')) {
163 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
164 $this->ctrl->returnToParent($this);
165 }
166 switch ($this->ctrl->getNextClass()) {
167 case strtolower(ilFileVersionsUploadHandlerGUI::class):
168 $this->ctrl->forwardCommand(
170 $this->file
171 )
172 );
173 return;
174 default:
175 $this->performCommand();
176 break;
177 }
178 }
hasPermission(string $a_permission)
bugfix mantis 26007: this function was created to ensure that the access check not only works for rep...
Class ilFileVersionsUploadHandlerGUI.

References ILIAS\Repository\ctrl(), hasPermission(), ILIAS\Repository\lng(), and performCommand().

+ Here is the call graph for this function:

◆ getCurrentFileRevision()

ilFileVersionsGUI::getCurrentFileRevision ( )
private

Definition at line 519 of file class.ilFileVersionsGUI.php.

519 : ?Revision
520 {
521 $file_rid = $this->storage->manage()->find($this->file->getResourceId());
522 if (null !== $file_rid) {
523 return $this->storage->manage()->getCurrentRevision($file_rid);
524 }
525
526 return null;
527 }

Referenced by index().

+ Here is the caller graph for this function:

◆ getFile()

ilFileVersionsGUI::getFile ( )

Definition at line 396 of file class.ilFileVersionsGUI.php.

396 : ilObjFile
397 {
398 return $this->file;
399 }
Class ilObjFile.

References $file.

Referenced by ilFileVersionsTableGUI\__construct(), and ilFileVersionFormGUI\__construct().

+ Here is the caller graph for this function:

◆ getFileProcessor()

ilFileVersionsGUI::getFileProcessor ( bool  $keep_structure)
private

Definition at line 488 of file class.ilFileVersionsGUI.php.

489 {
490 $context = $this->getParentIdType();
491
492 if ($keep_structure) {
495 new ilObjFileGUI(
496 $this->file->getId(),
497 $context,
498 $this->parent_id
499 ),
500 $this->storage,
501 $this->file_service_settings,
502 $this->tree
503 );
504 }
505
508 new ilObjFileGUI(
509 $this->file->getId(),
510 $context,
511 $this->parent_id
512 ),
513 $this->storage,
514 $this->file_service_settings,
515 $this->tree
516 );
517 }
GUI class for file objects.
Class ilObjFileStakeholder.
Class ilObjFileUnzipFlatProcessor.
$context
Definition: webdav.php:29

References $context, and getParentIdType().

Referenced by processUnzip().

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

◆ getFileZipOptionsForm()

ilFileVersionsGUI::getFileZipOptionsForm ( )
private

Definition at line 474 of file class.ilFileVersionsGUI.php.

474 : Form
475 {
476 return $this->ui->factory()->input()->container()->form()->standard(
477 $this->ctrl->getFormActionByClass(self::class, self::CMD_PROCESS_UNZIP),
478 [
479 self::KEY_FILE_RID => $this->ui->factory()->input()->field()->hidden()->withValue($this->file->getResourceId()),
480 self::KEY_FILE_STRUCTURE => $this->ui->factory()->input()->field()->checkbox(
481 $this->lng->txt('take_over_structure'),
482 $this->lng->txt('take_over_structure_info'),
483 ),
484 ]
485 );
486 }
This describes commonalities between all forms.
Definition: Form.php:33

References ILIAS\Repository\ctrl(), and ILIAS\Repository\ui().

Referenced by processUnzip().

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

◆ getParentIdType()

ilFileVersionsGUI::getParentIdType ( )
private

Definition at line 529 of file class.ilFileVersionsGUI.php.

529 : int
530 {
531 return ($this->isWorkspaceContext()) ?
534 }

References isWorkspaceContext(), ilObject2GUI\REPOSITORY_NODE_ID, and ilObject2GUI\WORKSPACE_NODE_ID.

Referenced by __construct(), and getFileProcessor().

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

◆ getVersionIdsFromRequest()

ilFileVersionsGUI::getVersionIdsFromRequest ( )
private

Definition at line 401 of file class.ilFileVersionsGUI.php.

401 : array
402 {
403 // get ids either from GET (if single item was clicked) or
404 // from POST (if multiple items were selected)
405 $request = $this->http->request();
406
407 $version_ids = [];
408 if (isset($request->getQueryParams()[self::HIST_ID])) {
409 $version_ids = [$request->getQueryParams()[self::HIST_ID]];
410 } elseif (isset($request->getParsedBody()[self::HIST_ID])) {
411 $version_ids = (array) $request->getParsedBody()[self::HIST_ID];
412 }
413
414 array_walk($version_ids, static function (&$i): void {
415 $i = (int) $i;
416 });
417
418 return $version_ids;
419 }
$i
Definition: metadata.php:41

References $i, HIST_ID, ILIAS\FileDelivery\http(), and ILIAS\Repository\int().

Referenced by confirmDeleteVersions(), deleteVersions(), and rollbackVersion().

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

◆ getVersionsToKeep()

ilFileVersionsGUI::getVersionsToKeep ( array  $version_ids)
private
Parameters
array$version_ids
Returns
array

Definition at line 425 of file class.ilFileVersionsGUI.php.

425 : array
426 {
427 $versions_to_keep = $this->file->getVersions();
428 array_udiff($versions_to_keep, $version_ids, static function ($v1, $v2): bool {
429 if (is_array($v1) || $v1 instanceof ilObjFileVersion) {
430 $v1 = (int) $v1["hist_entry_id"];
431 } else {
432 if (!is_numeric($v1)) {
433 $v1 = (int) $v1;
434 }
435 }
436
437 if (is_array($v2) || $v2 instanceof ilObjFileVersion) {
438 $v2 = (int) $v2["hist_entry_id"];
439 } else {
440 if (!is_numeric($v2)) {
441 $v2 = (int) $v2;
442 }
443 }
444
445 return $v1 === $v2;
446 });
447
448 return $versions_to_keep;
449 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ hasPermission()

ilFileVersionsGUI::hasPermission ( string  $a_permission)
private

bugfix mantis 26007: this function was created to ensure that the access check not only works for repository objects but for workspace objects too

Definition at line 456 of file class.ilFileVersionsGUI.php.

456 : bool
457 {
458 // determine if the permission check concerns a workspace- or repository-object
459 if ($this->isWorkspaceContext()) {
460 // permission-check concerning a workspace object
461 if ($this->wsp_access->checkAccess($a_permission, "", $this->ref_id)) {
462 return true;
463 }
464 } else {
465 // permission-check concerning a repository object
466 if ($this->access->checkAccess($a_permission, '', $this->ref_id)) {
467 return true;
468 }
469 }
470
471 return false;
472 }

References ILIAS\Repository\access(), and isWorkspaceContext().

Referenced by executeCommand().

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

◆ index()

ilFileVersionsGUI::index ( )
private

Definition at line 227 of file class.ilFileVersionsGUI.php.

227 : void
228 {
229 // Buttons
230 $add_version = ilLinkButton::getInstance();
231 $add_version->setCaption('file_new_version');
232 $add_version->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD_NEW_VERSION));
233 $this->toolbar->addButtonInstance($add_version);
234
235 $replace_version = ilLinkButton::getInstance();
236 $replace_version->setCaption('replace_file');
237 $replace_version->setUrl($this->ctrl->getLinkTarget($this, self::CMD_ADD_REPLACING_VERSION));
238 $this->toolbar->addButtonInstance($replace_version);
239
240 $current_file_revision = $this->getCurrentFileRevision();
241
242 // only add unzip button if the current revision is a zip.
243 if (null !== $current_file_revision &&
244 in_array($current_file_revision->getInformation()->getMimeType(), [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED], true)
245 ) {
246 $unzip_button = ilLinkButton::getInstance();
247 $unzip_button->setCaption($this->lng->txt('unzip'), false);
248 $unzip_button->setUrl(
249 $this->ctrl->getLinkTargetByClass(
250 self::class,
251 self::CMD_UNZIP_CURRENT_REVISION
252 )
253 );
254
255 $this->toolbar->addButtonInstance($unzip_button);
256 }
257
258 $table = new ilFileVersionsTableGUI($this, self::CMD_DEFAULT);
259 $this->tpl->setContent($table->getHTML());
260 }
Class ilFileVersionsTableGUI.

References ILIAS\Repository\ctrl(), getCurrentFileRevision(), ilLinkButton\getInstance(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by performCommand().

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

◆ isWorkspaceContext()

ilFileVersionsGUI::isWorkspaceContext ( )
private

Definition at line 536 of file class.ilFileVersionsGUI.php.

536 : bool
537 {
538 return $this->http->wrapper()->query()->has('wsp_id');
539 }

References ILIAS\FileDelivery\http().

Referenced by __construct(), getParentIdType(), and hasPermission().

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

◆ performCommand()

ilFileVersionsGUI::performCommand ( )
protected
Returns
void
Exceptions

ILIAS\FileUpload\Collection\Exception\NoSuchElementException

Exceptions

ILIAS\FileUpload\Exception\IllegalStateException

Definition at line 103 of file class.ilFileVersionsGUI.php.

103 : void
104 {
105 $cmd = $this->ctrl->getCmd(self::CMD_DEFAULT);
106 switch ($cmd) {
108 $this->index();
109 break;
111 $this->downloadVersion();
112 break;
114 $this->deleteVersions();
115 break;
117 $this->rollbackVersion();
118 break;
121 break;
124 break;
127 // no break
130 break;
132 $this->confirmDeleteVersions();
133 break;
135 $this->confirmDeleteFile();
136 break;
138 $this->unzipCurrentRevision();
139 break;
141 $this->processUnzip();
142 break;
143 }
144 }
saveVersion(int $mode=ilFileVersionFormGUI::MODE_ADD)
addVersion(int $mode=ilFileVersionFormGUI::MODE_ADD)

References addVersion(), CMD_ADD_NEW_VERSION, CMD_ADD_REPLACING_VERSION, CMD_CONFIRMED_DELETE_FILE, CMD_CONFIRMED_DELETE_VERSIONS, CMD_CREATE_NEW_VERSION, CMD_CREATE_REPLACING_VERSION, CMD_DEFAULT, CMD_DELETE_VERSIONS, CMD_DOWNLOAD_VERSION, CMD_PROCESS_UNZIP, CMD_ROLLBACK_VERSION, CMD_UNZIP_CURRENT_REVISION, confirmDeleteFile(), confirmDeleteVersions(), ILIAS\Repository\ctrl(), deleteVersions(), downloadVersion(), index(), ilFileVersionFormGUI\MODE_ADD, ilFileVersionFormGUI\MODE_REPLACE, processUnzip(), rollbackVersion(), saveVersion(), and unzipCurrentRevision().

Referenced by executeCommand().

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

◆ processUnzip()

ilFileVersionsGUI::processUnzip ( )
private

Definition at line 190 of file class.ilFileVersionsGUI.php.

190 : void
191 {
192 $form = $this->getFileZipOptionsForm()->withRequest($this->http->request());
193 $data = $form->getData();
194
195 if (!empty($data)) {
196 $file_rid = $this->storage->manage()->find($data[self::KEY_FILE_RID]);
197 if (null !== $file_rid) {
198 $processor = $this->getFileProcessor($data[self::KEY_FILE_STRUCTURE]);
199 $processor->process($file_rid);
200
201 if ($processor->getInvalidFileNames() !== []) {
202 $this->ui->mainTemplate()->setOnScreenMessage(
203 'info',
204 sprintf(
205 $this->lng->txt('file_upload_info_file_with_critical_extension'),
206 implode(', ', $processor->getInvalidFileNames())
207 ),
208 true
209 );
210 }
211
212 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_unzip_success'), true);
213 $this->ctrl->setParameterByClass(ilRepositoryGUI::class, "ref_id", $this->parent_id);
214 $this->ctrl->redirectByClass(ilRepositoryGUI::class);
215 }
216
217 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('file_not_found'));
218 }
219
220 $this->tpl->setContent(
221 $this->ui->renderer()->render(
222 $this->getFileZipOptionsForm()
223 )
224 );
225 }
getFileProcessor(bool $keep_structure)

References $data, ILIAS\Repository\ctrl(), getFileProcessor(), getFileZipOptionsForm(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by performCommand().

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

◆ rollbackVersion()

ilFileVersionsGUI::rollbackVersion ( )
private

Definition at line 355 of file class.ilFileVersionsGUI.php.

355 : void
356 {
357 $version_ids = $this->getVersionIdsFromRequest();
358
359 // more than one entry selected?
360 if (count($version_ids) != 1) {
361 $this->tpl->setOnScreenMessage('info', $this->lng->txt("file_rollback_select_exact_one"), true);
362 $this->ctrl->redirect($this, self::CMD_DEFAULT);
363 }
364
365 // rollback the version
366 $this->file->rollback($version_ids[0]);
367
368 $this->tpl->setOnScreenMessage('success', sprintf($this->lng->txt("file_rollback_done"), ''), true);
369 $this->ctrl->redirect($this, self::CMD_DEFAULT);
370 }

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

Referenced by performCommand().

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

◆ saveVersion()

ilFileVersionsGUI::saveVersion ( int  $mode = ilFileVersionFormGUI::MODE_ADD)
private
Exceptions

ILIAS\FileUpload\Collection\Exception\NoSuchElementException

Exceptions

ILIAS\FileUpload\Exception\IllegalStateException

Definition at line 274 of file class.ilFileVersionsGUI.php.

274 : void
275 {
276 $form = new ilFileVersionFormGUI($this, $mode);
277 if ($form->saveObject()) {
278 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
279 $this->ctrl->redirect($this, self::CMD_DEFAULT);
280 }
281 $this->tpl->setContent($form->getHTML());
282 }

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

Referenced by performCommand().

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

◆ setBackTab()

ilFileVersionsGUI::setBackTab ( )
protected
Returns
void
Exceptions
ilCtrlException

Definition at line 150 of file class.ilFileVersionsGUI.php.

150 : void
151 {
152 $this->tabs->clearTargets();
153 $this->tabs->setBackTarget(
154 $this->lng->txt('back'),
155 $this->ctrl->getLinkTarget($this, self::CMD_DEFAULT)
156 );
157 }

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

Referenced by addVersion(), and unzipCurrentRevision().

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

◆ unzipCurrentRevision()

ilFileVersionsGUI::unzipCurrentRevision ( )
private

Definition at line 180 of file class.ilFileVersionsGUI.php.

180 : void
181 {
182 $this->setBackTab();
183 $this->tpl->setContent(
184 $this->ui->renderer()->render(
185 $this->getFileZipOptionsForm()
186 )
187 );
188 }

References setBackTab(), and ILIAS\Repository\ui().

Referenced by performCommand().

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

Field Documentation

◆ $access

ilAccessHandler ilFileVersionsGUI::$access
private

Definition at line 53 of file class.ilFileVersionsGUI.php.

◆ $ctrl

ilCtrl ilFileVersionsGUI::$ctrl
private

Definition at line 59 of file class.ilFileVersionsGUI.php.

◆ $file

ilObjFile ilFileVersionsGUI::$file
private

Definition at line 61 of file class.ilFileVersionsGUI.php.

Referenced by __construct(), and getFile().

◆ $file_service_settings

ilFileServicesSettings ilFileVersionsGUI::$file_service_settings
private

Definition at line 62 of file class.ilFileVersionsGUI.php.

◆ $http

Services ilFileVersionsGUI::$http
private

Definition at line 57 of file class.ilFileVersionsGUI.php.

◆ $lng

ilLanguage ilFileVersionsGUI::$lng
private

Definition at line 56 of file class.ilFileVersionsGUI.php.

◆ $parent_id

int ilFileVersionsGUI::$parent_id
protected

Definition at line 65 of file class.ilFileVersionsGUI.php.

Referenced by confirmDeleteFile().

◆ $ref_id

int ilFileVersionsGUI::$ref_id
private

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

◆ $storage

ILIAS ResourceStorage Services ilFileVersionsGUI::$storage
private

Definition at line 51 of file class.ilFileVersionsGUI.php.

◆ $tabs

ilTabsGUI ilFileVersionsGUI::$tabs
private

Definition at line 58 of file class.ilFileVersionsGUI.php.

◆ $toolbar

ilToolbarGUI ilFileVersionsGUI::$toolbar
private

Definition at line 50 of file class.ilFileVersionsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilFileVersionsGUI::$tpl
private

Definition at line 60 of file class.ilFileVersionsGUI.php.

◆ $tree

ilTree ilFileVersionsGUI::$tree
protected

Definition at line 64 of file class.ilFileVersionsGUI.php.

◆ $ui

ILIAS DI UIServices ilFileVersionsGUI::$ui
private

Definition at line 52 of file class.ilFileVersionsGUI.php.

◆ $version_id

int ilFileVersionsGUI::$version_id = null
protected

Definition at line 63 of file class.ilFileVersionsGUI.php.

◆ $wsp_access

ilWorkspaceAccessHandler ilFileVersionsGUI::$wsp_access
private

Definition at line 54 of file class.ilFileVersionsGUI.php.

◆ CMD_ADD_NEW_VERSION

const ilFileVersionsGUI::CMD_ADD_NEW_VERSION = 'addNewVersion'

Definition at line 43 of file class.ilFileVersionsGUI.php.

Referenced by performCommand().

◆ CMD_ADD_REPLACING_VERSION

const ilFileVersionsGUI::CMD_ADD_REPLACING_VERSION = 'addReplacingVersion'

Definition at line 45 of file class.ilFileVersionsGUI.php.

Referenced by performCommand().

◆ CMD_CANCEL_DELETE

const ilFileVersionsGUI::CMD_CANCEL_DELETE = "cancelDeleteFile"

Definition at line 40 of file class.ilFileVersionsGUI.php.

◆ CMD_CONFIRMED_DELETE_FILE

const ilFileVersionsGUI::CMD_CONFIRMED_DELETE_FILE = "confirmDeleteFile"

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

Referenced by performCommand().

◆ CMD_CONFIRMED_DELETE_VERSIONS

const ilFileVersionsGUI::CMD_CONFIRMED_DELETE_VERSIONS = 'confirmDeleteVersions'

Definition at line 42 of file class.ilFileVersionsGUI.php.

Referenced by performCommand().

◆ CMD_CREATE_NEW_VERSION

const ilFileVersionsGUI::CMD_CREATE_NEW_VERSION = 'saveVersion'

◆ CMD_CREATE_REPLACING_VERSION

const ilFileVersionsGUI::CMD_CREATE_REPLACING_VERSION = 'createReplacingVersion'

◆ CMD_DEFAULT

const ilFileVersionsGUI::CMD_DEFAULT = 'index'

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

Referenced by performCommand(), and ilObjFileGUI\setTabs().

◆ CMD_DELETE_VERSIONS

const ilFileVersionsGUI::CMD_DELETE_VERSIONS = "deleteVersions"

◆ CMD_DOWNLOAD_VERSION

const ilFileVersionsGUI::CMD_DOWNLOAD_VERSION = "sendFile"

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

Referenced by ilFileVersionsTableGUI\fillRow(), and performCommand().

◆ CMD_PROCESS_UNZIP

const ilFileVersionsGUI::CMD_PROCESS_UNZIP = 'processUnzip'

Definition at line 48 of file class.ilFileVersionsGUI.php.

Referenced by performCommand().

◆ CMD_ROLLBACK_VERSION

const ilFileVersionsGUI::CMD_ROLLBACK_VERSION = "rollbackVersion"

◆ CMD_UNZIP_CURRENT_REVISION

const ilFileVersionsGUI::CMD_UNZIP_CURRENT_REVISION = 'unzipCurrentRevision'

◆ HIST_ID

const ilFileVersionsGUI::HIST_ID = 'hist_id'

◆ KEY_FILE_EXTRACT

const ilFileVersionsGUI::KEY_FILE_EXTRACT = 'file_extract'

Definition at line 32 of file class.ilFileVersionsGUI.php.

◆ KEY_FILE_RID

const ilFileVersionsGUI::KEY_FILE_RID = 'file_rid'

Definition at line 31 of file class.ilFileVersionsGUI.php.

◆ KEY_FILE_STRUCTURE

const ilFileVersionsGUI::KEY_FILE_STRUCTURE = 'file_structure'

Definition at line 33 of file class.ilFileVersionsGUI.php.


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