ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMultipleNestedOrderingElementsAdditionalIndexLevelRemover.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Form/interfaces/interface.ilFormValuesManipulator.php';
5
13{
14 public function manipulateFormInputValues($inputValues)
15 {
16 return $inputValues;
17 }
18
19 public function manipulateFormSubmitValues($submitValues)
20 {
21 return $this->fetchIndentationsFromSubmitValues($submitValues);
22 }
23
24 protected function hasContentSubLevel($values)
25 {
26 if( !is_array($values) || !isset($values['content']) )
27 {
28 return false;
29 }
30
31 return true;
32 }
33
34 protected function hasIndentationsSubLevel($values)
35 {
36 if( !is_array($values) || !isset($values['indentation']) )
37 {
38 return false;
39 }
40
41 return true;
42 }
43
44 protected function fetchIndentationsFromSubmitValues($values)
45 {
46 if( $this->hasContentSubLevel($values) && $this->hasIndentationsSubLevel($values) )
47 {
48 $actualValues = array();
49
50 foreach($values['content'] as $key => $value)
51 {
52 if( !isset($values['indentation'][$key]) )
53 {
54 $actualValues[$key] = null;
55 continue;
56 }
57
58 $actualValues[$key] = $values['indentation'][$key];
59 }
60 }
61 else
62 {
63 $actualValues = $values;
64 }
65
66 return $actualValues;
67 }
68}
An exception for terminatinating execution or to throw for unit testing.