ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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 ()
 
 refinery ()
 

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 144 of file Input.php.

145 {
146 if ($uri === null) {
147 $uri = $this->flow->getHereAsURI();
148 }
149
150 $builder = new URLBuilder($uri);
151
152 return new TokenContainer(...$builder->acquireParameter([$namespace], $token));
153 }
if($err=$client->getError()) $namespace
$token
Definition: xapitoken.php:67

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 $return_ids = [];
134 foreach ($ids as $id) {
135 try {
136 $return_ids[] = $this->unhash($id);
137 } catch (\Throwable $e) {
138 // skip invalid ids
139 }
140 }
141 return $return_ids;
142 }
$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:

◆ refinery()

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

Definition at line 160 of file Input.php.

160 : Refinery\Factory
161 {
162 return $this->refinery;
163 }

References ILIAS\UI\examples\Layout\Page\Mail\$refinery.

◆ request()

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

Definition at line 155 of file Input.php.

155 : ServerRequestInterface
156 {
157 return $this->http->request();
158 }

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: