Brushed up theme oceanblue.
[moodle.git] / lib / form / htmleditor.php
CommitLineData
da6f8763 1<?php
2global $CFG;
3require_once("$CFG->libdir/form/textarea.php");
4
5/**
6 * HTML class for htmleditor type element
7 *
8 * @author Jamie Pratt
9 * @access public
10 */
11class moodleform_htmleditor extends moodleform_textarea{
12 var $_type = 'htmleditor';
13 var $_elementTemplateType='default';
14 var $_canUseHtmlEditor;
15 var $_options=array('course'=>0);
16 function moodleform_htmleditor($elementName=null, $elementLabel=null, $attributes=null){
17 $this->_canUseHtmlEditor=can_use_html_editor();
18 if ($this->_canUseHtmlEditor){
19 $this->_elementTemplateType='wide';
20 }else{
21 $this->_elementTemplateType='default';
22 }
23 parent::moodleform_textarea($elementName, $elementLabel, $attributes);
24 }
25 function getElementTemplateType(){
26 return $this->_elementTemplateType;
27 }
28 function toHtml(){
29 ob_start();
30 use_html_editor($this->getName());
31 $script=ob_get_clean();
32 if ($this->_flagFrozen) {
33 return $this->getFrozenHtml();
34 } else {
35 return $this->_getTabs() .
36 print_textarea($this->_canUseHtmlEditor,
37 $this->getAttribute('rows'),
38 $this->getAttribute('cols'),
39 $this->getAttribute('width'),
40 $this->getAttribute('height'),
41 $this->getName(),
42 preg_replace("/(\r\n|\n|\r)/", '&#010;',$this->getValue()),
43 $this->_options['course'],
44 true).$script;
45 }
46 } //end func toHtml
47
48}
49?>