ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilMailFormUploadHandlerGUI Class Reference
+ Inheritance diagram for ilMailFormUploadHandlerGUI:
+ Collaboration diagram for ilMailFormUploadHandlerGUI:

Public Member Functions

 __construct ()
 ilUIDemoFileUploadHandlerGUI constructor. More...
 
 getInfoResult (string $identifier)
 
 getInfoForExistingFiles (array $file_ids)
 
 getInlineConsumer (string $identifier)
 
 removeFileForIdentifier (string $identifier)
 
 getStreamConsumer (string $identifier)
 
- Public Member Functions inherited from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler
 __construct ()
 ilUIDemoFileUploadHandlerGUI constructor. More...
 
 getFileIdentifierParameterName ()
 @inheritDoc More...
 
 getUploadURL ()
 @inheritDoc More...
 
 getExistingFileInfoURL ()
 @inheritDoc More...
 
 getFileRemovalURL ()
 @inheritDoc More...
 
 executeCommand ()
 Since this is a ilCtrl aware UploadHandler executeCommand MUST be implemented. More...
 
 getInfoResult (string $identifier)
 
 getInfoForExistingFiles (array $file_ids)
 
 supportsChunkedUploads ()
 
 executeCommand ()
 Since this is a ilCtrl aware UploadHandler executeCommand MUST be implemented. More...
 
 getFileIdentifierParameterName ()
 
 getUploadURL ()
 
 getFileRemovalURL ()
 
 getExistingFileInfoURL ()
 
 getInfoForExistingFiles (array $file_ids)
 
 getInfoResult (string $identifier)
 
 supportsChunkedUploads ()
 

Protected Member Functions

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

Private Member Functions

 mailFiles ()
 
 acceptedComposeResource (string $identifier)
 
 requireComposeResource (string $identifier)
 

Private Attributes

readonly ILIAS ResourceStorage Services $storage
 
readonly ilMailAttachmentStakeholder $stakeholder
 
readonly ilLanguage $lng
 
readonly int $user_id
 
ilFileDataMail $mail_files = null
 

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

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

Constructor & Destructor Documentation

◆ __construct()

ilMailFormUploadHandlerGUI::__construct ( )

ilUIDemoFileUploadHandlerGUI constructor.

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 40 of file class.ilMailFormUploadHandlerGUI.php.

41 {
42 global $DIC;
44 $this->user_id = $DIC->user()->getId();
45 $this->storage = $DIC->resourceStorage();
46 $this->stakeholder = new ilMailAttachmentStakeholder();
47 $this->lng = $DIC->language();
48 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ acceptedComposeResource()

ilMailFormUploadHandlerGUI::acceptedComposeResource ( string  $identifier)
private

Definition at line 132 of file class.ilMailFormUploadHandlerGUI.php.

133 {
134 $id = $this->storage->manage()->find($identifier);
135 if ($id === null || !$this->mailFiles()->canUseResourceInCompose($id)) {
136 return null;
137 }
138
139 return $id;
140 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and mailFiles().

Referenced by getInfoForExistingFiles(), getInfoResult(), getRemoveResult(), and requireComposeResource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInfoForExistingFiles()

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

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 96 of file class.ilMailFormUploadHandlerGUI.php.

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

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

+ Here is the call graph for this function:

◆ getInfoResult()

ilMailFormUploadHandlerGUI::getInfoResult ( string  $identifier)
Returns
null|FileInfoResult for the file with the given identifier or null if the file does not exist.

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 85 of file class.ilMailFormUploadHandlerGUI.php.

86 {
87 $id = $this->acceptedComposeResource($identifier);
88 if ($id === null) {
89 return new BasicFileInfoResult($this->getFileIdentifierParameterName(), 'unknown', 'unknown', 0, 'unknown');
90 }
91 $r = $this->storage->manage()->getCurrentRevision($id)->getInformation();
92
93 return new BasicFileInfoResult($this->getFileIdentifierParameterName(), $identifier, $r->getTitle(), $r->getSize(), $r->getMimeType());
94 }

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

+ Here is the call graph for this function:

◆ getInlineConsumer()

ilMailFormUploadHandlerGUI::getInlineConsumer ( string  $identifier)

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

113 {
114 return $this->storage->consume()->inline($this->requireComposeResource($identifier));
115 }

References requireComposeResource().

+ Here is the call graph for this function:

◆ getRemoveResult()

ilMailFormUploadHandlerGUI::getRemoveResult ( string  $identifier)
protected

Reimplemented from ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler.

Definition at line 75 of file class.ilMailFormUploadHandlerGUI.php.

75 : HandlerResultInterface
76 {
77 $id = $this->acceptedComposeResource($identifier);
78 if ($id !== null && $this->mailFiles()->removeFromStage($id)) {
79 return new BasicHandlerResult($this->getFileIdentifierParameterName(), HandlerResultInterface::STATUS_OK, $identifier, 'file deleted');
80 }
81
82 return new BasicHandlerResult($this->getFileIdentifierParameterName(), HandlerResultInterface::STATUS_FAILED, $identifier, 'file not found');
83 }

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

Referenced by removeFileForIdentifier().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStreamConsumer()

ilMailFormUploadHandlerGUI::getStreamConsumer ( string  $identifier)

Definition at line 122 of file class.ilMailFormUploadHandlerGUI.php.

123 {
124 return $this->storage->consume()->stream($this->requireComposeResource($identifier));
125 }

References requireComposeResource().

+ Here is the call graph for this function:

◆ mailFiles()

ilMailFormUploadHandlerGUI::mailFiles ( )
private

Definition at line 127 of file class.ilMailFormUploadHandlerGUI.php.

128 {
129 return $this->mail_files ??= new ilFileDataMail($this->user_id);
130 }
Every resource of the mail stakeholder belongs to exactly one collection (pool, compose stage,...

Referenced by acceptedComposeResource(), and getRemoveResult().

+ Here is the caller graph for this function:

◆ removeFileForIdentifier()

ilMailFormUploadHandlerGUI::removeFileForIdentifier ( string  $identifier)

Definition at line 117 of file class.ilMailFormUploadHandlerGUI.php.

117 : HandlerResultInterface
118 {
119 return $this->getRemoveResult($identifier);
120 }

References getRemoveResult().

+ Here is the call graph for this function:

◆ requireComposeResource()

ilMailFormUploadHandlerGUI::requireComposeResource ( string  $identifier)
private

Definition at line 142 of file class.ilMailFormUploadHandlerGUI.php.

143 {
144 $id = $this->acceptedComposeResource($identifier);
145 if ($id === null) {
146 throw new RuntimeException('Mail attachment is not available.');
147 }
148
149 return $id;
150 }

References $id, and acceptedComposeResource().

Referenced by getInlineConsumer(), and getStreamConsumer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

readonly ilLanguage ilMailFormUploadHandlerGUI::$lng
private

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

◆ $mail_files

ilFileDataMail ilMailFormUploadHandlerGUI::$mail_files = null
private

Definition at line 38 of file class.ilMailFormUploadHandlerGUI.php.

◆ $stakeholder

readonly ilMailAttachmentStakeholder ilMailFormUploadHandlerGUI::$stakeholder
private

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

◆ $storage

readonly ILIAS ResourceStorage Services ilMailFormUploadHandlerGUI::$storage
private

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

◆ $user_id

readonly int ilMailFormUploadHandlerGUI::$user_id
private

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


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