ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjFileComponentBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
28{
29 public function __construct(
30 protected ilLanguage $lng,
31 protected UIServices $ui
32 ) {
33 }
34
36 string $action,
37 ilObjFile $file,
38 array $version_ids
39 ): Interruptive {
40 $icon = $this->ui->factory()->image()->standard(
41 ilObject::_getIcon($file->getId(), "small", $file->getType()),
42 $this->lng->txt("icon") . " " . $this->lng->txt("obj_" . $file->getType())
43 );
44
45 $modal_items = [];
46 foreach ($file->getVersions($version_ids) as $version) {
47 $filename = $version['filename'] ?? $version->getFilename() ?? $file->getTitle();
48 $version_nr = $version['hist_id'] ?? $version->getVersion();
49 $item_title = $filename . " (v" . $version_nr . ")";
50 $modal_items[] = $this->ui->factory()->modal()->interruptiveItem()->standard(
51 (string) $version['hist_entry_id'],
52 $item_title,
53 $icon
54 );
55 }
56
57 return $this->ui->factory()->modal()->interruptive(
58 $this->lng->txt('delete'),
59 $this->lng->txt('file_confirm_delete_versions'),
60 $action
61 )->withAffectedItems(
62 $modal_items
63 );
64 }
65
67 string $action,
68 ilObjFile $file,
69 ): Interruptive {
70 $icon = $this->ui->factory()->image()->standard(
71 ilObject::_getIcon($file->getId(), "small", $file->getType()),
72 $this->lng->txt("icon") . " " . $this->lng->txt("obj_" . $file->getType())
73 );
74
75 return $this->ui->factory()->modal()->interruptive(
76 $this->lng->txt('delete'),
77 $this->lng->txt('file_confirm_delete_all_versions'),
78 $action
79 )->withAffectedItems(
80 [
81 $this->ui->factory()->modal()->interruptiveItem()->standard(
82 (string) $file->getRefId(),
83 $file->getTitle(),
84 $icon
85 )
86 ]
87 );
88 }
89}
$version
Definition: plugin.php:24
factory()
$filename
Definition: buildRTE.php:78
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
language handling
__construct(protected ilLanguage $lng, protected UIServices $ui)
buildConfirmDeleteAllVersionsModal(string $action, ilObjFile $file,)
buildConfirmDeleteSpecificVersionsModal(string $action, ilObjFile $file, array $version_ids)
Class ilObjFile.
getVersions($version_ids=null)
Class ilObject Basic functions for all objects.
global $lng
Definition: privfeed.php:31