ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjFileComponentBuilder.php
Go to the documentation of this file.
1 <?php
2 
18 declare(strict_types=1);
19 
21 
26 {
27  public function __construct(
28  protected ilLanguage $lng,
29  protected \ILIAS\DI\UIServices $ui
30  ) {
31  }
32 
34  string $action,
35  ilObjFile $file,
36  array $version_ids
37  ): Interruptive {
38  $icon = $this->ui->factory()->image()->standard(
39  ilObject::_getIcon($file->getId(), "small", $file->getType()),
40  $this->lng->txt("icon") . " " . $this->lng->txt("obj_" . $file->getType())
41  );
42 
43  $modal_items = [];
44  foreach ($file->getVersions($version_ids) as $version) {
45  $filename = $version['filename'] ?? $version->getFilename() ?? $file->getTitle();
46  $version_nr = $version['hist_id'] ?? $version->getVersion();
47  $item_title = $filename . " (v" . $version_nr . ")";
48  $modal_items[] = $this->ui->factory()->modal()->interruptiveItem()->standard(
49  (string) $version['hist_entry_id'],
50  $item_title,
51  $icon
52  );
53  }
54 
55  return $this->ui->factory()->modal()->interruptive(
56  $this->lng->txt('delete'),
57  $this->lng->txt('file_confirm_delete_versions'),
58  $action
59  )->withAffectedItems(
60  $modal_items
61  );
62  }
63 
65  string $action,
66  ilObjFile $file,
67  ): Interruptive {
68  $icon = $this->ui->factory()->image()->standard(
69  ilObject::_getIcon($file->getId(), "small", $file->getType()),
70  $this->lng->txt("icon") . " " . $this->lng->txt("obj_" . $file->getType())
71  );
72 
73  return $this->ui->factory()->modal()->interruptive(
74  $this->lng->txt('delete'),
75  $this->lng->txt('file_confirm_delete_all_versions'),
76  $action
77  )->withAffectedItems(
78  [
79  $this->ui->factory()->modal()->interruptiveItem()->standard(
80  (string) $file->getRefId(),
81  $file->getTitle(),
82  $icon
83  )
84  ]
85  );
86  }
87 }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
Class ChatMainBarProvider .
buildConfirmDeleteAllVersionsModal(string $action, ilObjFile $file,)
$lng
Class HTTPServicesTest.
Class ilObjFile.
buildConfirmDeleteSpecificVersionsModal(string $action, ilObjFile $file, array $version_ids)
$filename
Definition: buildRTE.php:78
__construct(protected ilLanguage $lng, protected \ILIAS\DI\UIServices $ui)
getVersions($version_ids=null)
$version
Definition: plugin.php:24