ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilIdentifiedMultiFilesJsPositionIndexRemover.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/classes/class.ilIdentifiedMultiValuesJsPositionIndexRemover.php';
5
13{
14 protected $postVar = null;
15
16 public function getPostVar()
17 {
18 return $this->postVar;
19 }
20
21 public function setPostVar($postVar)
22 {
23 $this->postVar = $postVar;
24 }
25
26 public function manipulateFormInputValues($inputValues)
27 {
28 // KEEP THIS INTERFACE METHOD OVERWRITTEN THIS LIKE (!)
29 return $inputValues;
30 }
31
32 public function manipulateFormSubmitValues($values)
33 {
34 if ($this->isFileSubmitAvailable()) {
35 $this->prepareFileSubmit();
36 }
37
38 return $values;
39 }
40
41 protected function isFileSubmitAvailable()
42 {
43 if (!isset($_FILES[$this->getPostVar()])) {
44 return false;
45 }
46
47 if (!is_array($_FILES[$this->getPostVar()])) {
48 return false;
49 }
50
51 if (!in_array('tmp_name', array_keys($_FILES[$this->getPostVar()]))) {
52 return false;
53 }
54
55 return true;
56 }
57
58 protected function prepareFileSubmit()
59 {
60 $_FILES[$this->getPostVar()] = $this->prepareMultiFilesSubmitValues(
61 $_FILES[$this->getPostVar()]
62 );
63 }
64
65 protected function prepareMultiFilesSubmitValues($filesSubmitValues)
66 {
67 return $this->removePositionIndexLevels($filesSubmitValues);
68 }
69}
An exception for terminatinating execution or to throw for unit testing.