49 if ($this->
upload->hasUploads()) {
50 if (!$this->
upload->hasBeenProcessed()) {
53 $uploads = $this->
upload->getResults();
64 public function getUploadFilename(array $http_names,
int $index): ?
string 66 $uploaded_files = $this->
http->request()->getUploadedFiles();
68 while (($current_key = array_shift($http_names)) !==
null) {
69 if (!
isset($uploaded_files[$current_key])) {
73 $uploaded_files = $uploaded_files[$current_key];
75 if (
isset($uploaded_files[$index]) && $http_names === []) {
77 $file = $uploaded_files[$index];
78 $c = Closure::bind(
static function (UploadedFile $file): ?
string {
79 return $file->file ??
null;
96 return $this->
raw($key) !==
null;
101 return $this->
raw(
'ref_id') !==
null;
106 return $this->
int(
'ref_id');
111 return $this->
raw(
'q_id') !==
null;
116 return $this->
int(
'q_id');
130 public function raw(
string $key): mixed
132 return $this->
get($key, $this->
refinery->identity());
138 return $this->
get($key, $this->
refinery->kindlyTo()->float()) ?? 0.0;
146 return $this->
get($key, $this->
refinery->kindlyTo()->string()) ??
'';
151 return $this->
get($key, $this->
refinery->kindlyTo()->bool());
156 return $this->
http->request()->getParsedBody();
172 return $this->
intArray(
'category_ids');
177 if (!$this->
http->wrapper()->post()->has(
'matching')) {
181 return $this->
http->wrapper()->post()->retrieve(
184 $this->refinery->container()->mapValues(
185 $this->
refinery->custom()->transformation(
186 fn(
string $v): array => $this->
refinery->container()->mapValues(
198 return $this->
http->wrapper()->post()->keys();
204 if (!
isset($cmd[$key]) || !is_array($cmd[$key])) {
207 return key($cmd[$key]);
213 public function strArray(
string $key,
int $depth = 1): array
244 $chain = $this->
refinery->kindlyTo()->dictOf($transformation);
245 for ($i = 1; $i < $depth; $i++) {
246 $chain = $this->
refinery->kindlyTo()->dictOf($chain);
249 return $this->
http->wrapper()->post()->retrieve(
253 $this->refinery->always([])
trait BaseGUIRequest
Base gui request wrapper.
retrieveArray(string $key, int $depth, Transformation $transformation)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
initRequest(HTTP\Services $http, Refinery\Factory $refinery, ?array $passed_query_params=null, ?array $passed_post_data=null)
Query params and post data parameters are used for testing.
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Services $http, Factory $refinery, protected readonly FileUpload $upload)
strArray(string $key, int $depth=1)