Go to the documentation of this file.00001 <?php
00010 class form_richtext extends form_multiline {
00011
00012 public function getValue() {
00013 return $this->cfg->value;
00014 }
00015
00016 public function setValue($value, $refill=false) {
00017 $this->cfg->set('value', $value);
00018 }
00019
00020 public function toHtml() {
00021 if ($this->cfg->mode == 'view')
00022 return $this->getValue();
00023
00024 $options = $this->tinyMce;
00025
00026 if (is_array($this->cfg->tinyBrowser) && $this->cfg->getInArray('tinyBrowser', 'active')) {
00027 $tinyBrowser = $this->cfg->tinyBrowser;
00028 $options['file_browser_callback'] = 'function(field_name, url, type, win) {
00029 tinyMCE.activeEditor.windowManager.open({
00030 file : "'.$tinyBrowser['url'].'?'.session::getInstance()->getSessIdForce().'='.urlencode(session_id()).'&type=" + type'.($tinyBrowser['subdir'] ? '+"&subdir='.$tinyBrowser['subdir'].'"' : '').',
00031 title : "'.$tinyBrowser['title'].'",
00032 width : '.$tinyBrowser['width'].',
00033 height : '.$tinyBrowser['height'].',
00034 resizable : "yes",
00035 scrollbars : "yes",
00036 inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
00037 close_previous : "no"
00038 }, {
00039 window : win,
00040 input : field_name
00041 });
00042 return false;
00043 }';
00044 } else if (is_array($this->cfg->nyroBrowser) && $this->cfg->getInArray('nyroBrowser', 'active')) {
00045 $nyroBrowser = $this->cfg->nyroBrowser;
00046 $options['file_browser_callback'] = 'function(field_name, url, type, win) {
00047 tinyMCE.activeEditor.windowManager.open({
00048 file : "'.$nyroBrowser['url'].'?'.session::getInstance()->getSessIdForce().'='.urlencode(session_id()).'&type="+type+"&config='.$nyroBrowser['config'].'&",
00049 title : "'.$nyroBrowser['title'].'",
00050 width : '.$nyroBrowser['width'].',
00051 height : '.$nyroBrowser['height'].',
00052 resizable : "yes",
00053 scrollbars : "yes",
00054 inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
00055 close_previous : "no"
00056 }, {
00057 window : win,
00058 input : field_name
00059 });
00060 return false;
00061 }';
00062 }
00063
00064 if (array_key_exists('content_css', $options) && $options['content_css']) {
00065 $contentCss = $options['content_css'];
00066 $options['setup'] = 'function(ed) {ed.onInit.add(function(ed) {setTimeout(function() {ed.dom.add(ed.dom.select("head"), "link", {rel : "stylesheet", href : "'.$contentCss.'"});}, 5);});}';
00067 }
00068 unset($options['content_css']);
00069
00070 $resp = response::getInstance()->getProxy();
00071 $resp->addJs('jquery.tinymce');
00072 $resp->blockjQuery('$("#'.$this->id.'").tinymce('.utils::jsEncode($options).');');
00073
00074 return utils::htmlTag($this->htmlTagName,
00075 array_merge($this->html, array(
00076 'name'=>$this->name,
00077 'id'=>$this->id,
00078 )), utils::htmlOut($this->getValue()));
00079 }
00080
00081 }