MDL-39888 mnet: Removal of an old sql statement invloving the mdl_log table.
[moodle.git] / lib / form / warning.php
blob90865ea1cc26a1ea943657d97d90cc48cb54b7d3
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.
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/>.
18 /**
19 * static warning element
21 * Contains class for static warning type element
23 * @package core_form
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");
29 /**
30 * static warning
32 * overrides {@link HTML_QuickForm_static} to display staic warning.
34 * @package core_form
35 * @category form
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 */
44 var $_helpbutton='';
46 /** @var string class assigned to field, default is notifyproblem */
47 var $_class='';
49 /**
50 * constructor
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;
65 /**
66 * Returns HTML for this form element.
68 * @return string
70 function toHtml() {
71 global $OUTPUT;
72 return $OUTPUT->notification($this->_text, $this->_class);
75 /**
76 * get html for help button
78 * @return string html for help button
80 function getHelpButton(){
81 return $this->_helpbutton;
84 /**
85 * Gets the type of form element
87 * @return string
89 function getElementTemplateType(){
90 return $this->_elementTemplateType;