[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 18 /** 19 * Textarea type form element 20 * 21 * Contains HTML class for a textarea type element 22 * 23 * @package core_form 24 * @copyright 2006 Jamie Pratt <me@jamiep.org> 25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 */ 27 28 require_once('HTML/QuickForm/textarea.php'); 29 30 /** 31 * Textarea type form element 32 * 33 * HTML class for a textarea type element 34 * 35 * @package core_form 36 * @category form 37 * @copyright 2006 Jamie Pratt <me@jamiep.org> 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 class MoodleQuickForm_textarea extends HTML_QuickForm_textarea{ 41 /** @var string Need to store id of form as we may need it for helpbutton */ 42 var $_formid = ''; 43 44 /** @var string html for help button, if empty then no help */ 45 var $_helpbutton=''; 46 47 /** @var bool if true label will be hidden */ 48 var $_hiddenLabel=false; 49 50 /** 51 * constructor 52 * 53 * @param string $elementName (optional) name of the text field 54 * @param string $elementLabel (optional) text field label 55 * @param string $attributes (optional) Either a typical HTML attribute string or an associative array 56 */ 57 public function __construct($elementName=null, $elementLabel=null, $attributes=null) { 58 parent::__construct($elementName, $elementLabel, $attributes); 59 } 60 61 /** 62 * Old syntax of class constructor. Deprecated in PHP7. 63 * 64 * @deprecated since Moodle 3.1 65 */ 66 public function MoodleQuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) { 67 debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); 68 self::__construct($elementName, $elementLabel, $attributes); 69 } 70 71 /** 72 * get html for help button 73 * 74 * @return string html for help button 75 */ 76 function getHelpButton(){ 77 return $this->_helpbutton; 78 } 79 80 /** 81 * Sets label to be hidden 82 * 83 * @param bool $hiddenLabel sets if label should be hidden 84 */ 85 function setHiddenLabel($hiddenLabel){ 86 $this->_hiddenLabel = $hiddenLabel; 87 } 88 89 /** 90 * Returns HTML for this form element. 91 * 92 * @return string 93 */ 94 function toHtml(){ 95 if ($this->_hiddenLabel){ 96 $this->_generateId(); 97 return '<label class="accesshide" for="' . $this->getAttribute('id') . '" >' . 98 $this->getLabel() . '</label>' . parent::toHtml(); 99 } else { 100 return parent::toHtml(); 101 } 102 } 103 104 /** 105 * Called by HTML_QuickForm whenever form event is made on this element 106 * 107 * @param string $event Name of event 108 * @param mixed $arg event arguments 109 * @param object $caller calling object 110 */ 111 function onQuickFormEvent($event, $arg, &$caller) 112 { 113 switch ($event) { 114 case 'createElement': 115 $this->_formid = $caller->getAttribute('id'); 116 break; 117 } 118 return parent::onQuickFormEvent($event, $arg, $caller); 119 } 120 121 /** 122 * Slightly different container template when frozen. 123 * 124 * @return string 125 */ 126 function getElementTemplateType(){ 127 if ($this->_flagFrozen){ 128 return 'static'; 129 } else { 130 return 'default'; 131 } 132 } 133 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |