ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References initRequest().

33  {
34  $this->initRequest(
35  $http,
36  $refinery
37  );
38  }
Refinery Factory $refinery
initRequest(HTTP\Services $http, Refinery\Factory $refinery)
+ 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.

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

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  }
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:

◆ getBadgeAssignableUsers()

ilBadgeGUIRequest::getBadgeAssignableUsers ( )

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

References strArray().

244  : array
245  {
246  return $this->strArray("tid_id");
247  }
+ Here is the call graph for this function:

◆ getBadgeId()

ilBadgeGUIRequest::getBadgeId ( )

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

References int().

208  : int
209  {
210  return $this->int("bid");
211  }
+ Here is the call graph for this function:

◆ getBadgeIdFromUrl()

ilBadgeGUIRequest::getBadgeIdFromUrl ( )

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

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

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  }
static http()
Fetches the global http state from ILIAS.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getBadgeIds()

ilBadgeGUIRequest::getBadgeIds ( )
Returns
int []

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

References int(), and intArray().

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  }
+ Here is the call graph for this function:

◆ getId()

ilBadgeGUIRequest::getId ( )

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

References int().

213  : int
214  {
215  return $this->int("id");
216  }
+ Here is the call graph for this function:

◆ getIds()

ilBadgeGUIRequest::getIds ( )
Returns
string[]

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

References strArray().

219  : array
220  {
221  return $this->strArray("id");
222  }
+ Here is the call graph for this function:

◆ getMultiActionBadgeIdsFromPost()

ilBadgeGUIRequest::getMultiActionBadgeIdsFromPost ( )
Returns
list<string>

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

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

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  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getMultiActionBadgeIdsFromUrl()

ilBadgeGUIRequest::getMultiActionBadgeIdsFromUrl ( )
Returns
list<string>

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

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

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  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getParentId()

ilBadgeGUIRequest::getParentId ( )

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

References int().

239  : int
240  {
241  return $this->int("pid");
242  }
+ Here is the call graph for this function:

◆ getTemplateId()

ilBadgeGUIRequest::getTemplateId ( )

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

References int().

234  : int
235  {
236  return $this->int("tid");
237  }
+ Here is the call graph for this function:

◆ getTgt()

ilBadgeGUIRequest::getTgt ( )

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

References str().

229  : string
230  {
231  return $this->str("tgt");
232  }
+ Here is the call graph for this function:

◆ getType()

ilBadgeGUIRequest::getType ( )

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

References str().

224  : string
225  {
226  return $this->str("type");
227  }
+ 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.

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

Referenced by __construct().

43  : void {
44  $this->http = $http;
45  $this->refinery = $refinery;
46  }
Refinery Factory $refinery
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:

◆ int()

ilBadgeGUIRequest::int ( string  $key)
protected

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

References ILIAS\Repository\refinery().

Referenced by getBadgeId(), getBadgeIdFromUrl(), getBadgeIds(), getId(), getParentId(), getTemplateId(), and intArray().

56  : int
57  {
58  $t = $this->refinery->kindlyTo()->int();
59  return (int) ($this->get($key, $t) ?? 0);
60  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ intArray()

ilBadgeGUIRequest::intArray ( string  $key)
protected

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

References int(), isArray(), and ILIAS\Repository\refinery().

Referenced by getBadgeIds().

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.
+ Here is the call graph for this function:
+ Here is the caller 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.

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

Referenced by intArray(), and strArray().

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

ilBadgeGUIRequest::str ( string  $key)
protected

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

References ILIAS\Repository\refinery().

Referenced by getTgt(), and getType().

49  : string
50  {
51  $t = $this->refinery->kindlyTo()->string();
52  return \ilUtil::stripSlashes((string) ($this->get($key, $t) ?? ""));
53  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strArray()

ilBadgeGUIRequest::strArray (   $key)
protected

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

References isArray(), ILIAS\Repository\refinery(), and ilUtil\stripSlashes().

Referenced by getBadgeAssignableUsers(), and getIds().

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="")
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 ilBadgeGUIRequest::$http
protected

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

Referenced by initRequest().

◆ $refinery

Refinery Factory ilBadgeGUIRequest::$refinery
protected

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

Referenced by initRequest().

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