67     private \ILIAS\ResourceStorage\Services 
$storage;
    70     protected \ILIAS\DI\UIServices 
$ui;
    92         $this->
ctrl = $DIC->ctrl();
    93         $this->tpl = $DIC->ui()->mainTemplate();
    94         $this->
tabs = $DIC->tabs();
    95         $this->
http = $DIC->http();
    96         $this->
lng = $DIC->language();
    97         $this->ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int());
    98         $this->
toolbar = $DIC->toolbar();
    99         $this->
access = $DIC->access();
   100         $this->storage = $DIC->resourceStorage();
   101         $this->file_service_settings = $DIC->fileServiceSettings();
   102         $this->
ui = $DIC->ui();
   107         $this->parent_id = $this->tree->getParentId($this->file->getRefId()) ?? $this->
getParentIdType();
   109         $this->version_id = $this->
http->wrapper()->query()->has(self::HIST_ID)
   110             ? $this->
http->wrapper()->query()->retrieve(self::HIST_ID, $DIC->refinery()->kindlyTo()->int())
   124         match ($this->
ctrl->getCmd(self::CMD_DEFAULT)) {
   125             self::CMD_DEFAULT => $this->
index(),
   138             self::CMD_PUBLISH => $this->
publish(),
   139             self::CMD_UNPUBLISH => $this->
unpublish()
   148         $this->
tabs->clearTargets();
   149         $this->
tabs->setBackTarget(
   150             $this->
lng->txt(
'back'),
   151             $this->
ctrl->getLinkTarget($this, self::CMD_DEFAULT)
   159             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'), 
true);
   160             $this->
ctrl->returnToParent($this);
   162         switch ($this->
ctrl->getNextClass()) {
   163             case strtolower(ilFileVersionsUploadHandlerGUI::class):
   164                 $this->
ctrl->forwardCommand(
   170             case strtolower(ilWOPIEmbeddedApplicationGUI::class):
   171                 $action = $this->action_repo->getEditActionForSuffix(
   172                     $this->current_revision->getInformation()->getSuffix()
   176                     $this->current_revision->getIdentification(),
   179                     new URI(rtrim(ILIAS_HTTP_PATH, 
"/") . 
"/" . $this->
ctrl->getLinkTarget($this, self::CMD_DEFAULT))
   182                 $this->
ctrl->forwardCommand(
   197         $this->tpl->setContent(
   198             $this->
ui->renderer()->render(
   206         $this->file->enableNotification();
   208         $this->file->updateObjectFromCurrentRevision();
   209         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'), 
true);
   210         $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   215         $this->file->enableNotification();
   216         if ($this->current_revision->getVersionNumber() === 1) {
   217             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'msg_cant_unpublish'), 
true);
   218             $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   222         $this->file->updateObjectFromCurrentRevision();
   223         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'), 
true);
   224         $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   230         $data = $form->getData();
   233             $file_rid = $this->storage->manage()->find(
$data[self::KEY_FILE_RID]);
   234             if (null !== $file_rid) {
   235                 $copyright_id = 
$data[self::KEY_COPYRIGHT_OPTION][1][self::KEY_COPYRIGHT_ID] ?? null;
   237                 $processor->process($file_rid, null, null, $copyright_id);
   239                 if ($processor->getInvalidFileNames() !== []) {
   240                     $this->
ui->mainTemplate()->setOnScreenMessage(
   243                             $this->
lng->txt(
'file_upload_info_file_with_critical_extension'),
   244                             implode(
', ', $processor->getInvalidFileNames())
   250                 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_unzip_success'), 
true);
   251                 $this->
ctrl->setParameterByClass(ilRepositoryGUI::class, 
"ref_id", $this->parent_id);
   252                 $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
   255             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'file_not_found'));
   258         $this->tpl->setContent(
   259             $this->
ui->renderer()->render(
   268         $status = $this->current_revision?->getStatus();
   270         $btn_add_version = $this->
ui->factory()->button()->standard(
   271             $this->
lng->txt(
'file_new_version'),
   272             $this->
ctrl->getLinkTarget($this, self::CMD_ADD_NEW_VERSION)
   275             $btn_add_version = $btn_add_version->withUnavailableAction();
   277         $this->
toolbar->addComponent($btn_add_version);
   279         $btn_replace_version = $this->
ui->factory()->button()->standard(
   280             $this->
lng->txt(
'replace_file'),
   281             $this->
ctrl->getLinkTarget($this, self::CMD_ADD_REPLACING_VERSION)
   284             $btn_replace_version = $btn_replace_version->withUnavailableAction();
   286         $this->
toolbar->addComponent($btn_replace_version);
   289         if (null !== $this->current_revision &&
   290             in_array($this->current_revision->getInformation()->getMimeType(), [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED], 
true)
   292             $btn_unzip = $this->
ui->factory()->button()->standard(
   293                 $this->
lng->txt(
'unzip'),
   294                 $this->
ctrl->getLinkTarget($this, self::CMD_UNZIP_CURRENT_REVISION)
   296             $this->
toolbar->addComponent($btn_unzip);
   300         $suffix = $this->current_revision?->getInformation()?->getSuffix();
   302         if ($this->action_repo->hasEditActionForSuffix(
   303             $this->current_revision->getInformation()->getSuffix()
   305             $external_editor = $this->
ui->factory()
   308                                             $this->
lng->txt(
'open_external_editor'),
   309                                             $this->
ctrl->getLinkTargetByClass(
   310                                                 [self::class, ilWOPIEmbeddedApplicationGUI::class],
   314             $this->
toolbar->addComponent($external_editor);
   320             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'file_version_draft_info'));
   322             $btn_publish = $this->
ui->factory()->button()->standard(
   323                 $this->
lng->txt(
'file_publish'),
   324                 $this->
ctrl->getLinkTarget($this, self::CMD_PUBLISH)
   326             $this->
toolbar->addComponent($btn_publish);
   330         $this->tpl->setContent($table->getHTML());
   338         $this->tpl->setContent($form->getHTML());
   348         if ($form->saveObject()) {
   349             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'), 
true);
   350             $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   352         $this->tpl->setContent($form->getHTML());
   358             $this->file->sendFile($this->version_id);
   368         if (count($version_ids) !== 1) {
   369             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"file_rollback_select_exact_one"), 
true);
   370             $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   374             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"file_rollback_rollback_first"), 
true);
   375             $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   379         $version_id = $version_ids[0];
   380         if ($version_id === $this->current_revision->getVersionNumber()) {
   381             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"file_rollback_same_version"), 
true);
   382             $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   385         $this->file->rollback($version_id);
   387         $this->tpl->setOnScreenMessage(
'success', sprintf($this->
lng->txt(
"file_rollback_done"), (string) $version_id), 
true);
   388         $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   395         if (is_array($versions_to_delete) && $versions_to_delete !== []) {
   396             $this->file->deleteVersions($versions_to_delete);
   397             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"file_versions_deleted"), 
true);
   400         $this->
ctrl->setParameter($this, self::HIST_ID, 
"");
   401         $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   406         $parent_id = $this->tree->getParentId($this->ref_id);
   411         $this->
ctrl->setParameterByClass(ilRepositoryGUI::class, 
"ref_id", $parent_id);
   412         $this->
ctrl->redirectByClass(ilRepositoryGUI::class);
   422         if (
'GET' === $this->
http->request()->getMethod() &&
   423             $this->
http->wrapper()->query()->has(self::HIST_ID)
   426                 $this->
http->wrapper()->query()->retrieve(self::HIST_ID, $this->
refinery->kindlyTo()->int()),
   431         if ($this->
http->wrapper()->post()->has(
'interruptive_items')) {
   432             return $this->
http->wrapper()->post()->retrieve(
   433                 'interruptive_items',
   438         if ($this->
http->wrapper()->post()->has(self::HIST_ID)) {
   439             return $this->
http->wrapper()->post()->retrieve(
   450         $versions_to_keep = $this->file->getVersions();
   451         array_udiff($versions_to_keep, $version_ids, 
static function ($v1, $v2): 
bool {
   453                 $v1 = (
int) $v1[
"hist_entry_id"];
   454             } elseif (!is_numeric($v1)) {
   458             if (is_array($v2) || $v2 instanceof ilObjFileVersion) {
   459                 $v2 = (
int) $v2[
"hist_entry_id"];
   460             } elseif (!is_numeric($v2)) {
   467         return $versions_to_keep;
   480             if ($this->wsp_access->checkAccess($a_permission, 
"", $this->ref_id)) {
   483         } elseif ($this->
access->checkAccess($a_permission, 
'', $this->ref_id)) {
   495         $this->
http->saveResponse(
   496             $this->
http->response()->withBody(
   498                     (null !== $delete_selected_versions_modal) ?
   499                         $this->
ui->renderer()->renderAsync([$delete_selected_versions_modal]) :
   502             )->withHeader(
'Content-Type', 
'application/json; charset=utf-8')
   505         $this->
http->sendResponse();
   506         $this->
http->close();
   512         $existing_versions = $this->file->getVersions();
   514         $non_deletion_versions = array_udiff(
   516             $deletion_version_ids,
   517             static function (
$a, 
$b) {
   519                     $a = 
$a->getHistEntryId();
   521                 if (
$b instanceof ilObjFileVersion) {
   522                     $b = 
$b->getHistEntryId();
   530         if (count($non_deletion_versions) < 1) {
   531             return $this->file_component_builder->buildConfirmDeleteAllVersionsModal(
   532                 $this->
ctrl->getFormActionByClass(self::class, self::CMD_CONFIRMED_DELETE_FILE),
   538         if (count($non_deletion_versions) >= 1) {
   539             return $this->file_component_builder->buildConfirmDeleteSpecificVersionsModal(
   540                 $this->
ctrl->getFormActionByClass(self::class, self::CMD_CONFIRMED_DELETE_VERSIONS),
   542                 $deletion_version_ids
   555             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'publish_before_delete'), $redirect);
   557                 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   562         if (count($requested_deletion_version) < 1) {
   563             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"), $redirect);
   565                 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
   575         $existing_versions = $this->file->getVersions();
   576         $remaining_versions = array_udiff(
   579             static function (
$a, 
$b) {
   581                     $a = 
$a->getHistEntryId();
   583                 if (
$b instanceof ilObjFileVersion) {
   584                     $b = 
$b->getHistEntryId();
   593         $conf_gui->setFormAction($this->
ctrl->getFormAction($this, self::CMD_DEFAULT));
   594         $conf_gui->setCancel($this->
lng->txt(
"cancel"), self::CMD_DEFAULT);
   597         $alt = $this->
lng->txt(
"icon") . 
" " . $this->
lng->txt(
"obj_" . $this->file->getType());
   600         if (count($remaining_versions) < 1) {
   602             $conf_gui->setHeaderText($this->
lng->txt(
'file_confirm_delete_all_versions'));
   603             $conf_gui->setConfirm($this->
lng->txt(
"confirm"), self::CMD_CONFIRMED_DELETE_FILE);
   607                 $this->file->getTitle(),
   613             $conf_gui->setHeaderText($this->
lng->txt(
'file_confirm_delete_versions'));
   614             $conf_gui->setConfirm($this->
lng->txt(
"confirm"), self::CMD_CONFIRMED_DELETE_VERSIONS);
   616             foreach ($this->file->getVersions($version_ids) as 
$version) {
   617                 $a_text = 
$version[
'filename'] ?? 
$version->getFilename() ?? $this->file->getTitle();
   619                 $a_text .= 
" (v" . $version_string . 
")";
   630         $this->tpl->setContent($conf_gui->getHTML());
   636         $copyright_options = [];
   637         $form_action = $this->
ctrl->getFormActionByClass(self::class, self::CMD_PROCESS_UNZIP);
   639         $inputs[self::KEY_FILE_RID] = $this->
ui->factory()->input()->field()->hidden()->withValue(
   640             $this->file->getResourceId()
   642         $inputs[self::KEY_FILE_STRUCTURE] = $this->
ui->factory()->input()->field()->checkbox(
   643             $this->
lng->txt(
'take_over_structure'),
   644             $this->
lng->txt(
'take_over_structure_info'),
   649             return $this->
ui->factory()->input()->container()->form()->standard($form_action, 
$inputs);
   653         $zip_md = 
new ilMD($this->file->getId(), 0, $this->file->getType());
   654         $rights = $zip_md->getRights();
   655         if ($rights !== null) {
   656             $zip_copyright_description = $zip_md->getRights()->getDescription();
   658             $copyright_inheritance_input = $this->
ui->factory()->input()->field()->hidden()->withValue(
   659                 (
string) $zip_copyright_id
   661             $copyright_options[self::KEY_INHERIT_COPYRIGHT] = $this->
ui->factory()->input()->field()->group(
   662                 [self::KEY_COPYRIGHT_ID => $copyright_inheritance_input],
   663                 $this->
lng->txt(
"copyright_inherited"),
   665                     $this->
lng->txt(
"copyright_inherited_info"),
   671         $copyright_selection_input = $this->getCopyrightSelectionInput(
'set_license_for_all_files');
   672         $copyright_options[self::KEY_SELECT_COPYRIGHT] = $this->
ui->factory()->input()->field()->group(
   673             [self::KEY_COPYRIGHT_ID => $copyright_selection_input],
   674             $this->
lng->txt(
"copyright_custom"),
   675             $this->
lng->txt(
"copyright_custom_info")
   678         $inputs[self::KEY_COPYRIGHT_OPTION] = $this->
ui->factory()->input()->field()->switchableGroup(
   680             $this->
lng->txt(
"md_copyright")
   681         )->
withValue(self::KEY_SELECT_COPYRIGHT);
   683         return $this->
ui->factory()->input()->container()->form()->standard($form_action, 
$inputs);
   690         if ($keep_structure) {
   694                     $this->file->getId(),
   699                 $this->file_service_settings,
   707                 $this->file->getId(),
   712             $this->file_service_settings,
   719         return $this->storage->manage()->find($this->file->getResourceId());
   725         if (null !== $file_rid) {
   726             return $this->storage->manage()->getCurrentRevisionIncludingDraft($file_rid);
   741         return $this->
http->wrapper()->query()->has(
'wsp_id');
   746         return $this->
ui->factory();
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getVersionIdsFromRequest()
 
const CMD_DELETE_VERSIONS
 
Class ilObjFileStakeholder. 
 
static _extractEntryId(string $a_cp_string)
 
__construct(private ilObjFile $file)
ilFileVersionsGUI constructor. 
 
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item. 
 
getDeleteSelectedVersionsModal()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Interface ilObjFileProcessorInterface. 
 
saveVersion(int $mode=ilFileVersionFormGUI::MODE_ADD)
 
Class ChatMainBarProvider . 
 
static deleteObjects(int $a_cur_ref_id, array $a_ids)
Delete objects. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ILIAS ResourceStorage Services $storage
 
const CMD_DOWNLOAD_VERSION
 
ilGlobalTemplateInterface $tpl
 
const CMD_CONFIRMED_DELETE_VERSIONS
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Revision $current_revision
 
static http()
Fetches the global http state from ILIAS. 
 
ilWorkspaceAccessHandler $wsp_access
 
const KEY_SELECT_COPYRIGHT
 
hasPermission(string $a_permission)
bugfix mantis 26007: this function was created to ensure that the access check not only works for rep...
 
addVersion(int $mode=ilFileVersionFormGUI::MODE_ADD)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const CMD_UNZIP_CURRENT_REVISION
 
Class ilFileVersionsUploadHandlerGUI. 
 
ilObjFileComponentBuilder $file_component_builder
 
Class ilFileVersionsTableGUI. 
 
The scope of this class is split ilias-conform URI's into components. 
 
const CMD_CONFIRMED_DELETE_FILE
 
renderDeleteSelectedVersionsModal()
 
const CMD_ADD_REPLACING_VERSION
 
getVersionsToKeep(array $version_ids)
 
GUI class for file objects. 
 
const KEY_INHERIT_COPYRIGHT
 
ActionRepository $action_repo
 
const CMD_ADD_NEW_VERSION
 
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples 
 
ilFileServicesSettings $file_service_settings
 
Indicates that a file is missing or not found. 
 
static lookupCopyyrightTitle(string $a_cp_string)
 
const CMD_ROLLBACK_VERSION
 
getFileProcessor(bool $keep_structure)
 
Class ilObjFileUnzipRecursiveProcessor. 
 
const KEY_COPYRIGHT_OPTION
 
const CMD_CREATE_REPLACING_VERSION
 
const CMD_RENDER_DELETE_SELECTED_VERSIONS_MODAL
 
const CMD_CREATE_NEW_VERSION
 
checkSanityOfDeletionRequest(array $requested_deletion_version, bool $redirect)
 
Class ilObjFileUnzipFlatProcessor.