ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilMDCopyrightImageUploadHandlerGUI Class Reference

ilMDCopyrightImageUploadHandlerGUI: ilMDCopyrightSelectionGUI More...

+ Inheritance diagram for ilMDCopyrightImageUploadHandlerGUI:
+ Collaboration diagram for ilMDCopyrightImageUploadHandlerGUI:

Public Member Functions

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

Protected Attributes

ilMDCopyrightImageStakeholder $stakeholder
 
Services $storage
 
string $identification
 
- 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()

ilMDCopyrightImageUploadHandlerGUI::__construct ( string  $identification)

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

References $DIC, $identification, and ILIAS\MetaData\Repository\Validation\Data\__construct().

40  {
41  global $DIC;
42 
43  $this->stakeholder = new ilMDCopyrightImageStakeholder();
44  $this->storage = $DIC->resourceStorage();
45  $this->identification = $identification;
46 
48  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ getInfoForExistingFiles()

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

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

Definition at line 112 of file class.ilMDCopyrightImageUploadHandlerGUI.php.

References getInfoResult().

112  : array
113  {
114  $info_results = [];
115  foreach ($file_ids as $identifier) {
116  $info_results[] = $this->getInfoResult($identifier);
117  }
118 
119  return $info_results;
120  }
+ Here is the call graph for this function:

◆ getInfoResult()

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

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

Referenced by getInfoForExistingFiles().

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(
105  $identifier,
106  $title,
107  $size,
108  $mime
109  );
110  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRemoveResult()

ilMDCopyrightImageUploadHandlerGUI::getRemoveResult ( string  $identifier)
protected

Definition at line 81 of file class.ilMDCopyrightImageUploadHandlerGUI.php.

References ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName().

82  {
83  return new BasicHandlerResult(
85  HandlerResult::STATUS_OK,
86  $identifier,
87  'asynchronous removal blocked'
88  );
89  }
+ Here is the call graph for this function:

◆ getUploadResult()

ilMDCopyrightImageUploadHandlerGUI::getUploadResult ( )
protected

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

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

51  {
52  $status = HandlerResult::STATUS_FAILED;
53  $new_identification = 'unknown';
54  $message = 'file upload failed';
55 
56  $this->upload->process();
57  $uploadResults = $this->upload->getResults();
58  $result = end($uploadResults);
59 
60  if ($result instanceof UploadResult && $result->isOK() && $result->getSize()) {
61  $resource_id = $this->storage->manage()->find($this->identification);
62  if (is_null($resource_id)) {
63  $new_identification = $this->storage->manage()->upload($result, $this->stakeholder)->serialize();
64  $status = HandlerResult::STATUS_OK;
65  $message = 'Upload ok';
66  } elseif ($this->identification !== '') {
67  $this->storage->manage()->replaceWithUpload($resource_id, $result, $this->stakeholder);
68  $new_identification = $this->identification;
69  $status = HandlerResult::STATUS_OK;
70  $message = 'Upload ok';
71  }
72  }
73  return new BasicHandlerResult(
75  $status,
76  $new_identification,
77  $message
78  );
79  }
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:

Field Documentation

◆ $identification

string ilMDCopyrightImageUploadHandlerGUI::$identification
protected

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

Referenced by __construct(), and getUploadResult().

◆ $stakeholder

ilMDCopyrightImageStakeholder ilMDCopyrightImageUploadHandlerGUI::$stakeholder
protected

Definition at line 35 of file class.ilMDCopyrightImageUploadHandlerGUI.php.

◆ $storage

Services ilMDCopyrightImageUploadHandlerGUI::$storage
protected

Definition at line 36 of file class.ilMDCopyrightImageUploadHandlerGUI.php.


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