ILIAS  release_8 Revision v8.23
ilObjFileUploadHandlerGUI Class Reference
+ Inheritance diagram for ilObjFileUploadHandlerGUI:
+ Collaboration diagram for ilObjFileUploadHandlerGUI:

Public Member Functions

 __construct ()
 
 getUploadURL ()
 
 getExistingFileInfoURL ()
 
 getFileRemovalURL ()
 overrides parent method in order to provide an async URL. More...
 
 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)
 

Private Attributes

Services $storage
 
ilObjFileStakeholder $stakeholder
 
array $class_path = [self::class]
 

Additional Inherited Members

- Data Fields inherited from ILIAS\UI\Component\Input\Field\UploadHandler
const DEFAULT_FILE_ID_PARAMETER = 'file_id'
 
- 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjFileUploadHandlerGUI::__construct ( )

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

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

40  {
41  global $DIC;
42 
43  $this->storage = $DIC->resourceStorage();
44  $this->stakeholder = new ilObjFileStakeholder($DIC->user()->getId());
45 
47  }
Class ilObjFileStakeholder.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getExistingFileInfoURL()

ilObjFileUploadHandlerGUI::getExistingFileInfoURL ( )

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

Definition at line 60 of file class.ilObjFileUploadHandlerGUI.php.

References ILIAS\Repository\ctrl().

60  : string
61  {
62  return $this->ctrl->getLinkTargetByClass($this->class_path, self::CMD_INFO, null, true);
63  }
+ Here is the call graph for this function:

◆ getFileRemovalURL()

ilObjFileUploadHandlerGUI::getFileRemovalURL ( )

overrides parent method in order to provide an async URL.

Returns
string

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

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

References ILIAS\Repository\ctrl().

69  : string
70  {
71  return $this->ctrl->getLinkTargetByClass($this->class_path, self::CMD_REMOVE, null, true);
72  }
+ Here is the call graph for this function:

◆ getInfoForExistingFiles()

ilObjFileUploadHandlerGUI::getInfoForExistingFiles ( array  $file_ids)
Parameters
array$file_ids
Returns
FileInfoResult[]

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

Definition at line 140 of file class.ilObjFileUploadHandlerGUI.php.

References getInfoResult().

140  : array
141  {
142  $info_results = [];
143  foreach ($file_ids as $identifier) {
144  $info_results[] = $this->getInfoResult($identifier);
145  }
146 
147  return $info_results;
148  }
+ Here is the call graph for this function:

◆ getInfoResult()

ilObjFileUploadHandlerGUI::getInfoResult ( string  $identifier)
Parameters
string$identifier
Returns
FileInfoResult

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

Definition at line 121 of file class.ilObjFileUploadHandlerGUI.php.

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

Referenced by getInfoForExistingFiles().

121  : ?FileInfoResult
122  {
123  if (null !== ($id = $this->storage->manage()->find($identifier))) {
124  $revision = $this->storage->manage()->getCurrentRevision($id)->getInformation();
125  $title = $revision->getTitle();
126  $size = $revision->getSize();
127  $mime = $revision->getMimeType();
128  } else {
129  $title = $mime = 'unknown';
130  $size = 0;
131  }
132 
133  return new BasicFileInfoResult($this->getFileIdentifierParameterName(), $identifier, $title, $size, $mime);
134  }
$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()

ilObjFileUploadHandlerGUI::getRemoveResult ( string  $identifier)
protected
Parameters
string$identifier
Returns
HandlerResult

Definition at line 103 of file class.ilObjFileUploadHandlerGUI.php.

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

103  : HandlerResult
104  {
105  if (null !== ($id = $this->storage->manage()->find($identifier))) {
106  $this->storage->manage()->remove($id, $this->stakeholder);
107  $status = HandlerResult::STATUS_OK;
108  $message = "file removal OK";
109  } else {
110  $status = HandlerResult::STATUS_OK;
111  $message = "file with identifier '$identifier' doesn't exist, nothing to do.";
112  }
113 
114  return new BasicHandlerResult($this->getFileIdentifierParameterName(), $status, $identifier, $message);
115  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:

◆ getUploadResult()

ilObjFileUploadHandlerGUI::getUploadResult ( )
protected
Returns
HandlerResult
Exceptions

Definition at line 78 of file class.ilObjFileUploadHandlerGUI.php.

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

79  {
80  $this->upload->register(new ilCountPDFPagesPreProcessors());
81  $this->upload->process();
82 
83  $result_array = $this->upload->getResults();
84  $result = end($result_array);
85 
86  if ($result instanceof UploadResult && $result->isOK()) {
87  $identifier = $this->storage->manage()->upload($result, $this->stakeholder)->serialize();
88  $status = HandlerResult::STATUS_OK;
89  $message = "file upload OK";
90  } else {
91  $identifier = '';
92  $status = HandlerResult::STATUS_FAILED;
93  $message = $result->getStatus()->getMessage();
94  }
95 
96  return new BasicHandlerResult($this->getFileIdentifierParameterName(), $status, $identifier, $message);
97  }
$message
Definition: xapiexit.php:32
Class ilCountPDFPagesPreProcessors.
+ Here is the call graph for this function:

◆ getUploadURL()

ilObjFileUploadHandlerGUI::getUploadURL ( )

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

Definition at line 52 of file class.ilObjFileUploadHandlerGUI.php.

References ILIAS\Repository\ctrl().

52  : string
53  {
54  return $this->ctrl->getLinkTargetByClass($this->class_path, self::CMD_UPLOAD, null, true);
55  }
+ Here is the call graph for this function:

Field Documentation

◆ $class_path

array ilObjFileUploadHandlerGUI::$class_path = [self::class]
private

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

◆ $stakeholder

ilObjFileStakeholder ilObjFileUploadHandlerGUI::$stakeholder
private

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

◆ $storage

Services ilObjFileUploadHandlerGUI::$storage
private

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


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