Beispiel #1
0
    /**
     * Returns the textarea element in HTML
     * 
     * @since     1.0
     * @access    public
     * @return    string
     */
    function toHtml()
    {
        if ($this->_flagFrozen) {
            return $this->getFrozenHtml();
        } else {
            switch (strtolower($this->editorName)) {
                case 'nicedit':
                    ob_start();
                    if (!defined('HTML_QuickForm_htmlarea_nicEdit_loaded')) {
                        define('HTML_QuickForm_htmlarea_nicEdit_loaded', 1);
                        echo '<script language="javascript" type="text/javascript" src="' . DATAFACE_URL . '/js/nicEdit/nicEdit.js"></script>';
                    }
                    echo '<script language="javascript">
        			//<![CDATA[
        			bkLib.onDomLoaded(function(){
        				new nicEditor({fullPanel: true, iconsPath: \'' . DATAFACE_URL . '/js/nicEdit/nicEditorIcons.gif\'}).panelInstance(\'' . $this->getAttribute('id') . '\');
        			});
        			//]]></script>';
                    $html = ob_get_contents();
                    ob_end_clean();
                    return $html . "\n" . parent::toHtml();
                case 'fckeditor':
                    require_once 'FCKeditor/fckeditor.php';
                    $editor = new FCKEditor($this->getName());
                    $editor->BasePath = $GLOBALS['HTML_QuickForm_htmlarea']['FCKeditor_BasePath'];
                    $editor->Value = $this->_value;
                    $editor->Width = '100%';
                    $editor->Height = '480';
                    ob_start();
                    $editor->Create();
                    $html = ob_get_contents();
                    ob_end_clean();
                    return $html;
                case 'tinymce':
                    ob_start();
                    if (!defined('HTML_QuickForm_htmlarea_TinyMCE_loaded')) {
                        define('HTML_QuickForm_htmlarea_TinyMCE_loaded', true);
                        echo '<script language="javascript" type="text/javascript" src="' . $GLOBALS['HTML_QuickForm_htmlarea']['TinyMCE_BasePath'] . '/tiny_mce.js"></script>';
                    }
                    echo '
					
					<script language="javascript" type="text/javascript">
					tinyMCE.init({
						editor_selector : "mceEditor",
						mode : "exact",
						elements : "' . $this->getAttribute('id') . '"';
                    foreach ($this->wysiwygOptions as $key => $value) {
                        echo ',
						' . $key . ' : "' . $value . '"';
                    }
                    echo '
					});
					
					</script>
					';
                    $out = ob_get_contents();
                    ob_end_clean();
                    // now we can just call textarea's tohtml method.
                    return $out . parent::toHtml();
            }
        }
    }