Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| tao_helpers_form_elements_xhtml_Label | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
90 | |
0.00% |
0 / 1 |
| render | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
90 | |||
| 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 | use oat\tao\helpers\form\elements\xhtml\XhtmlRenderingTrait; |
| 26 | |
| 27 | /** |
| 28 | * Displays the label of a resource, readonly |
| 29 | */ |
| 30 | class tao_helpers_form_elements_xhtml_Label extends tao_helpers_form_elements_Label |
| 31 | { |
| 32 | use XhtmlRenderingTrait; |
| 33 | |
| 34 | /** |
| 35 | * Short description of method render |
| 36 | * |
| 37 | * @access public |
| 38 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 39 | * @return string |
| 40 | */ |
| 41 | public function render() |
| 42 | { |
| 43 | $returnValue = (string) ''; |
| 44 | |
| 45 | if (isset($this->attributes['class'])) { |
| 46 | $classes = explode(' ', $this->attributes['class']); |
| 47 | if (! isset($this->attributes['no-format'])) { |
| 48 | if (! in_array('form-elt-info', $classes)) { |
| 49 | $classes[] = 'form-elt-info'; |
| 50 | } |
| 51 | } |
| 52 | if (! in_array('form-elt-container', $classes)) { |
| 53 | $classes[] = 'form-elt-container'; |
| 54 | } |
| 55 | $this->attributes['class'] = implode(' ', $classes); |
| 56 | } else { |
| 57 | if (isset($this->attributes['no-format'])) { |
| 58 | $this->attributes['class'] = 'form-elt-container'; |
| 59 | } else { |
| 60 | $this->attributes['class'] = 'form-elt-info form-elt-container'; |
| 61 | } |
| 62 | } |
| 63 | unset($this->attributes['no-format']); |
| 64 | |
| 65 | $returnValue .= "<span class='form_desc'>"; |
| 66 | if (! empty($this->description)) { |
| 67 | $returnValue .= _dh($this->getDescription()); |
| 68 | } |
| 69 | $returnValue .= "</span>"; |
| 70 | $returnValue .= "<span "; |
| 71 | $returnValue .= $this->renderAttributes(); |
| 72 | $returnValue .= " >"; |
| 73 | $returnValue .= isset($this->attributes['htmlentities']) && ! $this->attributes['htmlentities'] |
| 74 | ? $this->value |
| 75 | : _dh($this->value); |
| 76 | $returnValue .= "</span>"; |
| 77 | |
| 78 | return (string) $returnValue; |
| 79 | } |
| 80 | } |