ILIAS  release_8 Revision v8.24
ilObjFileImplementationStorage Class Reference

Class ilObjFileImplementationStorage. More...

+ Inheritance diagram for ilObjFileImplementationStorage:
+ Collaboration diagram for ilObjFileImplementationStorage:

Public Member Functions

 handleChangedObjectTitle (string $new_title)
 
 getFile (?int $a_hist_entry_id=null)
 @inheritDoc More...
 
 getFileSize ()
 
 getFileType ()
 @inheritDoc More...
 
 getDirectory (int $a_version=0)
 
 sendFile (?int $a_hist_entry_id=null, bool $inline=true)
 
 deleteVersions (?array $a_hist_entry_ids=null)
 Deletes the specified history entries or all entries if no ids are specified. More...
 
 getFileExtension ()
 Returns the extension of the file name converted to lower-case. More...
 
 getVersions (?array $version_ids=null)
 
 getStorageID ()
 
 getVersion ()
 
 getMaxVersion ()
 
 getDirectory (int $a_version=0)
 
 deleteVersions (?array $a_hist_entry_ids=null)
 Deletes the specified history entries or all entries if no ids are specified. More...
 
 getFileType ()
 
 getStorageID ()
 
 getFileSize ()
 
 getFile (?int $a_hist_entry_id=null)
 
 getVersion ()
 
 getMaxVersion ()
 
 sendFile (?int $a_hist_entry_id=null, bool $inline=true)
 
 handleChangedObjectTitle (string $new_title)
 
 getFileExtension ()
 Returns the extension of the file name converted to lower-case. More...
 
 getVersions (?array $version_ids=null)
 Gets the file versions for this object. More...
 

Protected Attributes

StorableResource $resource
 
Services $storage
 
bool $download_with_uploaded_filename
 

Detailed Description

Member Function Documentation

◆ deleteVersions()

ilObjFileImplementationStorage::deleteVersions ( ?array  $a_hist_entry_ids = null)

Deletes the specified history entries or all entries if no ids are specified.

Parameters
array | null$a_hist_entry_idsThe ids of the entries to delete or null to delete all entries
Deprecated:

Implements ilObjFileImplementationInterface.

Definition at line 119 of file class.ilObjFileImplementationStorage.php.

