ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMMUploadHandlerGUI Class Reference

Class ilMMUploadHandlerGUI. More...

+ Inheritance diagram for ilMMUploadHandlerGUI:
+ Collaboration diagram for ilMMUploadHandlerGUI:

Public Member Functions

 __construct ()
 ilUIDemoFileUploadHandlerGUI constructor. More...
 
 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...
 
 getInfoForExistingFiles (array $file_ids)
 

Data Fields

const MAX_FILE_SIZE = 2 * 1024 * 1024
 
- Data Fields inherited from ILIAS\UI\Component\Input\Field\UploadHandler
const DEFAULT_FILE_ID_PARAMETER = 'file_id'
 

Protected Member Functions

 getRemoveResult (string $identifier)
 
 getInfoResult (string $identifier)
 
- Protected Member Functions inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 
 getInfoResult (string $identifier)
 

Private Attributes

 $storage
 
 $stakeholder
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
const CMD_UPLOAD = 'upload'
 
const CMD_REMOVE = 'remove'
 
const CMD_INFO = 'info'
 
 $http
 
 $ctrl
 
 $upload
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMUploadHandlerGUI::__construct ( )

ilUIDemoFileUploadHandlerGUI constructor.

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

References $DIC, $i, $message, $result, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getFileIdentifierParameterName(), and ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\getUploadResult().

36  {
37  global $DIC;
39  $this->storage = $DIC['resource_storage'];
40  $this->stakeholder = new ilMMStorageStakeholder();
41  }
global $DIC
Definition: goto.php:24
Class ilMMStorageStakeholder.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getInfoForExistingFiles()

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

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

Definition at line 95 of file class.ilMMUploadHandlerGUI.php.

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

95  : array
96  {
97  $infos = [];
98  foreach ($file_ids as $file_id) {
99  $id = $this->storage->manage()->find($file_id);
100  if ($id === null) {
101  continue;
102  }
103  $r = $this->storage->manage()->getCurrentRevision($id)->getInformation();
104 
105  $infos[] = new BasicFileInfoResult($this->getFileIdentifierParameterName(), $file_id, $r->getTitle(), $r->getSize(), $r->getMimeType());
106  }
107 
108  return $infos;
109  }
+ Here is the call graph for this function:

◆ getInfoResult()

ilMMUploadHandlerGUI::getInfoResult ( string  $identifier)
protected

Definition at line 83 of file class.ilMMUploadHandlerGUI.php.

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

84  {
85  $id = $this->storage->manage()->find($identifier);
86  if ($id === null) {
87  return new BasicFileInfoResult($this->getFileIdentifierParameterName(), 'unknown', 'unknown', 0, 'unknown');
88  }
89  $r = $this->storage->manage()->getCurrentRevision($id)->getInformation();
90 
91  return new BasicFileInfoResult($this->getFileIdentifierParameterName(), $identifier, $r->getTitle(), $r->getSize(), $r->getMimeType());
92  }
+ Here is the call graph for this function:

◆ getRemoveResult()

ilMMUploadHandlerGUI::getRemoveResult ( string  $identifier)
protected

Definition at line 70 of file class.ilMMUploadHandlerGUI.php.

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

71  {
72  $id = $this->storage->manage()->find($identifier);
73  if ($id !== null) {
74  $this->storage->manage()->remove($id, $this->stakeholder);
75 
76  return new BasicHandlerResult($this->getFileIdentifierParameterName(), HandlerResultInterface::STATUS_OK, $identifier, 'file deleted');
77  } else {
78  return new BasicHandlerResult($this->getFileIdentifierParameterName(), HandlerResultInterface::STATUS_FAILED, $identifier, 'file not found');
79  }
80  }
+ Here is the call graph for this function:

Field Documentation

◆ $stakeholder

ilMMUploadHandlerGUI::$stakeholder
private

Definition at line 29 of file class.ilMMUploadHandlerGUI.php.

◆ $storage

ilMMUploadHandlerGUI::$storage
private

Definition at line 25 of file class.ilMMUploadHandlerGUI.php.

◆ MAX_FILE_SIZE

const ilMMUploadHandlerGUI::MAX_FILE_SIZE = 2 * 1024 * 1024

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