ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\GlobalScreen\GUI\Input\Input Class Reference
+ Collaboration diagram for ILIAS\GlobalScreen\GUI\Input\Input:

Public Member Functions

 __construct (private Services $http, private Refinery\Factory $refinery, private Factory $data_factory, private \ilLanguage $lng, private Flow $flow)
 
 getFirstFromRequest (null|string|URLBuilderToken|TokenContainer $token)
 
 keepTokens (PonsGUI $gui)
 
 keep (null|string|URLBuilderToken|TokenContainer $token)
 
 getAllFromRequest (null|string|URLBuilderToken|TokenContainer $token)
 
 buildToken (string $namespace, string $token, ?URI $uri=null)
 
 request ()
 

Data Fields

const ALL_OBJECTS = 'ALL_OBJECTS'
 

Private Attributes

const INTERRUPTIVE_ITEMS = 'interruptive_items'
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 38 of file Input.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\GlobalScreen\GUI\Input\Input::__construct ( private Services  $http,
private Refinery\Factory  $refinery,
private Factory  $data_factory,
private \ilLanguage  $lng,
private Flow  $flow 
)

Definition at line 51 of file Input.php.

57 {
58 }

Member Function Documentation

◆ buildToken()

ILIAS\GlobalScreen\GUI\Input\Input::buildToken ( string  $namespace,
string  $token,
?URI  $uri = null 
)

Definition at line 137 of file Input.php.

138 {
139 if ($uri === null) {
140 $uri = $this->flow->getHereAsURI();
141 }
142
143 $builder = new URLBuilder($uri);
144
145 return new TokenContainer(...$builder->acquireParameter([$namespace], $token));
146 }
if($err=$client->getError()) $namespace
$token
Definition: xapitoken.php:70

References $namespace, and $token.

◆ getAllFromRequest()

ILIAS\GlobalScreen\GUI\Input\Input::getAllFromRequest ( null|string|URLBuilderToken|TokenContainer  $token)

Definition at line 106 of file Input.php.

108 : array {
109 if ($token === null) {
110 return [];
111 }
112
113 if ($token instanceof TokenContainer) {
114 $token = $token->token();
115 }
116
117 $query_params = $this->request()->getQueryParams(); // aka $_GET
118 $name = $token instanceof URLBuilderToken ? $token->getName() : $token;
119 $ids = $query_params[$name] ?? []; // array of field ids
120 $ids = is_array($ids) ? $ids : [$ids];
121
122 // all objects
123 if (($ids[0] ?? null) === self::ALL_OBJECTS) {
124 return [self::ALL_OBJECTS]; // currently we cannot support all
125 }
126
127 // check interruptive items
128 if (($interruptive_items = $this->http->request()->getParsedBody()[self::INTERRUPTIVE_ITEMS] ?? false)) {
129 foreach ($interruptive_items as $interruptive_item) {
130 $ids[] = $interruptive_item;
131 }
132 }
133
134 return array_map(fn($id): string => $this->unhash($id), $ids);
135 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static http()
Fetches the global http state from ILIAS.

◆ getFirstFromRequest()

ILIAS\GlobalScreen\GUI\Input\Input::getFirstFromRequest ( null|string|URLBuilderToken|TokenContainer  $token)

Definition at line 60 of file Input.php.

62 : string {
63 if ($token === null) {
64 return '';
65 }
66
67 if ($token instanceof TokenContainer) {
68 $token = $token->token();
69 }
70
71 $query_params = $this->request()->getQueryParams(); // aka $_GET
72 $name = $token instanceof URLBuilderToken ? $token->getName() : $token;
73 $id = $query_params[$name] ?? ''; // field id
74
75 if (is_array($id) && count($id) === 1 && isset($id[0]) && $id[0] === self::ALL_OBJECTS) {
76 return self::ALL_OBJECTS; // special case for all objects
77 }
78
79 if (is_array($id)) {
80 $id = $id[0] ?? null;
81 return $id === null ? '' : $this->unhash($id);
82 }
83
84 return $this->unhash($id);
85 }

◆ keep()

ILIAS\GlobalScreen\GUI\Input\Input::keep ( null|string|URLBuilderToken|TokenContainer  $token)

Definition at line 94 of file Input.php.

96 : void {
97 if ($token instanceof TokenContainer) {
98 $token = $token->token();
99 }
100 $ctrl = $this->flow->ctrl();
101 $current_class = $ctrl->getCmdClass();
102 $name = $token instanceof URLBuilderToken ? $token->getName() : $token;
103 $ctrl->setParameterByClass($current_class, $name, $this->hash($this->getFirstFromRequest($token)));
104 }
getFirstFromRequest(null|string|URLBuilderToken|TokenContainer $token)
Definition: Input.php:60

References $token.

Referenced by ILIAS\GlobalScreen\GUI\Input\Input\keepTokens().

+ Here is the caller graph for this function:

◆ keepTokens()

ILIAS\GlobalScreen\GUI\Input\Input::keepTokens ( PonsGUI  $gui)

Definition at line 87 of file Input.php.

87 : void
88 {
89 foreach ($gui->getTokensToKeep() as $token) {
90 $this->keep($token);
91 }
92 }
keep(null|string|URLBuilderToken|TokenContainer $token)
Definition: Input.php:94

References $token, ILIAS\GlobalScreen\GUI\PonsGUI\getTokensToKeep(), and ILIAS\GlobalScreen\GUI\Input\Input\keep().

+ Here is the call graph for this function:

◆ request()

ILIAS\GlobalScreen\GUI\Input\Input::request ( )

Definition at line 148 of file Input.php.

148 : ServerRequestInterface
149 {
150 return $this->http->request();
151 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

Field Documentation

◆ ALL_OBJECTS

const ILIAS\GlobalScreen\GUI\Input\Input::ALL_OBJECTS = 'ALL_OBJECTS'

Definition at line 45 of file Input.php.

◆ INTERRUPTIVE_ITEMS

const ILIAS\GlobalScreen\GUI\Input\Input::INTERRUPTIVE_ITEMS = 'interruptive_items'
private

Definition at line 49 of file Input.php.


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