<?php
include_once "tadtools_header.php";

class FCKEditor264{
	var $xoopsDirName;
	var $ColName;
	var $CustomConfigurationsPath;
	var $ToolbarSet="my";
	var $Width='100%';
	var $Height=300;
	var $Value;

	//建構函數
	function FCKEditor264($xoopsDirName="",$ColName="",$Value=""){
		$this->xoopsDirName=$xoopsDirName;
		$this->ColName=$ColName;
		$this->Value=$Value;
	}
	
	//設定自定義設定檔
	function setCustomConfigurationsPath($path=""){
		$this->CustomConfigurationsPath=$path;
	}
	
	//設定自定義工具列
	function setToolbarSet($ToolbarSet=""){
		$this->ToolbarSet=$ToolbarSet;
	}
	
	//設定自定義設寬度
	function setWidth($Width=""){
		$this->Width=$Width;
	}
	
	//設定自定義設高度
	function setHeight($Height=""){
		$this->Height=$Height;
	}
	
	//產生編輯器
	function render(){
		include_once XOOPS_ROOT_PATH."/modules/tadtools/fckeditor/fckeditor.php";
    $_SESSION['xoops_mod_name']=$this->xoopsDirName;
  	$oFCKeditor = new FCKeditor($this->ColName) ;
  	$oFCKeditor->BasePath	= TADTOOLS_URL."/fckeditor/" ;
  	if(!empty($this->CustomConfigurationsPath)){
      //$oFCKeditor->Config["CustomConfigurationsPath"] = XOOPS_URL.'/modules/tadnews/class/fckeditor_config.js';
      $oFCKeditor->Config["CustomConfigurationsPath"] = $this->CustomConfigurationsPath;
    }
  	$oFCKeditor->Config['AutoDetectLanguage']=true;
  	$oFCKeditor->ToolbarSet =$this->ToolbarSet;
  	$oFCKeditor->Width = $this->Width ;
  	$oFCKeditor->Height = $this->Height ;
  	$oFCKeditor->Value = $this->Value;
  	$editor=$oFCKeditor->CreateHtml() ;
    return $editor;
  }

}
?>
