ILIAS  release_8 Revision v8.24
ILIAS\Skill\Service\SkillGUIRequest Class Reference

Skill gui global request wrapper. More...

+ Inheritance diagram for ILIAS\Skill\Service\SkillGUIRequest:
+ Collaboration diagram for ILIAS\Skill\Service\SkillGUIRequest:

Public Member Functions

 __construct (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. More...
 

Protected Member Functions

 int (string $key)
 get integer parameter kindly More...
 
 intArray (string $key)
 get integer array kindly More...
 
 str (string $key)
 get string parameter kindly More...
 
 strArray (string $key)
 get string array kindly More...
 
 bool (string $key)
 get bool parameter kindly More...
 
 boolArray (string $key)
 get bool array kindly More...
 
 isArray (string $key)
 Check if parameter is an array. More...
 
 get (string $key, Refinery\Transformation $t)
 Get passed parameter, if not data passed, get key from http request. More...
 
 getIds ()
 

Protected Attributes

HTTP Services $http
 
Refinery Factory $refinery
 
array $passed_query_params = null
 
array $passed_post_data = null
 

Detailed Description

Skill gui global request wrapper.

POST overwrites GET with the same name. POST/GET parameters may be passed to the class for testing purposes.

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

Definition at line 31 of file class.SkillGUIRequest.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Service\SkillGUIRequest::__construct ( 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.

If none of these is provided the usual http service wrapper is used to determine the request data.

Reimplemented in ILIAS\Skill\Service\SkillAdminGUIRequest, and ILIAS\Skill\Service\SkillPersonalGUIRequest.

Definition at line 42 of file class.SkillGUIRequest.php.

47 {
48 $this->http = $http;
49 $this->refinery = $refinery;
50 $this->passed_query_params = $passed_query_params;
51 $this->passed_post_data = $passed_post_data;
52 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\Skill\Service\SkillGUIRequest\$http, ILIAS\Skill\Service\SkillGUIRequest\$passed_post_data, ILIAS\Skill\Service\SkillGUIRequest\$passed_query_params, ILIAS\Skill\Service\SkillGUIRequest\$refinery, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Member Function Documentation

◆ bool()

ILIAS\Skill\Service\SkillGUIRequest::bool ( string  $key)
protected

get bool parameter kindly

Definition at line 116 of file class.SkillGUIRequest.php.

116 : bool
117 {
118 $t = $this->refinery->kindlyTo()->bool();
119 return (bool) ($this->get($key, $t) ?? false);
120 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, and ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillAdminGUIRequest\getLocalContext(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getShowMaterialsResources(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getShowTargetLevel(), and ILIAS\Skill\Service\SkillAdminGUIRequest\getTemplateMode().

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

◆ boolArray()

ILIAS\Skill\Service\SkillGUIRequest::boolArray ( string  $key)
protected

get bool array kindly

Returns
bool[]|array<int|string, bool>

Definition at line 126 of file class.SkillGUIRequest.php.

126 : array
127 {
128 if (!$this->isArray($key)) {
129 return [];
130 }
131 $t = $this->refinery->custom()->transformation(
132 static function (array $arr): array {
133 // keep keys(!), transform all values to bool
134 return array_map('boolval', $arr);
135 }
136 );
137 return (array) ($this->get($key, $t) ?? []);
138 }
isArray(string $key)
Check if parameter is an array.

References ILIAS\LTI\ToolProvider\$key, ILIAS\Skill\Service\SkillGUIRequest\isArray(), and ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillAdminGUIRequest\getSuggested(), and ILIAS\Skill\Service\SkillAdminGUIRequest\getTrigger().

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

◆ get()

ILIAS\Skill\Service\SkillGUIRequest::get ( string  $key,
Refinery\Transformation  $t 
)
protected

Get passed parameter, if not data passed, get key from http request.

Returns
mixed|null

Definition at line 169 of file class.SkillGUIRequest.php.

170 {
171 if ($this->passed_query_params === null && $this->passed_post_data === null) {
172 $w = $this->http->wrapper();
173 if ($w->post()->has($key)) {
174 return $w->post()->retrieve($key, $t);
175 }
176 if ($w->query()->has($key)) {
177 return $w->query()->retrieve($key, $t);
178 }
179 }
180 if (isset($this->passed_post_data[$key])) {
181 return $t->transform($this->passed_post_data[$key]);
182 }
183 if (isset($this->passed_query_params[$key])) {
184 return $t->transform($this->passed_query_params[$key]);
185 }
186 return null;
187 }

References ILIAS\LTI\ToolProvider\$key, and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getIds()

◆ int()

◆ intArray()

ILIAS\Skill\Service\SkillGUIRequest::intArray ( string  $key)
protected

get integer array kindly

Returns
int[]|array<int|string, int>

Definition at line 67 of file class.SkillGUIRequest.php.

67 : array
68 {
69 if (!$this->isArray($key)) {
70 return [];
71 }
72 $t = $this->refinery->custom()->transformation(
73 static function (array $arr): array {
74 // keep keys(!), transform all values to int
75 return array_map('intval', $arr);
76 }
77 );
78 return (array) ($this->get($key, $t) ?? []);
79 }

References ILIAS\LTI\ToolProvider\$key, ILIAS\Skill\Service\SkillGUIRequest\isArray(), and ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillGUIRequest\getIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getOrder(), ilSkillContainerGUIRequest\getUserIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getUsers(), and ILIAS\Skill\Service\SkillPersonalGUIRequest\getWorkspaceIds().

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

◆ isArray()

ILIAS\Skill\Service\SkillGUIRequest::isArray ( string  $key)
protected

Check if parameter is an array.

Definition at line 143 of file class.SkillGUIRequest.php.

143 : bool
144 {
145 if ($this->passed_query_params === null && $this->passed_post_data === null) {
146 $no_transform = $this->refinery->identity();
147 $w = $this->http->wrapper();
148 if ($w->post()->has($key)) {
149 return is_array($w->post()->retrieve($key, $no_transform));
150 }
151 if ($w->query()->has($key)) {
152 return is_array($w->query()->retrieve($key, $no_transform));
153 }
154 }
155 if (isset($this->passed_post_data[$key])) {
156 return is_array($this->passed_post_data[$key]);
157 }
158 if (isset($this->passed_query_params[$key])) {
159 return is_array($this->passed_query_params[$key]);
160 }
161 return false;
162 }

References ILIAS\LTI\ToolProvider\$key, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillGUIRequest\boolArray(), ILIAS\Skill\Service\SkillGUIRequest\intArray(), and ILIAS\Skill\Service\SkillGUIRequest\strArray().

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

◆ str()

ILIAS\Skill\Service\SkillGUIRequest::str ( string  $key)
protected

get string parameter kindly

Definition at line 84 of file class.SkillGUIRequest.php.

84 : string
85 {
86 $t = $this->refinery->kindlyTo()->string();
87 return \ilUtil::stripSlashes((string) ($this->get($key, $t) ?? ""));
88 }

References ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillAdminGUIRequest\getBackCommand(), ILIAS\Skill\Service\SkillAdminGUIRequest\getCombinedSkillId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getListMode(), ilSkillContainerGUIRequest\getSelectedSkill(), ILIAS\Skill\Service\SkillAdminGUIRequest\getSkillExpand(), and ILIAS\Skill\Service\SkillAdminGUIRequest\getUserLogin().

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

◆ strArray()

ILIAS\Skill\Service\SkillGUIRequest::strArray ( string  $key)
protected

get string array kindly

Returns
string[]|array<int|string, string>

Definition at line 94 of file class.SkillGUIRequest.php.

94 : array
95 {
96 if (!$this->isArray($key)) {
97 return [];
98 }
99 $t = $this->refinery->custom()->transformation(
100 static function (array $arr): array {
101 // keep keys(!), transform all values to string
102 return array_map(
103 static function ($v): string {
104 return \ilUtil::stripSlashes((string) $v);
105 },
106 $arr
107 );
108 }
109 );
110 return (array) ($this->get($key, $t) ?? []);
111 }

References ILIAS\LTI\ToolProvider\$key, ILIAS\Skill\Service\SkillGUIRequest\isArray(), and ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillAdminGUIRequest\getAssignedLevelIds(), ilSkillContainerGUIRequest\getCombinedSkillIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getSelectedIds(), and ILIAS\Skill\Service\SkillAdminGUIRequest\getTitles().

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

Field Documentation

◆ $http

◆ $passed_post_data

◆ $passed_query_params

◆ $refinery


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