ILIAS  release_8 Revision v8.24
class.ilRepoStandardUploadHandlerGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
29
34{
35 protected ?ilLogger $log = null;
36 protected Closure $result_handler;
37 protected string $file_id_parameter = "";
38
39 public function __construct(
40 Closure $result_handler,
41 string $file_id_parameter,
42 string $logger_id = ""
43 ) {
44 global $DIC;
46
47 if ($logger_id !== "") {
48 $this->log = ilLoggerFactory::getLogger($logger_id);
49 }
50 $this->result_handler = $result_handler;
51 $this->file_id_parameter = $file_id_parameter;
52 }
53
54 protected function debug(string $mess): void
55 {
56 if (!is_null($this->log)) {
57 $this->log->debug($mess);
58 }
59 }
60
61 protected function getUploadResult(): HandlerResult
62 {
63 $this->debug("checking for uploads...");
64 if ($this->upload->hasUploads()) {
65 $this->debug("has upload...");
66 try {
67 $this->upload->process();
68 $this->debug("nr of results: " . count($this->upload->getResults()));
69 foreach ($this->upload->getResults(
70 ) as $result) { // in this version, there will only be one upload at the time
71
73 $result = $rh($this->upload, $result);
74
75 /*
76 $result = new BasicHandlerResult(
77 $this->getFileIdentifierParameterName(),
78 BasicHandlerResult::STATUS_OK,
79 $id,
80 ''
81 );*/
82 }
83 } catch (Exception $e) {
84 $result = new BasicHandlerResult(
86 BasicHandlerResult::STATUS_FAILED,
87 '',
88 $e->getMessage()
89 );
90 }
91 $this->debug("end of 'has_uploads'");
92 } else {
93 $this->debug("has no upload...");
94 }
95
96 return $result;
97 }
98
99 protected function getRemoveResult(string $identifier): HandlerResult
100 {
101 return new BasicHandlerResult(
103 HandlerResult::STATUS_OK,
104 $identifier,
105 ''
106 );
107 }
108
109 public function getInfoResult(string $identifier): ?FileInfoResult
110 {
111 return null;
112 }
113
114 public function getInfoForExistingFiles(array $file_ids): array
115 {
116 return [];
117 }
118
119 public function getFileIdentifierParameterName(): string
120 {
122 }
123}
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
__construct(Closure $result_handler, string $file_id_parameter, string $logger_id="")
global $DIC
Definition: feed.php:28
Interface Location.
Definition: Location.php:30
A wrapper file dropzone wraps around any other component from the UI framework, e....
Definition: Wrapper.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc