ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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\MetaData\OERExposer\OAIPMH\Handler\AbstractCtrlAwareUploadHandler
 __construct ()
 ilUIDemoFileUploadHandlerGUI constructor. More...
 
 getFileIdentifierParameterName ()
 
 getUploadURL ()
 
 getExistingFileInfoURL ()
 
 getFileRemovalURL ()
 
 executeCommand ()
 Since this is a ilCtrl aware UploadHandler executeCommand MUST be implemented. More...
 
 getInfoResult (string $identifier)
 
 getInfoForExistingFiles (array $file_ids)
 
 supportsChunkedUploads ()
 

Protected Member Functions

 getUploadResult ()
 
 getRemoveResult (string $file_name)
 
- Protected Member Functions inherited from ILIAS\MetaData\OERExposer\OAIPMH\Handler\AbstractCtrlAwareUploadHandler
 readChunkedInformation ()
 
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 

Protected Attributes

ilLanguage $language
 
bool $has_access = false
 
- Protected Attributes inherited from ILIAS\MetaData\OERExposer\OAIPMH\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
[]

Implements ILIAS\UI\Component\Input\Field\UploadHandler.

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

References getInfoResult().

143  : array
144  {
145  return [$this->getInfoResult('custom_icon')];
146  }
+ 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.

Implements ILIAS\UI\Component\Input\Field\UploadHandler.

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

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

Referenced by getInfoForExistingFiles().

123  : ?FileInfoResult
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  }
custom_icon()
description: > Example for rendering custom icons.
Definition: custom_icon.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRemoveResult()

CustomIconUploadHandlerGUI::getRemoveResult ( string  $file_name)
protected

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

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

105  : HandlerResult
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  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ Here is the call graph for this function:

◆ getUploadResult()

CustomIconUploadHandlerGUI::getUploadResult ( )
protected

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

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

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),
101  $message
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
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
+ 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: