ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 32 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 43 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().

48  {
49  $this->http = $http;
50  $this->refinery = $refinery;
51  $this->passed_query_params = $passed_query_params;
52  $this->passed_post_data = $passed_post_data;
53  }
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 117 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().

117  : bool
118  {
119  $t = $this->refinery->kindlyTo()->bool();
120  return (bool) ($this->get($key, $t) ?? false);
121  }
+ 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 127 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().

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

References ILIAS\FileDelivery\http(), and null.

171  {
172  if ($this->passed_query_params === null && $this->passed_post_data === null) {
173  $w = $this->http->wrapper();
174  if ($w->post()->has($key)) {
175  return $w->post()->retrieve($key, $t);
176  }
177  if ($w->query()->has($key)) {
178  return $w->query()->retrieve($key, $t);
179  }
180  }
181  if (isset($this->passed_post_data[$key])) {
182  return $t->transform($this->passed_post_data[$key]);
183  }
184  if (isset($this->passed_query_params[$key])) {
185  return $t->transform($this->passed_query_params[$key]);
186  }
187  return null;
188  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 193 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().

193  : array
194  {
195  return $this->intArray("id");
196  }
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 214 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().

214  : array
215  {
216  return $this->intArray("interruptive_items");
217  }
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 68 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().

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

References ILIAS\FileDelivery\http(), null, and ILIAS\Repository\refinery().

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

144  : bool
145  {
146  if ($this->passed_query_params === null && $this->passed_post_data === null) {
147  $no_transform = $this->refinery->identity();
148  $w = $this->http->wrapper();
149  if ($w->post()->has($key)) {
150  return is_array($w->post()->retrieve($key, $no_transform));
151  }
152  if ($w->query()->has($key)) {
153  return is_array($w->query()->retrieve($key, $no_transform));
154  }
155  }
156  if (isset($this->passed_post_data[$key])) {
157  return is_array($this->passed_post_data[$key]);
158  }
159  if (isset($this->passed_query_params[$key])) {
160  return is_array($this->passed_query_params[$key]);
161  }
162  return false;
163  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 85 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().

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

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