ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCtrlAwareStorageUploadHandler Class Reference

Class ilCtrlAwareStorageUploadHandler. More...

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

Public Member Functions

 __construct (protected 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

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 ( protected ResourceStakeholder  $stakeholder)

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

40 {
41 global $DIC;
43 $this->storage = $DIC->resourceStorage();
44 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, 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 102 of file class.ilCtrlAwareStorageUploadHandler.php.

102 : array
103 {
104 $info_results = [];
105 foreach ($file_ids as $identifier) {
106 $info_results[] = $this->getInfoResult($identifier);
107 }
108
109 return $info_results;
110 }

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

88 {
89 if (null !== ($id = $this->storage->manage()->find($identifier))) {
90 $revision = $this->storage->manage()->getCurrentRevision($id)->getInformation();
91 $title = $revision->getTitle();
92 $size = $revision->getSize();
93 $mime = $revision->getMimeType();
94 } else {
95 $title = $mime = 'unknown';
96 $size = 0;
97 }
98
99 return new BasicFileInfoResult($this->getFileIdentifierParameterName(), $identifier, $title, $size, $mime);
100 }
$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 73 of file class.ilCtrlAwareStorageUploadHandler.php.

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

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 ilObjBibliographicUploadHandlerGUI, ilOrgUnitTypeUploadHandlerGUI, and ilStudyProgrammeTypeUploadHandlerGUI.

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

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

◆ $storage

Services ilCtrlAwareStorageUploadHandler::$storage
protected

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


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