19 declare(strict_types=1);
86 array $ctrl_structure,
91 $this->security = $security_info;
92 $this->structure = $ctrl_structure;
104 in_array($this->
lowercase($class_name), $this->base_classes,
true);
129 self::KEY_CLASS_NAME,
166 if (empty($children)) {
179 if (empty($children)) {
192 if (empty($parents)) {
205 if (empty($parents)) {
218 throw new ilCtrlException(
"Parameter '$parameter_name' must not be saved, it could mess with the control flow.");
221 if (!preg_match(self::PARAM_NAME_REGEX, $parameter_name)) {
222 throw new ilCtrlException(
"Cannot save parameter '$parameter_name', as it contains invalid characters.");
225 $this->permanent_parameters[$this->
lowercase($class_name)][] = $parameter_name;
233 $class_name = $this->
lowercase($class_name);
234 if (isset($this->permanent_parameters[$class_name])) {
235 unset($this->permanent_parameters[$class_name]);
244 return $this->permanent_parameters[$this->
lowercase($class_name)] ??
null;
252 if (!preg_match(self::PARAM_NAME_REGEX, $parameter_name)) {
253 throw new ilCtrlException(
"Cannot save parameter '$parameter_name', as it contains invalid characters.");
256 $this->temporary_parameters[$this->
lowercase($class_name)][$parameter_name] = $value;
264 $class_name = $this->
lowercase($class_name);
265 if (isset($this->temporary_parameters[$class_name])) {
266 unset($this->temporary_parameters[$class_name]);
275 return $this->temporary_parameters[$this->
lowercase($class_name)] ??
null;
283 $class_name = $this->
lowercase($class_name);
288 if (!empty($this->permanent_parameters[$class_name])) {
289 foreach ($this->permanent_parameters[$class_name] as $index => $permanent_parameter) {
290 if ($parameter_name === $permanent_parameter) {
291 unset($this->permanent_parameters[$class_name][$index]);
294 $permanent_parameters = &$this->permanent_parameters[$class_name];
295 $permanent_parameters = array_values($permanent_parameters);
303 if (isset($this->temporary_parameters[$class_name])) {
304 unset($this->temporary_parameters[$class_name][$parameter_name]);
313 $this->return_targets[$this->
lowercase($class_name)] = $target_url;
321 return $this->return_targets[$this->
lowercase($class_name)] ??
null;
330 if (
null !== $class_name) {
342 return $this->security[$this->
lowercase($class_name)][self::KEY_UNSAFE_COMMANDS] ?? [];
351 if (
null !== $class_name) {
363 return $this->security[$this->
lowercase($class_name)][self::KEY_SAFE_COMMANDS] ?? [];
375 if (isset($this->mapped_structure[$cid][$identifier_key])) {
376 return $this->mapped_structure[$cid][$identifier_key];
379 foreach ($this->structure as $class_info) {
380 if (isset($class_info[$identifier_key]) && $class_info[self::KEY_CLASS_CID] === $cid) {
381 $this->mapped_structure[$cid] = $class_info;
382 return $class_info[$identifier_key];
398 $class_name = $this->
lowercase($class_name);
399 if (isset($this->structure[$class_name])) {
400 return $this->structure[$class_name][$identifier_key];
413 return strtolower($string);
array $temporary_parameters
getRelativePathByCid(string $cid)
__construct(array $ctrl_structure, array $base_classes, array $security_info)
ilCtrlStructure Constructor
getPermanentParametersByClass(string $class_name)
isBaseClass(string $class_name)
setReturnTargetByClass(string $class_name, string $target_url)
const PROTECTED_PARAMETERS
Class ilCtrlStructure holds the currently read control structure.
setTemporaryParameterByClass(string $class_name, string $parameter_name, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $permanent_parameters
removeSingleParameterByClass(string $class_name, string $parameter_name)
getParentsByName(string $class_name)
getClassNameByCid(string $cid)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getRelativePathByName(string $class_name)
getChildrenByName(string $class_name)
getValueForKeyByName(string $identifier_key, string $class_name)
Returns a stored structure value of the given key from the corresponding class mapped by name...
getUnsafeCommandsByName(string $class_name)
getReturnTargetByClass(string $class_name)
getObjNameByName(string $class_name)
removePermanentParametersByClass(string $class_name)
getParentsByCid(string $cid)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
lowercase(string $string)
Helper function to lowercase strings.
getObjNameByCid(string $cid)
getChildrenByCid(string $cid)
getUnsafeCommandsByCid(string $cid)
getClassCidByName(string $class_name)
setPermanentParameterByClass(string $class_name, string $parameter_name)
removeTemporaryParametersByClass(string $class_name)
getValueForKeyByCid(string $identifier_key, string $cid)
Returns a stored structure value of the given key from the corresponding class mapped by CID...
getSafeCommandsByName(string $class_name)
getSafeCommandsByCid(string $cid)
getTemporaryParametersByClass(string $class_name)