[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wysiwyg/src/template/components/ -> lmbTinyMCEComponent.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/wysiwyg/src/template/components/lmbWysiwygComponent.class.php');
  10  
  11  /**

  12   * class lmbTinyMCEComponent.

  13   *

  14   * @package wysiwyg

  15   * @version $Id$

  16   */
  17  class lmbTinyMCEComponent extends lmbWysiwygComponent
  18  {
  19    protected $_base_path;
  20    protected $_css_class;
  21    public static $is_included = false;
  22    function renderContents()
  23    {
  24      $this->renderEditor();
  25      parent::renderContents();
  26    }
  27  
  28    function renderEditor()
  29    {
  30      $this->_setEditorParameters();
  31      if(!self::$is_included)
  32      {
  33        echo '<script language="javascript" type="text/javascript" src="'.$this->_base_path.'tiny_mce.js"></script>';
  34        self::$is_included = true;
  35        
  36      }
  37      echo '
  38      <script language="javascript" type="text/javascript">
  39      tinyMCE.init({
  40      '.$this->_renderEditorParameters().'
  41      });
  42      </script>
  43      ';
  44    }
  45  
  46    function _renderEditorParameters()
  47    {
  48      $items = array();
  49  
  50      $items[] = 'editor_selector : "'.$this->_css_class.'"';
  51       
  52      if ($config = $this->getIniOption('editor') and count($config))
  53      {
  54        foreach ($config as $key => $val)
  55        $items[] = $key . ': "'. $val . '"'; 
  56      }
  57  
  58      return implode (",\n", $items);
  59    }
  60  
  61    function _setEditorParameters()
  62    {
  63      if($this->getIniOption('base_path'))
  64        $this->_base_path  = $this->getIniOption('base_path');
  65      
  66      if (!$this->_css_class = $this->getAttribute('class')){
  67        $this->_css_class = $this->getAttribute('name');
  68        $this->setAttribute('class', $this->_css_class);
  69      }
  70    }
  71  }
  72  
  73  ?>


Generated: Fri Nov 21 03:53:03 2008 Cross-referenced by PHPXref 0.7