00001 <?php 00007 class EditorField extends AbstractField 00008 { 00013 protected $editor = ''; 00014 00021 public function __construct($name, Form &$parentForm, array $attribs = array()) 00022 { 00023 $this->editor = new FCKeditor($name); 00024 $this->editor->ToolbarSet = 'BaseJumper'; 00025 00026 if (Config::get('fck_basepath')) 00027 $this->editor->BasePath = Config::get('fck_basepath'); 00028 else 00029 $this->editor->BasePath = 'lib/FCKeditor/'; 00030 00031 if(Config::get('fck_config')) 00032 $this->editor->Config['CustomConfigurationsPath'] = Config::get('fck_config'); 00033 else 00034 { 00035 $dir = dirname($_SERVER['SCRIPT_URL']); 00036 if ($dir == '/') 00037 $dir = ''; 00038 00039 $this->editor->Config['CustomConfigurationsPath'] = $dir . '/lib/js/fck.js'; 00040 } 00041 00042 parent::__construct($name, $parentForm, $attribs); 00043 } 00044 00045 public function __set($name, $value) 00046 { 00047 switch ($name) 00048 { 00049 case 'height': 00050 $this->editor->Height = $value; 00051 break; 00052 case 'width': 00053 $this->editor->Width = $value; 00054 break; 00055 case 'toolbar': 00056 $this->editor->ToolbarSet = $value; 00057 break; 00058 00059 default: 00060 parent::__set($name, $value); 00061 break; 00062 } 00063 } 00064 00068 function drawInput() 00069 { 00070 $this->editor->Value = stripslashes($this->value); 00071 $this->editor->Create(); 00072 } 00073 } 00074 ?>