ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMultipleNestedOrderingElementsAdditionalIndexLevelRemover.php
Go to the documentation of this file.
1<?php
2
23{
24 public function manipulateFormInputValues(array $inputValues): array
25 {
26 return $inputValues;
27 }
28
29 public function manipulateFormSubmitValues(array $submitValues): array
30 {
31 return $this->fetchIndentationsFromSubmitValues($submitValues);
32 }
33
34 protected function hasContentSubLevel($values): bool
35 {
36 if (!is_array($values) || !isset($values['content'])) {
37 return false;
38 }
39
40 return true;
41 }
42
43 protected function hasIndentationsSubLevel($values): bool
44 {
45 if (!is_array($values) || !isset($values['indentation'])) {
46 return false;
47 }
48
49 return true;
50 }
51
52 protected function fetchIndentationsFromSubmitValues($values): array
53 {
54 if ($this->hasContentSubLevel($values) && $this->hasIndentationsSubLevel($values)) {
55 $actualValues = [];
56
57 foreach ($values['content'] as $key => $value) {
58 if (!isset($values['indentation'][$key])) {
59 $actualValues[$key] = null;
60 continue;
61 }
62
63 $actualValues[$key] = $values['indentation'][$key];
64 }
65 } else {
66 $actualValues = $values;
67 }
68
69 return $actualValues;
70 }
71}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...