ILIAS  trunk Revision v11.0_alpha-1862-g4e205cb56d4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilIdentifiedMultiValuesJsPositionIndexRemover Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilIdentifiedMultiValuesJsPositionIndexRemover:
+ Collaboration diagram for ilIdentifiedMultiValuesJsPositionIndexRemover:

Public Member Functions

 manipulateFormInputValues (array $inputValues)
 
 manipulateFormSubmitValues (array $submitValues)
 

Data Fields

const IDENTIFIER_INDICATOR_PREFIX = 'IDENTIFIER~'
 

Protected Member Functions

 brandIdentifiersWithIndicator (array $origValues)
 
 getIndicatorBrandedIdentifier (string $identifier)
 
 cleanSubmitCommandFromPossibleIdentifierIndicators ($cmdArrayLevel)
 
 removePositionIndexLevels (array $values)
 
 isPositionIndexLevel ($val)
 
 isValueIdentifier ($key)
 
 removeIdentifierIndicator ($key)
 
 fetchPositionIndexedValue ($value)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

Definition at line 22 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

Member Function Documentation

◆ brandIdentifiersWithIndicator()

ilIdentifiedMultiValuesJsPositionIndexRemover::brandIdentifiersWithIndicator ( array  $origValues)
protected

Definition at line 31 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

References getIndicatorBrandedIdentifier().

Referenced by manipulateFormInputValues().

31  : array
32  {
33  $brandedValues = [];
34 
35  foreach ($origValues as $identifier => $val) {
36  $brandedValues[$this->getIndicatorBrandedIdentifier($identifier)] = $val;
37  }
38 
39  return $brandedValues;
40  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanSubmitCommandFromPossibleIdentifierIndicators()

ilIdentifiedMultiValuesJsPositionIndexRemover::cleanSubmitCommandFromPossibleIdentifierIndicators (   $cmdArrayLevel)
protected

Definition at line 52 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

References isValueIdentifier(), and removeIdentifierIndicator().

53  {
54  if (is_array($cmdArrayLevel)) {
55  $currentKey = key($cmdArrayLevel);
56  $nextLevel = current($cmdArrayLevel);
57 
58  $nextLevel = $this->cleanSubmitCommandFromPossibleIdentifierIndicators($nextLevel);
59 
60  unset($cmdArrayLevel[$currentKey]);
61 
62  if ($this->isValueIdentifier($currentKey)) {
63  $currentKey = $this->removeIdentifierIndicator($currentKey);
64  }
65 
66  $cmdArrayLevel[$currentKey] = $nextLevel;
67  }
68 
69  return $cmdArrayLevel;
70  }
+ Here is the call graph for this function:

◆ fetchPositionIndexedValue()

ilIdentifiedMultiValuesJsPositionIndexRemover::fetchPositionIndexedValue (   $value)
protected

Definition at line 126 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

Referenced by removePositionIndexLevels().

127  {
128  return current($value);
129  }
+ Here is the caller graph for this function:

◆ getIndicatorBrandedIdentifier()

ilIdentifiedMultiValuesJsPositionIndexRemover::getIndicatorBrandedIdentifier ( string  $identifier)
protected

Definition at line 42 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

Referenced by brandIdentifiersWithIndicator().

42  : string
43  {
44  return self::IDENTIFIER_INDICATOR_PREFIX . $identifier;
45  }
+ Here is the caller graph for this function:

◆ isPositionIndexLevel()

ilIdentifiedMultiValuesJsPositionIndexRemover::isPositionIndexLevel (   $val)
protected

Definition at line 93 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

Referenced by removePositionIndexLevels().

93  : bool
94  {
95  if (!is_array($val)) {
96  return false;
97  }
98 
99  if (count($val) != 1) {
100  return false;
101  }
102 
103  return true;
104  }
+ Here is the caller graph for this function:

◆ isValueIdentifier()

ilIdentifiedMultiValuesJsPositionIndexRemover::isValueIdentifier (   $key)
protected

Definition at line 106 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

Referenced by cleanSubmitCommandFromPossibleIdentifierIndicators(), and removePositionIndexLevels().

106  : bool
107  {
108  $indicatorPrefixLength = self::IDENTIFIER_INDICATOR_PREFIX;
109 
110  if (strlen($key) <= strlen($indicatorPrefixLength)) {
111  return false;
112  }
113 
114  if (substr($key, 0, strlen($indicatorPrefixLength)) != $indicatorPrefixLength) {
115  return false;
116  }
117 
118  return true;
119  }
+ Here is the caller graph for this function:

◆ manipulateFormInputValues()

ilIdentifiedMultiValuesJsPositionIndexRemover::manipulateFormInputValues ( array  $inputValues)

Implements ilFormValuesManipulator.

Definition at line 26 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

References brandIdentifiersWithIndicator().

26  : array
27  {
28  return $this->brandIdentifiersWithIndicator($inputValues);
29  }
+ Here is the call graph for this function:

◆ manipulateFormSubmitValues()

ilIdentifiedMultiValuesJsPositionIndexRemover::manipulateFormSubmitValues ( array  $submitValues)

Implements ilFormValuesManipulator.

Definition at line 47 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

References removePositionIndexLevels().

47  : array
48  {
49  return $this->removePositionIndexLevels($submitValues);
50  }
+ Here is the call graph for this function:

◆ removeIdentifierIndicator()

ilIdentifiedMultiValuesJsPositionIndexRemover::removeIdentifierIndicator (   $key)
protected

Definition at line 121 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

Referenced by cleanSubmitCommandFromPossibleIdentifierIndicators(), and removePositionIndexLevels().

122  {
123  return str_replace(self::IDENTIFIER_INDICATOR_PREFIX, '', $key);
124  }
+ Here is the caller graph for this function:

◆ removePositionIndexLevels()

ilIdentifiedMultiValuesJsPositionIndexRemover::removePositionIndexLevels ( array  $values)
protected

Definition at line 72 of file class.ilIdentifiedMultiValuesJsPositionIndexRemover.php.

References fetchPositionIndexedValue(), isPositionIndexLevel(), isValueIdentifier(), and removeIdentifierIndicator().

Referenced by manipulateFormSubmitValues(), and ilIdentifiedMultiFilesJsPositionIndexRemover\prepareMultiFilesSubmitValues().

72  : array
73  {
74  foreach ($values as $key => $val) {
75  unset($values[$key]);
76 
77  if ($this->isValueIdentifier($key)) {
78  $key = $this->removeIdentifierIndicator($key);
79 
80  if ($this->isPositionIndexLevel($val)) {
81  $val = $this->fetchPositionIndexedValue($val);
82  }
83  } elseif (is_array($val)) {
84  $val = $this->removePositionIndexLevels($val);
85  }
86 
87  $values[$key] = $val;
88  }
89 
90  return $values;
91  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ IDENTIFIER_INDICATOR_PREFIX

const ilIdentifiedMultiValuesJsPositionIndexRemover::IDENTIFIER_INDICATOR_PREFIX = 'IDENTIFIER~'

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