3 declare(strict_types=1);
72 array $ctrl_structure,
77 $this->security = $security_info;
78 $this->structure = $ctrl_structure;
90 in_array($this->
lowercase($class_name), $this->base_classes,
true);
115 self::KEY_CLASS_NAME,
119 return (null !== $class_name) ? $this->
lowercase($class_name) : null;
152 if (empty($children)) {
165 if (empty($children)) {
178 if (empty($parents)) {
191 if (empty($parents)) {
204 throw new ilCtrlException(
"Parameter '$parameter_name' must not be saved, it could mess with the control flow.");
207 if (!preg_match(self::PARAM_NAME_REGEX, $parameter_name)) {
208 throw new ilCtrlException(
"Cannot save parameter '$parameter_name', as it contains invalid characters.");
211 $this->permanent_parameters[$this->
lowercase($class_name)][] = $parameter_name;
219 $class_name = $this->
lowercase($class_name);
220 if (isset($this->permanent_parameters[$class_name])) {
221 unset($this->permanent_parameters[$class_name]);
230 return $this->permanent_parameters[$this->
lowercase($class_name)] ?? null;
238 if (!preg_match(self::PARAM_NAME_REGEX, $parameter_name)) {
239 throw new ilCtrlException(
"Cannot save parameter '$parameter_name', as it contains invalid characters.");
242 $this->temporary_parameters[$this->
lowercase($class_name)][$parameter_name] = $value;
250 $class_name = $this->
lowercase($class_name);
251 if (isset($this->temporary_parameters[$class_name])) {
252 unset($this->temporary_parameters[$class_name]);
261 return $this->temporary_parameters[$this->
lowercase($class_name)] ?? null;
269 $class_name = $this->
lowercase($class_name);
274 if (!empty($this->permanent_parameters[$class_name])) {
275 foreach ($this->permanent_parameters[$class_name] as
$index => $permanent_parameter) {
276 if ($parameter_name === $permanent_parameter) {
277 unset($this->permanent_parameters[$class_name][
$index]);
280 $permanent_parameters = &$this->permanent_parameters[$class_name];
281 $permanent_parameters = array_values($permanent_parameters);
289 if (isset($this->temporary_parameters[$class_name])) {
290 unset($this->temporary_parameters[$class_name][$parameter_name]);
299 $this->return_targets[$this->
lowercase($class_name)] = $target_url;
307 return $this->return_targets[$this->
lowercase($class_name)] ?? null;
316 if (null !== $class_name) {
328 return $this->security[$this->
lowercase($class_name)][self::KEY_UNSAFE_COMMANDS] ?? [];
337 if (null !== $class_name) {
349 return $this->security[$this->
lowercase($class_name)][self::KEY_SAFE_COMMANDS] ?? [];
361 if (isset($this->mapped_structure[$cid][$identifier_key])) {
362 return $this->mapped_structure[$cid][$identifier_key];
365 foreach ($this->structure as $class_info) {
366 if (isset($class_info[$identifier_key]) && $class_info[self::KEY_CLASS_CID] === $cid) {
367 $this->mapped_structure[$cid] = $class_info;
368 return $class_info[$identifier_key];
384 $class_name = $this->
lowercase($class_name);
385 if (isset($this->structure[$class_name])) {
386 return $this->structure[$class_name][$identifier_key];
399 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)
array $permanent_parameters
removeSingleParameterByClass(string $class_name, string $parameter_name)
getParentsByName(string $class_name)
getClassNameByCid(string $cid)
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)
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)