ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilRepoStandardUploadHandlerGUI Class Reference
+ Inheritance diagram for ilRepoStandardUploadHandlerGUI:
+ Collaboration diagram for ilRepoStandardUploadHandlerGUI:

Public Member Functions

 __construct (Closure $result_handler, string $file_id_parameter, string $logger_id="", array $ctrl_path=[])
 
 getUploadURL ()
 
 getExistingFileInfoURL ()
 
 getFileRemovalURL ()
 
 getInfoResult (string $identifier)
 
 getInfoForExistingFiles (array $file_ids)
 
 getFileIdentifierParameterName ()
 
- 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

 getCtrlPath ()
 
 debug (string $mess)
 
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 
- Protected Member Functions inherited from ILIAS\MetaData\OERExposer\OAIPMH\Handler\AbstractCtrlAwareUploadHandler
 readChunkedInformation ()
 
 getUploadResult ()
 
 getRemoveResult (string $identifier)
 

Protected Attributes

array $ctrl_path
 
ilLogger $log = null
 
Closure $result_handler
 
string $file_id_parameter = ""
 
- 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

Constructor & Destructor Documentation

◆ __construct()

ilRepoStandardUploadHandlerGUI::__construct ( Closure  $result_handler,
string  $file_id_parameter,
string  $logger_id = "",
array  $ctrl_path = [] 
)

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

References $ctrl_path, $DIC, $file_id_parameter, $result_handler, ILIAS\GlobalScreen\Provider\__construct(), and ilLoggerFactory\getLogger().

45  {
46  global $DIC;
47  $this->ctrl_path = $ctrl_path;
49 
50  if ($logger_id !== "") {
51  $this->log = ilLoggerFactory::getLogger($logger_id);
52  }
53  $this->result_handler = $result_handler;
54  $this->file_id_parameter = $file_id_parameter;
55  }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ debug()

ilRepoStandardUploadHandlerGUI::debug ( string  $mess)
protected

Definition at line 86 of file class.ilRepoStandardUploadHandlerGUI.php.

Referenced by getUploadResult().

86  : void
87  {
88  if (!is_null($this->log)) {
89  $this->log->debug($mess);
90  }
91  }
+ Here is the caller graph for this function:

◆ getCtrlPath()

ilRepoStandardUploadHandlerGUI::getCtrlPath ( )
protected

Definition at line 57 of file class.ilRepoStandardUploadHandlerGUI.php.

References $ctrl_path, and $path.

Referenced by getExistingFileInfoURL(), getFileRemovalURL(), and getUploadURL().

57  : array
58  {
60  $path[] = static::class;
61  return $path;
62  }
$path
Definition: ltiservices.php:29
+ Here is the caller graph for this function:

◆ getExistingFileInfoURL()

ilRepoStandardUploadHandlerGUI::getExistingFileInfoURL ( )

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

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

References ILIAS\Repository\ctrl(), and getCtrlPath().

72  : string
73  {
74  return $this->ctrl->getLinkTargetByClass($this->getCtrlPath(), self::CMD_INFO);
75  }
+ Here is the call graph for this function:

◆ getFileIdentifierParameterName()

ilRepoStandardUploadHandlerGUI::getFileIdentifierParameterName ( )
Returns
string defaults to self::DEFAULT_FILE_ID_PARAMETER

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

Definition at line 141 of file class.ilRepoStandardUploadHandlerGUI.php.

References $file_id_parameter.

Referenced by getRemoveResult(), and getUploadResult().

141  : string
142  {
144  }
+ Here is the caller graph for this function:

◆ getFileRemovalURL()

ilRepoStandardUploadHandlerGUI::getFileRemovalURL ( )

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

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

References ILIAS\Repository\ctrl(), and getCtrlPath().

81  : string
82  {
83  return $this->ctrl->getLinkTargetByClass($this->getCtrlPath(), self::CMD_REMOVE);
84  }
+ Here is the call graph for this function:

◆ getInfoForExistingFiles()

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

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

Definition at line 136 of file class.ilRepoStandardUploadHandlerGUI.php.

136  : array
137  {
138  return [];
139  }

◆ getInfoResult()

ilRepoStandardUploadHandlerGUI::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 131 of file class.ilRepoStandardUploadHandlerGUI.php.

References null.

131  : ?FileInfoResult
132  {
133  return null;
134  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getRemoveResult()

ilRepoStandardUploadHandlerGUI::getRemoveResult ( string  $identifier)
protected

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

References getFileIdentifierParameterName().

121  : HandlerResult
122  {
123  return new BasicHandlerResult(
125  HandlerResult::STATUS_OK,
126  $identifier,
127  ''
128  );
129  }
+ Here is the call graph for this function:

◆ getUploadResult()

ilRepoStandardUploadHandlerGUI::getUploadResult ( )
protected

Definition at line 93 of file class.ilRepoStandardUploadHandlerGUI.php.

References Vendor\Package\$e, $result_handler, debug(), getFileIdentifierParameterName(), and ILIAS\Repository\upload().

94  {
95  $this->debug("checking for uploads...");
96  if ($this->upload->hasUploads()) {
97  $this->debug("has upload...");
98  try {
99  $this->upload->process();
100  $this->debug("nr of results: " . count($this->upload->getResults()));
101  foreach ($this->upload->getResults(
102  ) as $result) { // in this version, there will only be one upload at the time
103  $rh = $this->result_handler;
104  $result = $rh($this->upload, $result);
105  }
106  } catch (Exception $e) {
107  $result = new BasicHandlerResult(
109  BasicHandlerResult::STATUS_FAILED,
110  '',
111  $e->getMessage()
112  );
113  }
114  $this->debug("end of 'has_uploads'");
115  } else {
116  $this->debug("has no upload...");
117  }
118  return $result;
119  }
+ Here is the call graph for this function:

◆ getUploadURL()

ilRepoStandardUploadHandlerGUI::getUploadURL ( )
Returns
string of the URL where dropped files are sent to. This URL must make sure the upload is handled and a is returned as JSON.

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

Definition at line 63 of file class.ilRepoStandardUploadHandlerGUI.php.

References ILIAS\Repository\ctrl(), and getCtrlPath().

63  : string
64  {
65  return $this->ctrl->getLinkTargetByClass($this->getCtrlPath(), self::CMD_UPLOAD);
66  }
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl_path

array ilRepoStandardUploadHandlerGUI::$ctrl_path
protected

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

Referenced by __construct(), and getCtrlPath().

◆ $file_id_parameter

string ilRepoStandardUploadHandlerGUI::$file_id_parameter = ""
protected

◆ $log

ilLogger ilRepoStandardUploadHandlerGUI::$log = null
protected

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

◆ $result_handler

Closure ilRepoStandardUploadHandlerGUI::$result_handler
protected

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

Referenced by __construct(), and getUploadResult().


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