ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBadgeGUIRequest Class Reference
+ Collaboration diagram for ilBadgeGUIRequest:

Public Member Functions

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

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
 

Private Attributes

const ACTION_PARAMETER_TOKEN = 'tid_id'
 
const ACTION_PARAMETER_TOKEN_ID = 'id'
 

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 30 of file class.ilBadgeGUIRequest.php.

33 {
34 $this->initRequest(
35 $http,
37 );
38 }
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 134 of file class.ilBadgeGUIRequest.php.

135 {
136 $w = $this->http->wrapper();
137 if ($w->post()->has($key)) {
138 return $w->post()->retrieve($key, $t);
139 }
140 if ($w->query()->has($key)) {
141 return $w->query()->retrieve($key, $t);
142 }
143 return null;
144 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getBadgeAssignableUsers()

ilBadgeGUIRequest::getBadgeAssignableUsers ( )

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

244 : array
245 {
246 return $this->strArray("tid_id");
247 }

References ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ getBadgeId()

ilBadgeGUIRequest::getBadgeId ( )

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

208 : int
209 {
210 return $this->int("bid");
211 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getBadgeIdFromUrl()

ilBadgeGUIRequest::getBadgeIdFromUrl ( )

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

156 : int
157 {
158 $id = 0;
159 $query = $this->http->wrapper()->query();
160 if ($query->has(self::ACTION_PARAMETER_TOKEN)) {
161 $tmpl_ids = $query->retrieve(
162 self::ACTION_PARAMETER_TOKEN,
163 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
164 );
165 if (count($tmpl_ids) === 1) {
166 $id = (int) array_pop($tmpl_ids);
167 }
168 }
169
170 return $id;
171 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ILIAS\FileDelivery\http(), ILIAS\Repository\int(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getBadgeIds()

ilBadgeGUIRequest::getBadgeIds ( )
Returns
int []

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

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

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

+ Here is the call graph for this function:

◆ getId()

ilBadgeGUIRequest::getId ( )

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

213 : int
214 {
215 return $this->int("id");
216 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getIds()

ilBadgeGUIRequest::getIds ( )
Returns
string[]

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

219 : array
220 {
221 return $this->strArray("id");
222 }

References ILIAS\Repository\strArray().

+ Here is the call graph for this function:

◆ getMultiActionBadgeIdsFromPost()

ilBadgeGUIRequest::getMultiActionBadgeIdsFromPost ( )
Returns
list<string>

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

193 : array
194 {
195 $tmpl_ids = [];
196 $query = $this->http->wrapper()->post();
197 if ($query->has(self::ACTION_PARAMETER_TOKEN_ID)) {
198 $tmpl_ids = $query->retrieve(
199 self::ACTION_PARAMETER_TOKEN_ID,
200 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
201 );
202 }
203
204 return $tmpl_ids;
205 }

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

+ Here is the call graph for this function:

◆ getMultiActionBadgeIdsFromUrl()

ilBadgeGUIRequest::getMultiActionBadgeIdsFromUrl ( )
Returns
list<string>

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

176 : array
177 {
178 $tmpl_ids = [];
179 $query = $this->http->wrapper()->query();
180 if ($query->has(self::ACTION_PARAMETER_TOKEN)) {
181 $tmpl_ids = $query->retrieve(
182 self::ACTION_PARAMETER_TOKEN,
183 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->string())
184 );
185 }
186
187 return $tmpl_ids;
188 }

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

+ Here is the call graph for this function:

◆ getParentId()

ilBadgeGUIRequest::getParentId ( )

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

239 : int
240 {
241 return $this->int("pid");
242 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getTemplateId()

ilBadgeGUIRequest::getTemplateId ( )

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

234 : int
235 {
236 return $this->int("tid");
237 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getTgt()

ilBadgeGUIRequest::getTgt ( )

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

229 : string
230 {
231 return $this->str("tgt");
232 }

References ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ getType()

ilBadgeGUIRequest::getType ( )

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

224 : string
225 {
226 return $this->str("type");
227 }

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 40 of file class.ilBadgeGUIRequest.php.

43 : void {
44 $this->http = $http;
45 $this->refinery = $refinery;
46 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ int()

ilBadgeGUIRequest::int ( string  $key)
protected

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

56 : int
57 {
58 $t = $this->refinery->kindlyTo()->int();
59 return (int) ($this->get($key, $t) ?? 0);
60 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ intArray()

ilBadgeGUIRequest::intArray ( string  $key)
protected

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

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

References 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 118 of file class.ilBadgeGUIRequest.php.

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

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

+ Here is the call graph for this function:

◆ str()

ilBadgeGUIRequest::str ( string  $key)
protected

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

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

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ strArray()

ilBadgeGUIRequest::strArray (   $key)
protected

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

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

References 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 27 of file class.ilBadgeGUIRequest.php.

◆ $refinery

Refinery Factory ilBadgeGUIRequest::$refinery
protected

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

Referenced by __construct().

◆ ACTION_PARAMETER_TOKEN

const ilBadgeGUIRequest::ACTION_PARAMETER_TOKEN = 'tid_id'
private

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

◆ ACTION_PARAMETER_TOKEN_ID

const ilBadgeGUIRequest::ACTION_PARAMETER_TOKEN_ID = 'id'
private

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


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