119 : void
120 {
121 if (is_array($a_hist_entry_ids)) {
122 foreach ($a_hist_entry_ids as $id) {
123 $this->storage->manage()->removeRevision($this->resource->getIdentification(), $id);
124 }
125 }
126 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ getDirectory()

ilObjFileImplementationStorage::getDirectory ( int  $a_version = 0)
Deprecated:

Implements ilObjFileImplementationInterface.

Definition at line 83 of file class.ilObjFileImplementationStorage.php.

83 : string
84 {
85 $consumer = $this->storage->consume()->stream($this->resource->getIdentification());
86 if ($a_version) {
87 $consumer->setRevisionNumber($a_version);
88 }
89 $stream = $consumer->getStream();
90
91 return dirname($stream->getMetadata('uri'));
92 }

◆ getFile()

ilObjFileImplementationStorage::getFile ( ?int  $a_hist_entry_id = null)

@inheritDoc

Implements ilObjFileImplementationInterface.

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

61 : string
62 {
63 $stream = $this->storage->consume()->stream($this->resource->getIdentification());
64 if ($a_hist_entry_id) {
65 $stream = $stream->setRevisionNumber($a_hist_entry_id);
66 }
67 return $stream->getStream()->getMetadata('uri');
68 }

◆ getFileExtension()

ilObjFileImplementationStorage::getFileExtension ( )

Returns the extension of the file name converted to lower-case.

e.g. returns 'pdf' for 'document.pdf'.

Implements ilObjFileImplementationInterface.

Definition at line 128 of file class.ilObjFileImplementationStorage.php.

128 : string
129 {
130 return $this->resource->getCurrentRevision()->getInformation()->getSuffix();
131 }

◆ getFileSize()

ilObjFileImplementationStorage::getFileSize ( )

Implements ilObjFileImplementationInterface.

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

70 : int
71 {
72 return $this->resource->getCurrentRevision()->getInformation()->getSize() ?: 0;
73 }

◆ getFileType()

ilObjFileImplementationStorage::getFileType ( )

@inheritDoc

Implements ilObjFileImplementationInterface.

Definition at line 78 of file class.ilObjFileImplementationStorage.php.

78 : string
79 {
80 return $this->resource->getCurrentRevision()->getInformation()->getMimeType();
81 }

◆ getMaxVersion()

ilObjFileImplementationStorage::getMaxVersion ( )

Implements ilObjFileImplementationInterface.

Definition at line 170 of file class.ilObjFileImplementationStorage.php.

170 : int
171 {
172 return $this->resource->getMaxRevision();
173 }

◆ getStorageID()

ilObjFileImplementationStorage::getStorageID ( )

Implements ilObjFileImplementationInterface.

Definition at line 160 of file class.ilObjFileImplementationStorage.php.

160 : ?string
161 {
162 return $this->resource->getStorageID();
163 }

◆ getVersion()

ilObjFileImplementationStorage::getVersion ( )

Implements ilObjFileImplementationInterface.

Definition at line 165 of file class.ilObjFileImplementationStorage.php.

165 : int
166 {
167 return $this->resource->getCurrentRevision()->getVersionNumber();
168 }

◆ getVersions()

ilObjFileImplementationStorage::getVersions ( ?array  $version_ids = null)
Returns
\ilObjFileVersion[]

Implements ilObjFileImplementationInterface.

Definition at line 136 of file class.ilObjFileImplementationStorage.php.

136 : array
137 {
138 $versions = [];
139 foreach ($this->resource->getAllRevisions() as $revision) {
140 if (is_array($version_ids) && !in_array($revision->getVersionNumber(), $version_ids)) {
141 continue;
142 }
143 $information = $revision->getInformation();
144 $v = new ilObjFileVersion();
145 $v->setVersion($revision->getVersionNumber());
146 $v->setHistEntryId($revision->getVersionNumber());
147 $v->setFilename($information->getTitle());
148 $v->setAction($revision->getVersionNumber() === 1 ? 'create' : 'new_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());
153
154 $versions[] = $v;
155 }
156
157 return $versions;
158 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ handleChangedObjectTitle()

ilObjFileImplementationStorage::handleChangedObjectTitle ( string  $new_title)

Implements ilObjFileImplementationInterface.

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

51 : void
52 {
53 $current_revision = $this->resource->getCurrentRevision();
54 $current_revision->setTitle($new_title);
55 $this->storage->manage()->updateRevision($current_revision);
56 }

◆ sendFile()

ilObjFileImplementationStorage::sendFile ( ?int  $a_hist_entry_id = null,
bool  $inline = true 
)
Parameters
bool$inline
Deprecated:

Implements ilObjFileImplementationInterface.

Definition at line 94 of file class.ilObjFileImplementationStorage.php.

94 : void
95 {
96 if ($inline) {
97 $consumer = $this->storage->consume()->inline($this->resource->getIdentification());
98 } else {
99 $consumer = $this->storage->consume()->download($this->resource->getIdentification());
100 }
101
102 if ($a_hist_entry_id) {
103 $revision = $this->resource->getSpecificRevision($a_hist_entry_id);
104 $consumer->setRevisionNumber($a_hist_entry_id);
105 } else {
106 $revision = $this->resource->getCurrentRevision();
107 }
108
109 if ($this->download_with_uploaded_filename) {
110 $consumer->overrideFileName($revision->getInformation()->getTitle());
111 } else {
112 $consumer->overrideFileName($revision->getTitle());
113 }
114
115 $consumer->run();
116 }

Field Documentation

◆ $download_with_uploaded_filename

bool ilObjFileImplementationStorage::$download_with_uploaded_filename
protected

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

◆ $resource

StorableResource ilObjFileImplementationStorage::$resource
protected

Definition at line 30 of file class.ilObjFileImplementationStorage.php.

◆ $storage

Services ilObjFileImplementationStorage::$storage
protected

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


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