ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
TileImageUploadHandlerGUI Class Reference
+ Inheritance diagram for TileImageUploadHandlerGUI:
+ Collaboration diagram for TileImageUploadHandlerGUI:

Public Member Functions

 getInfoResult (string $identifier)
 
 getInfoForExistingFiles (array $file_ids)
 
- Public Member Functions inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
 __construct ()
 ilUIDemoFileUploadHandlerGUI constructor. More...
 
 getFileIdentifierParameterName ()
 @inheritDoc More...
 
 getUploadURL ()
 @inheritDoc More...
 
 getExistingFileInfoURL ()
 @inheritDoc More...
 
 getFileRemovalURL ()
 @inheritDoc More...
 
 executeCommand ()
 Since this is a ilCtrl aware UploadHandler executeCommand MUST be implemented. More...
 
 getInfoResult (string $identifier)
 
 getInfoForExistingFiles (array $file_ids)
 
 supportsChunkedUploads ()
 
 executeCommand ()
 Since this is a ilCtrl aware UploadHandler executeCommand MUST be implemented. More...
 
 getFileIdentifierParameterName ()
 
 getUploadURL ()
 
 getFileRemovalURL ()
 
 getExistingFileInfoURL ()
 
 getInfoForExistingFiles (array $file_ids)
 
 getInfoResult (string $identifier)
 
 supportsChunkedUploads ()
 

Protected Member Functions

 getUploadResult ()
 @inheritDoc More...
 
 getRemoveResult (string $identifier)
 
- Protected Member Functions inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
 readChunkedInformation ()
 
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 

Protected Attributes

ilLanguage $language
 
ResourceStorageServices $storage
 
Stakeholder $stakeholder
 
FlavourDefinition $flavour
 
ResourceIdentification $rid = null
 
bool $has_access = false
 
- Protected Attributes inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
const CMD_UPLOAD = 'upload'
 
const CMD_REMOVE = 'remove'
 
const CMD_INFO = 'info'
 
HttpServices $http
 
ilCtrl $ctrl
 
FileUpload $upload
 
bool $is_chunked = false
 
int $chunk_index = 0
 
int $amount_of_chunks = 0
 
string $chunk_id = null
 
int $chunk_total_size = 0
 

Additional Inherited Members

- Data Fields inherited from ILIAS\UI\Component\Input\Field\UploadHandler
const DEFAULT_FILE_ID_PARAMETER = 'file_id'
 

Detailed Description

Member Function Documentation

◆ getInfoForExistingFiles()

TileImageUploadHandlerGUI::getInfoForExistingFiles ( array  $file_ids)
Returns
\ILIAS\FileUpload\Handler\BasicFileInfoResult[]

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 179 of file class.TileImageUploadHandlerGUI.php.

179 : array
180 {
181 $info_results = [];
182 foreach ($file_ids as $identifier) {
183 $info_results[] = $this->getInfoResult($identifier);
184 }
185
186 return $info_results;
187 }

References getInfoResult().

+ Here is the call graph for this function:

◆ getInfoResult()

TileImageUploadHandlerGUI::getInfoResult ( string  $identifier)
Returns
null|FileInfoResult for the file with the given identifier or null if the file does not exist.

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 155 of file class.TileImageUploadHandlerGUI.php.

156 {
157 if (null !== ($id = $this->storage->manage()->find($identifier))) {
158 $revision = $this->storage->manage()->getCurrentRevision($id)->getInformation();
159 $title = $revision->getTitle();
160 $size = $revision->getSize();
161 $mime = $revision->getMimeType();
162 } else {
163 $title = $mime = 'unknown';
164 $size = 0;
165 }
166
167 return new BasicFileInfoResult(
169 $identifier,
170 $title,
171 $size,
172 $mime
173 );
174 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName(), and ILIAS\FileUpload\Handler\FileInfoResult\getSize().

Referenced by getInfoForExistingFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRemoveResult()

TileImageUploadHandlerGUI::getRemoveResult ( string  $identifier)
protected

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 137 of file class.TileImageUploadHandlerGUI.php.

138 {
139 if ($this->has_access === false) {
140 return $this->getAccessFailureResult(
142 $identifier,
143 $this->language
144 );
145 }
146
147 return new BasicHandlerResult(
149 HandlerResult::STATUS_OK,
150 $identifier,
151 "We just don't do anything here."
152 );
153 }

References ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ getUploadResult()

TileImageUploadHandlerGUI::getUploadResult ( )
protected

@inheritDoc

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 88 of file class.TileImageUploadHandlerGUI.php.

89 {
90 if ($this->has_access === false) {
91 return $this->getAccessFailureResult(
93 '',
94 $this->language
95 );
96 }
97
98 $this->upload->process();
99
100 $result_array = $this->upload->getResults();
101 $result = end($result_array);
102
103 if (!($result instanceof UploadResult)
104 || !in_array($result->getMimeType(), TileImage::SUPPORTED_MIME_TYPES)
105 || !$result->isOK()) {
106 return new BasicHandlerResult(
108 HandlerResult::STATUS_FAILED,
109 '',
110 $result->getStatus()->getMessage()
111 );
112 }
113
114 $status = HandlerResult::STATUS_OK;
115 $message = "file upload OK";
116 if ($this->rid === null) {
117 $i = $this->storage->manage()->upload($result, $this->stakeholder);
118 } else {
119 $i = $this->rid;
120 $this->storage->manage()->replaceWithUpload(
121 $i,
122 $result,
123 $this->stakeholder
124 );
125 }
126
127 $this->storage->flavours()->ensure($i, $this->flavour);
128
129 return new BasicHandlerResult(
131 $status,
132 $i->serialize(),
133 $message
134 );
135 }

References $rid, ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Field Documentation

◆ $flavour

FlavourDefinition TileImageUploadHandlerGUI::$flavour
protected

Definition at line 45 of file class.TileImageUploadHandlerGUI.php.

◆ $has_access

bool TileImageUploadHandlerGUI::$has_access = false
protected

Definition at line 48 of file class.TileImageUploadHandlerGUI.php.

◆ $language

ilLanguage TileImageUploadHandlerGUI::$language
protected

Definition at line 42 of file class.TileImageUploadHandlerGUI.php.

◆ $rid

ResourceIdentification TileImageUploadHandlerGUI::$rid = null
protected

Definition at line 47 of file class.TileImageUploadHandlerGUI.php.

Referenced by getUploadResult().

◆ $stakeholder

Stakeholder TileImageUploadHandlerGUI::$stakeholder
protected

Definition at line 44 of file class.TileImageUploadHandlerGUI.php.

◆ $storage

ResourceStorageServices TileImageUploadHandlerGUI::$storage
protected

Definition at line 43 of file class.TileImageUploadHandlerGUI.php.


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