Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
| tao_helpers_form_elements_Template | |
0.00% |
0 / 15 |
|
0.00% |
0 / 6 |
110 | |
0.00% |
0 / 1 |
| setPath | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setValues | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getValues | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getPrefix | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
| setPrefix | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setVariables | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| 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 |
| 27 | * |
| 28 | * @access public |
| 29 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 30 | * @package tao |
| 31 | |
| 32 | */ |
| 33 | abstract class tao_helpers_form_elements_Template extends tao_helpers_form_FormElement |
| 34 | { |
| 35 | // --- ASSOCIATIONS --- |
| 36 | |
| 37 | |
| 38 | // --- ATTRIBUTES --- |
| 39 | |
| 40 | /** |
| 41 | * the template parth |
| 42 | * |
| 43 | * @access protected |
| 44 | * @var string |
| 45 | */ |
| 46 | protected $path = ''; |
| 47 | |
| 48 | /** |
| 49 | * Short description of attribute values |
| 50 | * |
| 51 | * @access protected |
| 52 | * @var array |
| 53 | */ |
| 54 | protected $values = []; |
| 55 | |
| 56 | /** |
| 57 | * The prefix is used to recognize the form fields inside the template. |
| 58 | * So, all the field's name you want to retreive the value should be |
| 59 | * |
| 60 | * @access protected |
| 61 | * @var string |
| 62 | */ |
| 63 | protected $prefix = ''; |
| 64 | |
| 65 | /** |
| 66 | * Short description of attribute variables |
| 67 | * |
| 68 | * @access protected |
| 69 | * @var array |
| 70 | */ |
| 71 | protected $variables = []; |
| 72 | |
| 73 | // --- OPERATIONS --- |
| 74 | |
| 75 | /** |
| 76 | * Se the template file path |
| 77 | * |
| 78 | * @access public |
| 79 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 80 | * @param string path |
| 81 | * @return mixed |
| 82 | */ |
| 83 | public function setPath($path) |
| 84 | { |
| 85 | |
| 86 | |
| 87 | $this->path = $path; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * set the values of the element |
| 92 | * |
| 93 | * @access public |
| 94 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 95 | * @param array values |
| 96 | * @return mixed |
| 97 | */ |
| 98 | public function setValues($values) |
| 99 | { |
| 100 | |
| 101 | |
| 102 | if (is_array($values)) { |
| 103 | $this->values = $values; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Get the values of the element |
| 109 | * |
| 110 | * @access public |
| 111 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 112 | * @return taoResults_models_classes_aray |
| 113 | */ |
| 114 | public function getValues() |
| 115 | { |
| 116 | $returnValue = null; |
| 117 | |
| 118 | |
| 119 | |
| 120 | $returnValue = $this->values; |
| 121 | |
| 122 | |
| 123 | |
| 124 | return $returnValue; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Short description of method getPrefix |
| 129 | * |
| 130 | * @access public |
| 131 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 132 | * @return string |
| 133 | */ |
| 134 | public function getPrefix() |
| 135 | { |
| 136 | $returnValue = (string) ''; |
| 137 | |
| 138 | |
| 139 | |
| 140 | //prevent to use empty prefix. By default the name is used! |
| 141 | if (empty($this->prefix) && !empty($this->name)) { |
| 142 | $this->prefix = $this->name . '_'; |
| 143 | } |
| 144 | |
| 145 | $returnValue = $this->prefix; |
| 146 | |
| 147 | |
| 148 | |
| 149 | return (string) $returnValue; |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Short description of method setPrefix |
| 154 | * |
| 155 | * @access public |
| 156 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 157 | * @param string prefix |
| 158 | * @return mixed |
| 159 | */ |
| 160 | public function setPrefix($prefix) |
| 161 | { |
| 162 | |
| 163 | |
| 164 | $this->prefix = $prefix; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Short description of method setVariables |
| 169 | * |
| 170 | * @access public |
| 171 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 172 | * @param array variables |
| 173 | * @return mixed |
| 174 | */ |
| 175 | public function setVariables($variables) |
| 176 | { |
| 177 | |
| 178 | |
| 179 | if (!is_array($variables)) { |
| 180 | $variables = [$variables]; |
| 181 | } |
| 182 | $this->variables = $variables; |
| 183 | } |
| 184 | } |