2 require_once('HTML/QuickForm/textarea.php');
5 * HTML class for a textarea type element
10 class MoodleQuickForm_textarea
extends HTML_QuickForm_textarea
{
12 * Need to store id of form as we may need it for helpbutton
18 * html for help button, if empty then no help
23 function MoodleQuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) {
24 parent
::HTML_QuickForm_textarea($elementName, $elementLabel, $attributes);
28 * set html for help button
31 * @param array $help array of arguments to make a help button
32 * @param string $function function name to call to get html
34 function setHelpButton($helpbuttonargs, $function='helpbutton'){
36 if (!is_array($helpbuttonargs)){
37 $helpbuttonargs=array($helpbuttonargs);
39 $helpbuttonargs=$helpbuttonargs;
41 //we do this to to return html instead of printing it
42 //without having to specify it in every call to make a button.
43 if ('helpbutton' == $function){
44 $defaultargs=array('', '', 'moodle', true, false, '', true);
45 $helpbuttonargs=$helpbuttonargs +
$defaultargs ;
46 } elseif ('editorhelpbutton' == $function){
47 if (in_array('emoticons', $helpbuttonargs)){
48 $SESSION->inserttextform
= $this->_formid
;
49 $SESSION->inserttextfield
= $this->getAttribute('name');
52 $this->_helpbutton
=call_user_func_array($function, $helpbuttonargs);
55 * get html for help button
58 * @return string html for help button
60 function getHelpButton(){
61 return $this->_helpbutton
;
64 * Called by HTML_QuickForm whenever form event is made on this element
66 * @param string $event Name of event
67 * @param mixed $arg event arguments
68 * @param object $caller calling object
73 function onQuickFormEvent($event, $arg, &$caller)
77 $this->_formid
= $caller->getAttribute('id');
80 return parent
::onQuickFormEvent($event, $arg, $caller);
81 } // end func onQuickFormEvent
83 * Slightly different container template when frozen.
87 function getElementTemplateType(){
88 if ($this->_flagFrozen
){