2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
19 * static warning element
21 * Contains class for static warning type element
24 * @copyright 2008 Jamie Pratt <me@jamiep.org>
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 require_once("HTML/QuickForm/static.php");
32 * overrides {@link HTML_QuickForm_static} to display staic warning.
36 * @copyright 2008 Jamie Pratt <me@jamiep.org>
37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39 class MoodleQuickForm_warning
extends HTML_QuickForm_static
{
40 /** @var string Form element type */
41 var $_elementTemplateType='warning';
43 /** @var string html for help button, if empty then no help */
46 /** @var string class assigned to field, default is notifyproblem */
52 * @param string $elementName (optional) name of the field
53 * @param string $elementClass (optional) show as warning or notification => 'notifyproblem'
54 * @param string $text (optional) Text to put in warning field
56 function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) {
57 parent
::HTML_QuickForm_static($elementName, null, $text);
58 $this->_type
= 'warning';
59 if (is_null($elementClass)) {
60 $elementClass = 'notifyproblem';
62 $this->_class
= $elementClass;
66 * Returns HTML for this form element.
72 return $OUTPUT->notification($this->_text
, $this->_class
);
76 * get html for help button
78 * @return string html for help button
80 function getHelpButton(){
81 return $this->_helpbutton
;
85 * Gets the type of form element
89 function getElementTemplateType(){
90 return $this->_elementTemplateType
;