ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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().

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.
+ 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.

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().

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
+ 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.

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().

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  }
string $key
Consumer key/client ID value.
Definition: System.php:193
isArray(string $key)
Check if parameter is an array.
+ 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.

References ILIAS\FileDelivery\http().

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  }
static http()
Fetches the global http state from ILIAS.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ getIds()

◆ int()

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

get integer parameter kindly

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

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

Referenced by ILIAS\Skill\Service\SkillPersonalGUIRequest\getBasicSkillId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getLevelId(), ILIAS\Skill\Service\SkillAdminGUIRequest\getLevelId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getNodeId(), ILIAS\Skill\Service\SkillAdminGUIRequest\getNodeId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getProfileId(), ILIAS\Skill\Service\SkillAdminGUIRequest\getRefId(), ILIAS\Skill\Service\SkillAdminGUIRequest\getRootId(), ilSkillContainerGUIRequest\getSelectedProfileId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getSelfEvaluationLevelId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getSkillId(), ILIAS\Skill\Service\SkillAdminGUIRequest\getSkillProfileId(), ILIAS\Skill\Service\SkillAdminGUIRequest\getTemplatesTree(), ILIAS\Skill\Service\SkillAdminGUIRequest\getTrefId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getTrefId(), ILIAS\Skill\Service\SkillPersonalGUIRequest\getTypeOfFormation(), ilSkillContainerGUIRequest\getUserId(), and ILIAS\Skill\Service\SkillPersonalGUIRequest\getWorkspaceId().

57  : int
58  {
59  $t = $this->refinery->kindlyTo()->int();
60  return (int) ($this->get($key, $t) ?? 0);
61  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

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().

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  }
string $key
Consumer key/client ID value.
Definition: System.php:193
isArray(string $key)
Check if parameter is an array.
+ 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.

References 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().

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  }
static http()
Fetches the global http state from ILIAS.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ 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.

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().

84  : string
85  {
86  $t = $this->refinery->kindlyTo()->string();
87  return \ilUtil::stripSlashes((string) ($this->get($key, $t) ?? ""));
88  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ 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.

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().

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  }
string $key
Consumer key/client ID value.
Definition: System.php:193
isArray(string $key)
Check if parameter is an array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $http

HTTP Services ILIAS\Skill\Service\SkillGUIRequest::$http
protected

◆ $passed_post_data

◆ $passed_query_params

◆ $refinery

Refinery Factory ILIAS\Skill\Service\SkillGUIRequest::$refinery
protected

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