| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 0.00% | 0 / 18 |  | 0.00% | 0 / 4 | CRAP |  | 0.00% | 0 / 1 | 
| tao_actions_form_Generis |  | 0.00% | 0 / 18 |  | 0.00% | 0 / 4 | 42 |  | 0.00% | 0 / 1 | 
| __construct |  | 0.00% | 0 / 7 |  | 0.00% | 0 / 1 | 6 | |||
| getClazz |  | 0.00% | 0 / 3 |  | 0.00% | 0 / 1 | 2 | |||
| getInstance |  | 0.00% | 0 / 3 |  | 0.00% | 0 / 1 | 2 | |||
| getTopClazz |  | 0.00% | 0 / 5 |  | 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 | * This container enables gives you tools to create a form from ontology | 
| 27 | * | 
| 28 | * @abstract | 
| 29 | * @access public | 
| 30 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> | 
| 31 | * @package tao | 
| 32 | |
| 33 | */ | 
| 34 | abstract class tao_actions_form_Generis extends tao_helpers_form_FormContainer | 
| 35 | { | 
| 36 | // --- ASSOCIATIONS --- | 
| 37 | |
| 38 | |
| 39 | // --- ATTRIBUTES --- | 
| 40 | |
| 41 | /** | 
| 42 | * The uri of the default top level class | 
| 43 | * used by default to limit the recursivity level in the ontology | 
| 44 | * | 
| 45 | * @access protected | 
| 46 | * @var string | 
| 47 | */ | 
| 48 | public const DEFAULT_TOP_CLASS = 'http://www.tao.lu/Ontologies/TAO.rdf#TAOObject'; | 
| 49 | |
| 50 | /** | 
| 51 | * used to define a top level class | 
| 52 | * | 
| 53 | * @access protected | 
| 54 | * @var Class | 
| 55 | */ | 
| 56 | protected $topClazz = null; | 
| 57 | |
| 58 | /** | 
| 59 | * the class resource to create the form from | 
| 60 | * | 
| 61 | * @access protected | 
| 62 | * @var Class | 
| 63 | */ | 
| 64 | protected $clazz = null; | 
| 65 | |
| 66 | /** | 
| 67 | * the resource to create the form from | 
| 68 | * | 
| 69 | * @access protected | 
| 70 | * @var Resource | 
| 71 | */ | 
| 72 | protected $instance = null; | 
| 73 | |
| 74 | // --- OPERATIONS --- | 
| 75 | |
| 76 | /** | 
| 77 | * constructor, set the ontology's class, resource and the form options | 
| 78 | * | 
| 79 | * @access public | 
| 80 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> | 
| 81 | * @param Class clazz | 
| 82 | * @param Resource instance | 
| 83 | * @param array options | 
| 84 | * @return mixed | 
| 85 | */ | 
| 86 | public function __construct( | 
| 87 | core_kernel_classes_Class $clazz, | 
| 88 | core_kernel_classes_Resource $instance = null, | 
| 89 | $options = [] | 
| 90 | ) { | 
| 91 | |
| 92 | |
| 93 | $this->clazz = $clazz; | 
| 94 | $this->instance = $instance; | 
| 95 | |
| 96 | if (isset($options['topClazz'])) { | 
| 97 | $this->topClazz = new core_kernel_classes_Class($options['topClazz']); | 
| 98 | unset($options['topClazz']); | 
| 99 | } | 
| 100 | $returnValue = parent::__construct([], $options); | 
| 101 | } | 
| 102 | |
| 103 | /** | 
| 104 | * get the class | 
| 105 | * | 
| 106 | * @access public | 
| 107 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> | 
| 108 | * @return core_kernel_classes_Class | 
| 109 | */ | 
| 110 | public function getClazz() | 
| 111 | { | 
| 112 | $returnValue = null; | 
| 113 | |
| 114 | |
| 115 | |
| 116 | $returnValue = $this->clazz; | 
| 117 | |
| 118 | |
| 119 | |
| 120 | return $returnValue; | 
| 121 | } | 
| 122 | |
| 123 | /** | 
| 124 | * get the resource | 
| 125 | * | 
| 126 | * @access public | 
| 127 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> | 
| 128 | * @return core_kernel_classes_Resource | 
| 129 | */ | 
| 130 | public function getInstance() | 
| 131 | { | 
| 132 | $returnValue = null; | 
| 133 | |
| 134 | |
| 135 | |
| 136 | $returnValue = $this->instance; | 
| 137 | |
| 138 | |
| 139 | |
| 140 | return $returnValue; | 
| 141 | } | 
| 142 | |
| 143 | /** | 
| 144 | * get the current top level class (the defined or the default) | 
| 145 | * | 
| 146 | * @access public | 
| 147 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> | 
| 148 | * @return core_kernel_classes_Class | 
| 149 | */ | 
| 150 | public function getTopClazz() | 
| 151 | { | 
| 152 | $returnValue = null; | 
| 153 | |
| 154 | |
| 155 | |
| 156 | if (!is_null($this->topClazz)) { | 
| 157 | $returnValue = $this->topClazz; | 
| 158 | } else { | 
| 159 | $returnValue = new core_kernel_classes_Class(self::DEFAULT_TOP_CLASS); | 
| 160 | } | 
| 161 | |
| 162 | |
| 163 | |
| 164 | return $returnValue; | 
| 165 | } | 
| 166 | } |