ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilMDVocabularyUploadHandlerGUI Class Reference
+ Inheritance diagram for ilMDVocabularyUploadHandlerGUI:
+ Collaboration diagram for ilMDVocabularyUploadHandlerGUI:

Public Member Functions

 __construct ()
 
 getInfoResult (string $identifier)
 
 getInfoForExistingFiles (array $file_ids)
 
- 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 $identifier)
 
- Protected Member Functions inherited from ILIAS\MetaData\OERExposer\OAIPMH\Handler\AbstractCtrlAwareUploadHandler
 readChunkedInformation ()
 
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 

Protected Attributes

Filesystem $temp
 
- 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

Definition at line 30 of file class.ilMDVocabularyUploadHandlerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMDVocabularyUploadHandlerGUI::__construct ( )

Definition at line 34 of file class.ilMDVocabularyUploadHandlerGUI.php.

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

35  {
36  global $DIC;
37 
38  $this->temp = $DIC->filesystem()->temp();
40  }
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getInfoForExistingFiles()

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

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

Definition at line 110 of file class.ilMDVocabularyUploadHandlerGUI.php.

110  : array
111  {
112  return [];
113  }

◆ getInfoResult()

ilMDVocabularyUploadHandlerGUI::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 82 of file class.ilMDVocabularyUploadHandlerGUI.php.

References ILIAS\MetaData\OERExposer\OAIPMH\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName(), and ILIAS\MetaData\OERExposer\OAIPMH\Handler\FileInfoResult\getSize().

83  {
84  $title = $mime = 'unknown';
85  $size = 0;
86 
87  $files = $this->temp->hasDir($identifier) ?
88  $this->temp->listContents($identifier) :
89  [];
90 
91  foreach ($files as $file) {
92  if (!$file->isFile()) {
93  continue;
94  }
95  $title = $file->getFilename();
96  $size = $file->getSize();
97  $mime = $file->getMimeType();
98  break;
99  }
100 
101  return new BasicFileInfoResult(
103  $identifier,
104  $title,
105  $size,
106  $mime
107  );
108  }
+ Here is the call graph for this function:

◆ getRemoveResult()

ilMDVocabularyUploadHandlerGUI::getRemoveResult ( string  $identifier)
protected

Definition at line 72 of file class.ilMDVocabularyUploadHandlerGUI.php.

References ILIAS\MetaData\OERExposer\OAIPMH\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName().

73  {
74  return new BasicHandlerResult(
76  HandlerResult::STATUS_OK,
77  $identifier,
78  'asynchronous removal blocked'
79  );
80  }
+ Here is the call graph for this function:

◆ getUploadResult()

ilMDVocabularyUploadHandlerGUI::getUploadResult ( )
protected

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

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

43  {
44  $status = HandlerResult::STATUS_FAILED;
45  $new_identification = 'unknown';
46  $message = 'file upload failed';
47 
48  $this->upload->process();
49  $uploadResults = $this->upload->getResults();
50  $result = end($uploadResults);
51 
52  if ($result instanceof UploadResult && $result->isOK() && $result->getSize()) {
53  $new_identification = uniqid('md_vocab_');
54  $move_success = $this->upload->moveOneFileTo(
55  $result,
56  $new_identification,
57  Location::TEMPORARY
58  );
59  if ($move_success) {
60  $status = HandlerResult::STATUS_OK;
61  $message = 'Upload ok';
62  }
63  }
64  return new BasicHandlerResult(
66  $status,
67  $new_identification,
68  $message
69  );
70  }
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

Field Documentation

◆ $temp

Filesystem ilMDVocabularyUploadHandlerGUI::$temp
protected

Definition at line 32 of file class.ilMDVocabularyUploadHandlerGUI.php.


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