Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| tao_helpers_form_elements_template_Template | |
0.00% |
0 / 18 |
|
0.00% |
0 / 3 |
72 | |
0.00% |
0 / 1 |
| feed | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
| render | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
20 | |||
| getEvaluatedValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung |
| 19 | * (under the project TAO-TRANSFER); |
| 20 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 21 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | /** |
| 26 | * Short description of class tao_helpers_form_elements_template_Template |
| 27 | * |
| 28 | * @access public |
| 29 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 30 | * @package tao |
| 31 | |
| 32 | */ |
| 33 | class tao_helpers_form_elements_template_Template extends tao_helpers_form_elements_Template |
| 34 | { |
| 35 | // --- ASSOCIATIONS --- |
| 36 | |
| 37 | |
| 38 | // --- ATTRIBUTES --- |
| 39 | |
| 40 | // --- OPERATIONS --- |
| 41 | |
| 42 | /** |
| 43 | * Short description of method feed |
| 44 | * |
| 45 | * @access public |
| 46 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 47 | * @return mixed |
| 48 | */ |
| 49 | public function feed() |
| 50 | { |
| 51 | |
| 52 | $values = []; |
| 53 | $prefix = preg_quote($this->getPrefix(), '/'); |
| 54 | foreach ($_POST as $key => $value) { |
| 55 | if (preg_match("/^$prefix/", $key)) { |
| 56 | $values[str_replace($this->getPrefix(), '', $key)] = $value; |
| 57 | } |
| 58 | } |
| 59 | $this->setValues($values); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Short description of method render |
| 64 | * |
| 65 | * @access public |
| 66 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 67 | * @return string |
| 68 | */ |
| 69 | public function render() |
| 70 | { |
| 71 | $returnValue = (string) ''; |
| 72 | |
| 73 | |
| 74 | |
| 75 | if (file_exists($this->path) && is_readable($this->path)) { |
| 76 | extract($this->variables); |
| 77 | |
| 78 | ob_start(); |
| 79 | |
| 80 | common_Logger::i('including \'' . $this->path . '\' into form', ['TAO']); |
| 81 | |
| 82 | include $this->path; |
| 83 | |
| 84 | $returnValue = ob_get_contents(); |
| 85 | |
| 86 | ob_end_clean(); |
| 87 | |
| 88 | //clean the extracted variables |
| 89 | foreach ($this->variables as $key => $name) { |
| 90 | unset($$key); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | |
| 95 | |
| 96 | return (string) $returnValue; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Short description of method getEvaluatedValue |
| 101 | * |
| 102 | * @access public |
| 103 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 104 | * @return mixed |
| 105 | */ |
| 106 | public function getEvaluatedValue() |
| 107 | { |
| 108 | |
| 109 | return $this->getValues(); |
| 110 | } |
| 111 | } |