| @@ 699-709 (lines=11) @@ | ||
| 696 | /** |
|
| 697 | * @return array |
|
| 698 | */ |
|
| 699 | public function getElementsErrors() |
|
| 700 | { |
|
| 701 | $elements = $this->getElements(); |
|
| 702 | $errors = []; |
|
| 703 | if (is_array($elements)) { |
|
| 704 | foreach ($elements as $name => $element) { |
|
| 705 | $errors = array_merge($errors, $element->getErrors()); |
|
| 706 | } |
|
| 707 | } |
|
| 708 | ||
| 709 | return $errors; |
|
| 710 | } |
|
| 711 | ||
| 712 | public function process() |
|
| @@ 869-879 (lines=11) @@ | ||
| 866 | /** |
|
| 867 | * @return array |
|
| 868 | */ |
|
| 869 | protected function getData() |
|
| 870 | { |
|
| 871 | $data = []; |
|
| 872 | $elements = $this->getElements(); |
|
| 873 | if (is_array($elements)) { |
|
| 874 | foreach ($elements as $name => $element) { |
|
| 875 | $data[$name] = $element->getValue(); |
|
| 876 | } |
|
| 877 | } |
|
| 878 | ||
| 879 | return $data; |
|
| 880 | } |
|
| 881 | ||
| 882 | } |
|
| @@ 10-21 (lines=12) @@ | ||
| 7 | * @param string $requester |
|
| 8 | * @return null |
|
| 9 | */ |
|
| 10 | public function getValue($requester = 'abstract') { |
|
| 11 | $elements = $this->getElements(); |
|
| 12 | $data = []; |
|
| 13 | if ($elements) { |
|
| 14 | foreach ($elements as $element) { |
|
| 15 | if ($element->isChecked()) { |
|
| 16 | $data[] = $element->getValue(); |
|
| 17 | } |
|
| 18 | } |
|
| 19 | } |
|
| 20 | return $data; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @param $value |
|
| @@ 136-147 (lines=12) @@ | ||
| 133 | * @param $request |
|
| 134 | * @return $this |
|
| 135 | */ |
|
| 136 | public function getDataFromRequest($request) |
|
| 137 | { |
|
| 138 | if (is_array($request)) { |
|
| 139 | $elements = $this->getElements(); |
|
| 140 | foreach ($elements as $key => $element) { |
|
| 141 | $value = $request[$key]; |
|
| 142 | if ($value > 0) { |
|
| 143 | $element->setValue($value); |
|
| 144 | } |
|
| 145 | } |
|
| 146 | } |
|
| 147 | return $this; |
|
| 148 | } |
|
| 149 | ||
| 150 | public function validate() |
|
| @@ 82-93 (lines=12) @@ | ||
| 79 | return parent::getData($data, $source); |
|
| 80 | } |
|
| 81 | ||
| 82 | public function getDataFromRequest($request) { |
|
| 83 | if (is_array($request)) { |
|
| 84 | $elements = $this->getElements(); |
|
| 85 | foreach ($elements as $key=>$element) { |
|
| 86 | $value = $request[$key]; |
|
| 87 | if ($value > 0) { |
|
| 88 | $element->setValue($value); |
|
| 89 | } |
|
| 90 | } |
|
| 91 | } |
|
| 92 | return $this; |
|
| 93 | } |
|
| 94 | ||
| 95 | public function validate() { |
|
| 96 | parent::validate(); |
|