ILIAS  release_8 Revision v8.24
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)
 
 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.

31 : array
32 {
33 $brandedValues = array();
34
35 foreach ($origValues as $identifier => $val) {
36 $brandedValues[$this->getIndicatorBrandedIdentifier($identifier)] = $val;
37 }
38
39 return $brandedValues;
40 }

References getIndicatorBrandedIdentifier().

Referenced by manipulateFormInputValues().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanSubmitCommandFromPossibleIdentifierIndicators()

ilIdentifiedMultiValuesJsPositionIndexRemover::cleanSubmitCommandFromPossibleIdentifierIndicators (   $cmdArrayLevel)
protected

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

54 {
55 if (is_array($cmdArrayLevel)) {
56 $currentKey = key($cmdArrayLevel);
57 $nextLevel = current($cmdArrayLevel);
58
59 $nextLevel = $this->cleanSubmitCommandFromPossibleIdentifierIndicators($nextLevel);
60
61 unset($cmdArrayLevel[$currentKey]);
62
63 if ($this->isValueIdentifier($currentKey)) {
64 $currentKey = $this->removeIdentifierIndicator($currentKey);
65 }
66
67 $cmdArrayLevel[$currentKey] = $nextLevel;
68 }
69
70 return $cmdArrayLevel;
71 }

References cleanSubmitCommandFromPossibleIdentifierIndicators(), isValueIdentifier(), and removeIdentifierIndicator().

Referenced by cleanSubmitCommandFromPossibleIdentifierIndicators().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchPositionIndexedValue()

ilIdentifiedMultiValuesJsPositionIndexRemover::fetchPositionIndexedValue (   $value)
protected

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

128 {
129 return current($value);
130 }

Referenced by removePositionIndexLevels().

+ Here is the caller graph for this function:

◆ getIndicatorBrandedIdentifier()

ilIdentifiedMultiValuesJsPositionIndexRemover::getIndicatorBrandedIdentifier ( string  $identifier)
protected

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

42 : string
43 {
44 return self::IDENTIFIER_INDICATOR_PREFIX . $identifier;
45 }

Referenced by brandIdentifiersWithIndicator().

+ Here is the caller graph for this function:

◆ isPositionIndexLevel()

ilIdentifiedMultiValuesJsPositionIndexRemover::isPositionIndexLevel (   $val)
protected

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

94 : bool
95 {
96 if (!is_array($val)) {
97 return false;
98 }
99
100 if (count($val) != 1) {
101 return false;
102 }
103
104 return true;
105 }

Referenced by removePositionIndexLevels().

+ Here is the caller graph for this function:

◆ isValueIdentifier()

ilIdentifiedMultiValuesJsPositionIndexRemover::isValueIdentifier (   $key)
protected

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

107 : bool
108 {
109 $indicatorPrefixLength = self::IDENTIFIER_INDICATOR_PREFIX;
110
111 if (strlen($key) <= strlen($indicatorPrefixLength)) {
112 return false;
113 }
114
115 if (substr($key, 0, strlen($indicatorPrefixLength)) != $indicatorPrefixLength) {
116 return false;
117 }
118
119 return true;
120 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ILIAS\LTI\ToolProvider\$key, and IDENTIFIER_INDICATOR_PREFIX.

Referenced by cleanSubmitCommandFromPossibleIdentifierIndicators(), and removePositionIndexLevels().

+ Here is the caller graph for this function:

◆ manipulateFormInputValues()

ilIdentifiedMultiValuesJsPositionIndexRemover::manipulateFormInputValues ( array  $inputValues)

Implements ilFormValuesManipulator.

Reimplemented in ilIdentifiedMultiFilesJsPositionIndexRemover.

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

26 : array
27 {
28 return $this->brandIdentifiersWithIndicator($inputValues);
29 }

References brandIdentifiersWithIndicator().

+ Here is the call graph for this function:

◆ manipulateFormSubmitValues()

ilIdentifiedMultiValuesJsPositionIndexRemover::manipulateFormSubmitValues ( array  $submitValues)

Implements ilFormValuesManipulator.

Reimplemented in ilIdentifiedMultiFilesJsPositionIndexRemover.

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

47 : array
48 {
49 //$_POST['cmd'] = $this->cleanSubmitCommandFromPossibleIdentifierIndicators($_POST['cmd']);
50 return $this->removePositionIndexLevels($submitValues);
51 }

References removePositionIndexLevels().

+ Here is the call graph for this function:

◆ removeIdentifierIndicator()

ilIdentifiedMultiValuesJsPositionIndexRemover::removeIdentifierIndicator (   $key)
protected

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

123 {
124 return str_replace(self::IDENTIFIER_INDICATOR_PREFIX, '', $key);
125 }

References ILIAS\LTI\ToolProvider\$key.

Referenced by cleanSubmitCommandFromPossibleIdentifierIndicators(), and removePositionIndexLevels().

+ Here is the caller graph for this function:

◆ removePositionIndexLevels()

ilIdentifiedMultiValuesJsPositionIndexRemover::removePositionIndexLevels ( array  $values)
protected

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

73 : array
74 {
75 foreach ($values as $key => $val) {
76 unset($values[$key]);
77
78 if ($this->isValueIdentifier($key)) {
80
81 if ($this->isPositionIndexLevel($val)) {
82 $val = $this->fetchPositionIndexedValue($val);
83 }
84 } elseif (is_array($val)) {
85 $val = $this->removePositionIndexLevels($val);
86 }
87
88 $values[$key] = $val;
89 }
90
91 return $values;
92 }

References ILIAS\LTI\ToolProvider\$key, fetchPositionIndexedValue(), isPositionIndexLevel(), isValueIdentifier(), removeIdentifierIndicator(), and removePositionIndexLevels().

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

+ 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: