ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 ()
 
 getTableIds (string $key)
 
 getTableAction (string $key)
 
 getInterruptiveItemIds ()
 

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

49  {
50  $this->http = $http;
51  $this->refinery = $refinery;
52  $this->passed_query_params = $passed_query_params;
53  $this->passed_post_data = $passed_post_data;
54  }
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 118 of file class.SkillGUIRequest.php.

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

118  : bool
119  {
120  $t = $this->refinery->kindlyTo()->bool();
121  return (bool) ($this->get($key, $t) ?? false);
122  }
+ 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 128 of file class.SkillGUIRequest.php.

References ILIAS\Skill\Service\SkillGUIRequest\isArray(), and ILIAS\Repository\refinery().

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

128  : array
129  {
130  if (!$this->isArray($key)) {
131  return [];
132  }
133  $t = $this->refinery->custom()->transformation(
134  static function (array $arr): array {
135  // keep keys(!), transform all values to bool
136  return array_map('boolval', $arr);
137  }
138  );
139  return (array) ($this->get($key, $t) ?? []);
140  }
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 171 of file class.SkillGUIRequest.php.

References ILIAS\FileDelivery\http().

172  {
173  if ($this->passed_query_params === null && $this->passed_post_data === null) {
174  $w = $this->http->wrapper();
175  if ($w->post()->has($key)) {
176  return $w->post()->retrieve($key, $t);
177  }
178  if ($w->query()->has($key)) {
179  return $w->query()->retrieve($key, $t);
180  }
181  }
182  if (isset($this->passed_post_data[$key])) {
183  return $t->transform($this->passed_post_data[$key]);
184  }
185  if (isset($this->passed_query_params[$key])) {
186  return $t->transform($this->passed_query_params[$key]);
187  }
188  return null;
189  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getIds()

ILIAS\Skill\Service\SkillGUIRequest::getIds ( )
protected
Returns
int[]

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

References ILIAS\Skill\Service\SkillGUIRequest\intArray().

Referenced by ILIAS\Skill\Service\SkillAdminGUIRequest\getLevelIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getNodeIds(), ILIAS\Container\Skills\SkillContainerGUIRequest\getProfileIds(), and ILIAS\Skill\Service\SkillPersonalGUIRequest\getSkillIds().

194  : array
195  {
196  return $this->intArray("id");
197  }
intArray(string $key)
get integer array kindly
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInterruptiveItemIds()

ILIAS\Skill\Service\SkillGUIRequest::getInterruptiveItemIds ( )
protected
Returns
int[]

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

References ILIAS\Skill\Service\SkillGUIRequest\intArray().

Referenced by ILIAS\Skill\Service\SkillAdminGUIRequest\getProfileIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getResourceIds(), and ILIAS\Skill\Service\SkillAdminGUIRequest\getUserIds().

215  : array
216  {
217  return $this->intArray("interruptive_items");
218  }
intArray(string $key)
get integer array kindly
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTableAction()

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

◆ getTableIds()

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

◆ int()

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

◆ intArray()

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

get integer array kindly

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

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

References ILIAS\Skill\Service\SkillGUIRequest\isArray(), and ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillGUIRequest\getIds(), ILIAS\Skill\Service\SkillGUIRequest\getInterruptiveItemIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getOrder(), ILIAS\Container\Skills\SkillContainerGUIRequest\getUserIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getUsers(), and ILIAS\Skill\Service\SkillPersonalGUIRequest\getWorkspaceIds().

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

145  : bool
146  {
147  if ($this->passed_query_params === null && $this->passed_post_data === null) {
148  $no_transform = $this->refinery->identity();
149  $w = $this->http->wrapper();
150  if ($w->post()->has($key)) {
151  return is_array($w->post()->retrieve($key, $no_transform));
152  }
153  if ($w->query()->has($key)) {
154  return is_array($w->query()->retrieve($key, $no_transform));
155  }
156  }
157  if (isset($this->passed_post_data[$key])) {
158  return is_array($this->passed_post_data[$key]);
159  }
160  if (isset($this->passed_query_params[$key])) {
161  return is_array($this->passed_query_params[$key]);
162  }
163  return false;
164  }
static http()
Fetches the global http state from ILIAS.
+ 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 86 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(), ILIAS\Container\Skills\SkillContainerGUIRequest\getSelectedSkill(), ILIAS\Skill\Service\SkillAdminGUIRequest\getSkillExpand(), ILIAS\Skill\Service\SkillGUIRequest\getTableAction(), and ILIAS\Skill\Service\SkillAdminGUIRequest\getUserLogin().

86  : string
87  {
88  $t = $this->refinery->kindlyTo()->string();
89  return \ilUtil::stripSlashes((string) ($this->get($key, $t) ?? ""));
90  }
+ 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 96 of file class.SkillGUIRequest.php.

References ILIAS\Skill\Service\SkillGUIRequest\isArray(), and ILIAS\Repository\refinery().

Referenced by ILIAS\Skill\Service\SkillAdminGUIRequest\getAssignedLevelIds(), ILIAS\Container\Skills\SkillContainerGUIRequest\getCombinedSkillIds(), ILIAS\Skill\Service\SkillAdminGUIRequest\getSelectedIds(), ILIAS\Skill\Service\SkillGUIRequest\getTableIds(), and ILIAS\Skill\Service\SkillAdminGUIRequest\getTitles().

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