ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilIdentifiedMultiFilesJsPositionIndexRemover.php
Go to the documentation of this file.
1<?php
2
23{
24 protected $postVar = null;
25
26 public function getPostVar()
27 {
28 return $this->postVar;
29 }
30
31 public function setPostVar($postVar): void
32 {
33 $this->postVar = $postVar;
34 }
35
36 public function manipulateFormInputValues(array $inputValues): array
37 {
38 // KEEP THIS INTERFACE METHOD OVERWRITTEN THIS LIKE (!)
39 return $inputValues;
40 }
41
42 public function manipulateFormSubmitValues(array $values): array
43 {
44 if ($this->isFileSubmitAvailable()) {
45 $this->prepareFileSubmit();
46 }
47
48 return $values;
49 }
50
51 protected function isFileSubmitAvailable(): bool
52 {
53 if (!isset($_FILES[$this->getPostVar()])) {
54 return false;
55 }
56
57 if (!is_array($_FILES[$this->getPostVar()])) {
58 return false;
59 }
60
61 if (!in_array('tmp_name', array_keys($_FILES[$this->getPostVar()]))) {
62 return false;
63 }
64
65 return true;
66 }
67
68 protected function prepareFileSubmit(): void
69 {
70 $_FILES[$this->getPostVar()] = $this->prepareMultiFilesSubmitValues(
71 $_FILES[$this->getPostVar()]
72 );
73 }
74
75 protected function prepareMultiFilesSubmitValues($filesSubmitValues): array
76 {
77 return $this->removePositionIndexLevels($filesSubmitValues);
78 }
79}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...