ILIAS  release_8 Revision v8.24
ilBadgeGUIRequest Class Reference
+ Collaboration diagram for ilBadgeGUIRequest:

Public Member Functions

 __construct (HTTP\Services $http, Refinery\Factory $refinery)
 
 getBadgeIds ()
 
 getBadgeId ()
 
 getId ()
 
 getIds ()
 
 getType ()
 
 getTgt ()
 
 getTemplateId ()
 
 getParentId ()
 

Protected Member Functions

 initRequest (HTTP\Services $http, Refinery\Factory $refinery)
 
 str (string $key)
 
 int (string $key)
 
 intArray (string $key)
 
 strArray ($key)
 
 isArray (string $key)
 Check if parameter is an array. More...
 
 get (string $key, Refinery\Transformation $t)
 

Protected Attributes

HTTP Services $http
 
Refinery Factory $refinery
 

Detailed Description

Definition at line 22 of file class.ilBadgeGUIRequest.php.

Constructor & Destructor Documentation

◆ __construct()

ilBadgeGUIRequest::__construct ( HTTP\Services  $http,
Refinery\Factory  $refinery 
)

Definition at line 27 of file class.ilBadgeGUIRequest.php.

30 {
31 $this->initRequest(
32 $http,
34 );
35 }
initRequest(HTTP\Services $http, Refinery\Factory $refinery)
Refinery Factory $refinery

References $refinery, and initRequest().

+ Here is the call graph for this function:

Member Function Documentation

◆ get()

ilBadgeGUIRequest::get ( string  $key,
Refinery\Transformation  $t 
)
protected
Returns
mixed|null

Definition at line 131 of file class.ilBadgeGUIRequest.php.

132 {
133 $w = $this->http->wrapper();
134 if ($w->post()->has($key)) {
135 return $w->post()->retrieve($key, $t);
136 }
137 if ($w->query()->has($key)) {
138 return $w->query()->retrieve($key, $t);
139 }
140 return null;
141 }
static http()
Fetches the global http state from ILIAS.
string $key
Consumer key/client ID value.
Definition: System.php:193

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

+ Here is the call graph for this function:

◆ getBadgeId()

ilBadgeGUIRequest::getBadgeId ( )

Definition at line 153 of file class.ilBadgeGUIRequest.php.

153 : int
154 {
155 return $this->int("bid");
156 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getBadgeIds()

ilBadgeGUIRequest::getBadgeIds ( )
Returns
int []

Definition at line 144 of file class.ilBadgeGUIRequest.php.

144 : array
145 {
146 $badge_ids = $this->intArray("badge_id");
147 if (count($badge_ids) === 0 && $this->int("badge_id") > 0) {
148 $badge_ids = [$this->int("badge_id")];
149 }
150 return $badge_ids;
151 }

References ILIAS\Repository\int(), and ILIAS\Repository\intArray().

+ Here is the call graph for this function:

◆ getId()

ilBadgeGUIRequest::getId ( )

Definition at line 158 of file class.ilBadgeGUIRequest.php.

158 : int
159 {
160 return $this->int("id");
161 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getIds()

ilBadgeGUIRequest::getIds ( )
Returns
string[]

Definition at line 164 of file class.ilBadgeGUIRequest.php.

164 : array
165 {
166 return $this->strArray("id");
167 }

References ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ getParentId()

ilBadgeGUIRequest::getParentId ( )

Definition at line 184 of file class.ilBadgeGUIRequest.php.

184 : int
185 {
186 return $this->int("pid");
187 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getTemplateId()

ilBadgeGUIRequest::getTemplateId ( )

Definition at line 179 of file class.ilBadgeGUIRequest.php.

179 : int
180 {
181 return $this->int("tid");
182 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getTgt()

ilBadgeGUIRequest::getTgt ( )

Definition at line 174 of file class.ilBadgeGUIRequest.php.

174 : string
175 {
176 return $this->str("tgt");
177 }

References ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ getType()

ilBadgeGUIRequest::getType ( )

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

169 : string
170 {
171 return $this->str("type");
172 }

References ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ initRequest()

ilBadgeGUIRequest::initRequest ( HTTP\Services  $http,
Refinery\Factory  $refinery 
)
protected

Definition at line 37 of file class.ilBadgeGUIRequest.php.

40 : void {
41 $this->http = $http;
42 $this->refinery = $refinery;
43 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ int()

ilBadgeGUIRequest::int ( string  $key)
protected

Definition at line 53 of file class.ilBadgeGUIRequest.php.

53 : int
54 {
55 $t = $this->refinery->kindlyTo()->int();
56 return (int) ($this->get($key, $t) ?? 0);
57 }

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

+ Here is the call graph for this function:

◆ intArray()

ilBadgeGUIRequest::intArray ( string  $key)
protected

Definition at line 60 of file class.ilBadgeGUIRequest.php.

60 : array
61 {
62 if (!$this->isArray($key)) {
63 return [];
64 }
65 $t = $this->refinery->custom()->transformation(
66 static function (array $arr): array {
67 // keep keys(!), transform all values to int
68 return array_column(
69 array_map(
70 static function ($k, $v): array {
71 return [$k, (int) $v];
72 },
73 array_keys($arr),
74 $arr
75 ),
76 1,
77 0
78 );
79 }
80 );
81 return (array) ($this->get($key, $t) ?? []);
82 }
isArray(string $key)
Check if parameter is an array.

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

+ Here is the call graph for this function:

◆ isArray()

ilBadgeGUIRequest::isArray ( string  $key)
protected

Check if parameter is an array.

Definition at line 115 of file class.ilBadgeGUIRequest.php.

115 : bool
116 {
117 $no_transform = $this->refinery->identity();
118 $w = $this->http->wrapper();
119 if ($w->post()->has($key)) {
120 return is_array($w->post()->retrieve($key, $no_transform));
121 }
122 if ($w->query()->has($key)) {
123 return is_array($w->query()->retrieve($key, $no_transform));
124 }
125 return false;
126 }

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

+ Here is the call graph for this function:

◆ str()

ilBadgeGUIRequest::str ( string  $key)
protected

Definition at line 46 of file class.ilBadgeGUIRequest.php.

46 : string
47 {
48 $t = $this->refinery->kindlyTo()->string();
49 return \ilUtil::stripSlashes((string) ($this->get($key, $t) ?? ""));
50 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ strArray()

ilBadgeGUIRequest::strArray (   $key)
protected

Definition at line 85 of file class.ilBadgeGUIRequest.php.

85 : array
86 {
87 if (!$this->isArray($key)) {
88 return [];
89 }
90 $t = $this->refinery->custom()->transformation(
91 function ($arr) {
92 // keep keys(!), transform all values to string
93 return array_column(
94 array_map(
95 function ($k, $v) {
96 if (is_array($v)) {
97 $v = "";
98 }
99 return [$k, \ilUtil::stripSlashes((string) $v)];
100 },
101 array_keys($arr),
102 $arr
103 ),
104 1,
105 0
106 );
107 }
108 );
109 return (array) ($this->get($key, $t) ?? []);
110 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

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

+ Here is the call graph for this function:

Field Documentation

◆ $http

HTTP Services ilBadgeGUIRequest::$http
protected

Definition at line 24 of file class.ilBadgeGUIRequest.php.

◆ $refinery

Refinery Factory ilBadgeGUIRequest::$refinery
protected

Definition at line 25 of file class.ilBadgeGUIRequest.php.

Referenced by __construct().


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