ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
CustomIconUploadHandlerGUI Class Reference
+ Inheritance diagram for CustomIconUploadHandlerGUI:
+ Collaboration diagram for CustomIconUploadHandlerGUI:

Public Member Functions

 getInfoResult (string $file_name)
 
 getInfoForExistingFiles (array $file_names)
 
- 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 $file_name)
 
- Protected Member Functions inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
 readChunkedInformation ()
 
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 

Protected Attributes

ilLanguage $language
 
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()

CustomIconUploadHandlerGUI::getInfoForExistingFiles ( array  $file_names)
Returns
\ILIAS\FileUpload\Handler\BasicFileInfoResult[]

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 143 of file class.CustomIconUploadHandlerGUI.php.

143 : array
144 {
145 return [$this->getInfoResult('custom_icon')];
146 }

References getInfoResult().

+ Here is the call graph for this function:

◆ getInfoResult()

CustomIconUploadHandlerGUI::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 123 of file class.CustomIconUploadHandlerGUI.php.

124 {
125 if ($this->has_access === false) {
126 return null;
127 }
128
129 $file_path = $this->custom_icon->getFullPath();
130
131 return new BasicFileInfoResult(
133 'custom_icon',
134 $this->language->txt('custom_icon'),
135 filesize($file_path),
136 MimeType::IMAGE__SVG_XML
137 );
138 }

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

Referenced by getInfoForExistingFiles().

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

◆ getRemoveResult()

CustomIconUploadHandlerGUI::getRemoveResult ( string  $file_name)
protected

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 105 of file class.CustomIconUploadHandlerGUI.php.

106 {
107 if ($this->has_access === false) {
108 return $this->getAccessFailureResult(
110 $file_name,
111 $this->language
112 );
113 }
114
115 return new BasicHandlerResult(
117 HandlerResult::STATUS_OK,
118 $file_name,
119 'There is nothing to do here.'
120 );
121 }

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

+ Here is the call graph for this function:

◆ getUploadResult()

CustomIconUploadHandlerGUI::getUploadResult ( )
protected

@inheritDoc

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 69 of file class.CustomIconUploadHandlerGUI.php.

70 {
71 $tempfile = '';
72 if ($this->has_access === false) {
73 return $this->getAccessFailureResult(
75 $tempfile,
76 $this->language
77 );
78 }
79
80 $this->upload->process();
81
82 $result_array = $this->upload->getResults();
83 $result = end($result_array);
84
85 if ($result instanceof UploadResult
86 && in_array($result->getMimeType(), Icon::SUPPORTED_MIME_TYPES)
87 && $result->isOK()) {
88 $status = HandlerResult::STATUS_OK;
89 $message = 'Upload ok';
90 $tempfile = \ilFileUtils::ilTempnam();
91 rename($result->getPath(), $tempfile);
92 } else {
93 $status = HandlerResult::STATUS_FAILED;
94 $message = $result->getStatus()->getMessage();
95 }
96
97 return new BasicHandlerResult(
99 $status,
100 basename($tempfile),
102 );
103 }
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
$message
Definition: xapiexit.php:31

References $message, ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName(), ilFileUtils\ilTempnam(), ILIAS\FileUpload\DTO\UploadResult\isOK(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\upload().

+ Here is the call graph for this function:

Field Documentation

◆ $has_access

bool CustomIconUploadHandlerGUI::$has_access = false
protected

Definition at line 41 of file class.CustomIconUploadHandlerGUI.php.

◆ $language

ilLanguage CustomIconUploadHandlerGUI::$language
protected

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


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