ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMultipleImagesAdditionalIndexLevelRemover.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 protected $filesSubmissionProperties = array(
15 'name', 'tmp_name', 'type', 'error', 'size'
16 );
17
18 protected $postVar;
19
20 public function getPostVar()
21 {
22 return $this->postVar;
23 }
24
25 public function setPostVar($postVar)
26 {
27 $this->postVar = $postVar;
28 }
29
30 protected function getFilesSubmissionProperties()
31 {
33 }
34 public function manipulateFormInputValues($inputValues)
35 {
36 return $inputValues;
37 }
38
39 public function manipulateFormSubmitValues($submitValues)
40 {
41 $submitValues = $this->removeAdditionalSubFieldsLevelFromSubmitValues($submitValues);
42
43 if ($_FILES) {
45 $_FILES[$this->getPostVar()]
46 );
47 }
48
49 return $submitValues;
50 }
51 protected function isSubFieldAvailable($values, $subFieldName)
52 {
53 if (!is_array($values)) {
54 return false;
55 }
56
57 if (!isset($values[$subFieldName])) {
58 return false;
59 }
60
61 if (!is_array($values[$subFieldName])) {
62 return false;
63 }
64
65 return true;
66 }
67
69 {
71 }
72
74 {
76 }
77
79 {
81 return $values;
82 }
83
85 $actualValues = array();
86
88 if (!isset($storedImages[$index])) {
89 $actualValues[$index] = '';
90 continue;
91 }
92
93 $actualValues[$index] = $storedImages[$index];
94 }
95
96 return $actualValues;
97 }
98
100 {
101 if (!$this->isUploadSubfieldAvailable($uploadProperty)) {
102 return $uploadProperty;
103 }
104
105 foreach ($uploadProperty as $subField => $submittedFile) {
106 foreach ($submittedFile as $identifier => $uploadValue) {
107 $uploadProperty[$identifier] = $uploadValue;
108 }
109
110 unset($uploadProperty[$subField]);
111 }
112
113 return $uploadProperty;
114 }
115
116 protected function removeAdditionalSubFieldsLevelFromFilesSubmit($filesSubmit)
117 {
118 foreach ($this->getFilesSubmissionProperties() as $uploadProperty) {
119 if (!isset($filesSubmit[$uploadProperty])) {
120 continue;
121 }
122
123 $filesSubmit[$uploadProperty] = $this->removeAdditionalSubFieldsLevelFromFilesSubmitProperty(
124 $filesSubmit[$uploadProperty]
125 );
126 }
127
128 return $filesSubmit;
129 }
130}
An exception for terminatinating execution or to throw for unit testing.
$index
Definition: metadata.php:60
$values