ILIAS  release_8 Revision v8.24
ilCtrlAwareStorageUploadHandler Class Reference

Class ilCtrlAwareStorageUploadHandler. More...

+ Inheritance diagram for ilCtrlAwareStorageUploadHandler:
+ Collaboration diagram for ilCtrlAwareStorageUploadHandler:

Public Member Functions

 __construct (ResourceStakeholder $stakeholder)
 
 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 ()
 
 getRemoveResult (string $identifier)
 
- Protected Member Functions inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
 readChunkedInformation ()
 
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 

Protected Attributes

ResourceStakeholder $stakeholder
 
ILIAS ResourceStorage Services $storage
 
- 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

Constructor & Destructor Documentation

◆ __construct()

ilCtrlAwareStorageUploadHandler::__construct ( ResourceStakeholder  $stakeholder)

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

43 {
44 global $DIC;
46 $this->storage = $DIC->resourceStorage();
47 $this->stakeholder = $stakeholder;
48 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, $stakeholder, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getInfoForExistingFiles()

ilCtrlAwareStorageUploadHandler::getInfoForExistingFiles ( array  $file_ids)
Parameters
array$file_ids
Returns
BasicFileInfoResult[]

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 106 of file class.ilCtrlAwareStorageUploadHandler.php.

106 : array
107 {
108 $info_results = [];
109 foreach ($file_ids as $identifier) {
110 $info_results[] = $this->getInfoResult($identifier);
111 }
112
113 return $info_results;
114 }

References getInfoResult().

+ Here is the call graph for this function:

◆ getInfoResult()

ilCtrlAwareStorageUploadHandler::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 91 of file class.ilCtrlAwareStorageUploadHandler.php.

92 {
93 if (null !== ($id = $this->storage->manage()->find($identifier))) {
94 $revision = $this->storage->manage()->getCurrentRevision($id)->getInformation();
95 $title = $revision->getTitle();
96 $size = $revision->getSize();
97 $mime = $revision->getMimeType();
98 } else {
99 $title = $mime = 'unknown';
100 $size = 0;
101 }
102
103 return new BasicFileInfoResult($this->getFileIdentifierParameterName(), $identifier, $title, $size, $mime);
104 }
$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()

ilCtrlAwareStorageUploadHandler::getRemoveResult ( string  $identifier)
protected

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 77 of file class.ilCtrlAwareStorageUploadHandler.php.

78 {
79 if (null !== ($id = $this->storage->manage()->find($identifier))) {
80 $this->storage->manage()->remove($id, $this->stakeholder);
81 $status = HandlerResult::STATUS_OK;
82 $message = "file removal OK";
83 } else {
84 $status = HandlerResult::STATUS_OK;
85 $message = "file with identifier '$identifier' doesn't exist, nothing to do.";
86 }
87
88 return new BasicHandlerResult($this->getFileIdentifierParameterName(), $status, $identifier, $message);
89 }
$message
Definition: xapiexit.php:32

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

+ Here is the call graph for this function:

◆ getUploadResult()

ilCtrlAwareStorageUploadHandler::getUploadResult ( )
protected

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Reimplemented in ilFileVersionsUploadHandlerGUI.

Definition at line 50 of file class.ilCtrlAwareStorageUploadHandler.php.

51 {
52 $this->upload->register(new ilCountPDFPagesPreProcessors());
53 $this->upload->process();
54
55 $result_array = $this->upload->getResults();
56 $result = end($result_array);
57
58 if ($result instanceof UploadResult && $result->isOK()) {
59 if (!$this->is_chunked) {
60 $identifier = $this->storage->manage()->upload($result, $this->stakeholder)->serialize();
61 $status = HandlerResult::STATUS_OK;
62 $message = "file upload OK";
63 } else {
64 $identifier = '';
65 $status = HandlerResult::STATUS_FAILED;
66 $message = 'chunking not supported';
67 }
68 } else {
69 $identifier = '';
70 $status = HandlerResult::STATUS_FAILED;
71 $message = $result->getStatus()->getMessage();
72 }
73
74 return new BasicHandlerResult($this->getFileIdentifierParameterName(), $status, $identifier, $message);
75 }
Class ilCountPDFPagesPreProcessors.

References $message, ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName(), ILIAS\FileUpload\DTO\UploadResult\isOK(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Field Documentation

◆ $stakeholder

ResourceStakeholder ilCtrlAwareStorageUploadHandler::$stakeholder
protected

Definition at line 39 of file class.ilCtrlAwareStorageUploadHandler.php.

Referenced by __construct().

◆ $storage

ILIAS ResourceStorage Services ilCtrlAwareStorageUploadHandler::$storage
protected

Definition at line 40 of file class.ilCtrlAwareStorageUploadHandler.php.


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