39 $this->storage = $DIC->resourceStorage();
44 $current_revision = $this->resource->getCurrentRevision();
45 $current_revision->setTitle($new_title);
46 $this->storage->manage()->updateRevision($current_revision);
54 $stream = $this->storage->consume()->stream($this->resource->getIdentification());
55 if ($a_hist_entry_id) {
56 $stream = $stream->setRevisionNumber($a_hist_entry_id);
58 return $stream->getStream()->getMetadata(
'uri');
63 return $this->resource->getCurrentRevision()->getInformation()->getTitle();
68 return $this->resource->getCurrentRevision()->getInformation()->getSize() ?: 0;
76 return $this->resource->getCurrentRevision()->getInformation()->getMimeType();
81 $consumer = $this->storage->consume()->stream($this->resource->getIdentification());
82 if ($a_version !== 0) {
83 $consumer->setRevisionNumber($a_version);
85 $stream = $consumer->getStream();
87 return dirname((
string) $stream->getMetadata(
'uri'));
90 public function sendFile(?
int $a_hist_entry_id =
null,
bool $inline =
true): void
93 $consumer = $this->storage->consume()->inline($this->resource->getIdentification());
95 $consumer = $this->storage->consume()->download($this->resource->getIdentification());
98 if ($a_hist_entry_id) {
99 $revision = $this->resource->getSpecificRevision($a_hist_entry_id);
100 $consumer->setRevisionNumber($a_hist_entry_id);
102 $revision = $this->resource->getCurrentRevision();
104 $consumer->overrideFileName($revision->getTitle());
111 if (is_array($a_hist_entry_ids)) {
112 foreach ($a_hist_entry_ids as
$id) {
113 $this->storage->manage()->removeRevision($this->resource->getIdentification(),
$id);
120 return $this->resource->getCurrentRevision()->getInformation()->getSuffix();
129 $current_revision = $this->resource->getCurrentRevisionIncludingDraft();
130 foreach ($this->resource->getAllRevisionsIncludingDraft() as $revision) {
131 if (is_array($version_ids) && !in_array($revision->getVersionNumber(), $version_ids)) {
134 $information = $revision->getInformation();
136 $v->setVersion($revision->getVersionNumber());
137 $v->setHistEntryId($revision->getVersionNumber());
138 $v->setFilename($information->getTitle());
140 $v->setAction(
'draft');
142 $version_number = $revision->getVersionNumber();
143 match ($version_number) {
144 1 => $v->setAction(
'create'),
145 $current_revision->getVersionNumber() => $v->setAction(
'published_version'),
146 default => $v->setAction(
'intermediate_version'),
149 $v->setTitle($revision->getTitle());
150 $v->setDate($information->getCreationDate()->format(DATE_ATOM));
151 $v->setUserId($revision->getOwnerId() !== 0 ? $revision->getOwnerId() : 6);
152 $v->setSize($information->getSize());
162 return $this->resource->getStorageID();
168 if ($inclduing_drafts) {
169 return $this->resource->getCurrentRevisionIncludingDraft()->getVersionNumber();
171 return $this->resource->getCurrentRevision()->getVersionNumber();
179 return $this->resource->getMaxRevision(
false);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getVersions(?array $version_ids=null)
Class ilObjFileImplementationStorage.
Interface StorageResource.
getVersion(bool $inclduing_drafts=false)
deleteVersions(?array $a_hist_entry_ids=null)
Deletes the specified history entries or all entries if no ids are specified.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFileExtension()
Returns the extension of the file name converted to lower-case.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
sendFile(?int $a_hist_entry_id=null, bool $inline=true)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getFile(?int $a_hist_entry_id=null)
__construct(protected StorableResource $resource)
ilObjFileImplementationStorage constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getDirectory(int $a_version=0)
handleChangedObjectTitle(string $new_title)