public function run()
 {
     parent::run();
     // Saves $id will be the id of the element that ckeditor will target
     list($name, $id) = $this->resolveNameID();
     // Publish assets to public directory
     $baseDir = dirname(__FILE__);
     $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets');
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($assets . '/ckeditor.js');
     echo CHtml::activeTextArea($this->model, $this->attribute, array('rows' => 10, 'cols' => 70));
     $this->options = array_merge(array('filebrowserBrowseUrl' => array('/backend/elfinderBrowse'), 'height' => '250px', 'allowedContent' => true), $this->options);
     $this->setConfig($this->options);
     $this->ECKE->replace($id, $this->_config);
 }
 /**
  * Run script
  */
 public function run()
 {
     $this->htmlOptions['id'] = $this->id;
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'form-control textarea-control markitup-control';
     }
     if (!isset($this->htmlOptions['contenteditable'])) {
         $this->htmlOptions['contenteditable'] = true;
     }
     $textarea = '';
     if ($this->model instanceof CModel) {
         if (!$this->attribute) {
             throw new CException(Yii::t('yii', 'The $attribute argument must be a instance of CActiveRecord.'));
         } else {
             $textarea = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
         }
     } else {
         if (!$this->name) {
             throw new CException(Yii::t('yii', 'The $model or $name argument must be a filled.'));
         } else {
             $textarea = CHtml::textArea($this->name, $this->value, $this->htmlOptions);
         }
     }
     $this->render('rich-text', ['textarea' => $textarea, 'emoticonCategories' => EmoticonCategory::model()->findAll()]);
 }
Beispiel #3
0
 public function run()
 {
 	$this->editorOptions = array_merge($this->editorOptions, $this->defaultOptions);
 	
     list($name, $id) = $this->resolveNameID();
     
     // Publishing assets.
     $dir = dirname(__FILE__);
     $assets = Yii::app()->getAssetManager()->publish($dir.DIRECTORY_SEPARATOR.'assets');
     $this->editorOptions['script_url'] = $assets.'/tiny_mce.js';
     
     // Registering javascript.
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('jquery');
     $cs->registerScriptFile($assets.'/jquery.tinymce.js');
     $cs->registerScriptFile($assets.'/plugins/tinybrowser/tb_tinymce.js.php');
     
     $cs->registerScript(
         'Yii.'.get_class($this).'#'.$id,
         '$(function(){$("#'.$id.'").tinymce('.CJavaScript::encode($this->editorOptions).');});'
     );
     
     $this->htmlOptions['id'] = $id;
     
     if($this->hasModel())
         $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     else
         $html = CHtml::textArea($name, $this->value, $this->htmlOptions);
         
     echo $html;
 }
    /**
     * Display editor
     */
    public function run()
    {
        // Resolve name and id
        list($name, $id) = $this->resolveNameID();
        // Get assets dir
        $baseDir = dirname(__FILE__);
        $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'ueditor1_2_5');
        // Publish required assets
        $cs = Yii::app()->getClientScript();
        $jsFile = $this->debug ? 'editor_all.js' : 'editor_all_min.js';
        $cs->registerScriptFile($assets . '/' . $jsFile);
        $cs->registerScriptFile($assets . '/editor_config.js');
        $this->htmlOptions['id'] = $id;
        if (!array_key_exists('style', $this->htmlOptions)) {
            $this->htmlOptions['style'] = "width:{$this->width};";
        }
        if ($this->toolbars) {
            $this->editorOptions['toolbars'][] = $this->toolbars;
        }
        $options = CJSON::encode(array_merge(array('theme' => $this->theme, 'lang' => $this->language, 'UEDITOR_HOME_URL' => "{$assets}/", 'initialFrameWidth' => $this->width, 'initialFrameHeight' => $this->height), $this->editorOptions));
        $js = <<<EOP
UE.getEditor('{$id}',{$options});
EOP;
        // Register js code
        $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_READY);
        // Do we have a model
        if ($this->hasModel()) {
            $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
        } else {
            $html = CHtml::textArea($name, $this->value, $this->htmlOptions);
        }
        echo $html;
    }
 /**
  * Add WYMeditor to the page.
  */
 public function run()
 {
     // Add textarea to the page
     if ($this->target === null) {
         list($name, $id) = $this->resolveNameID();
         if ($this->hasModel()) {
             echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo CHtml::textArea($name, $this->value, $this->htmlOptions);
         }
     }
     // Publish extension assets
     $assets = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.EWYMeditor') . '/assets');
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($assets . '/jquery.wymeditor.js', CClientScript::POS_END);
     // Add the plugins to editor
     if ($this->plugins !== array()) {
         $this->_addPlugins($cs, $assets);
     }
     $options = CJavaScript::encode($this->options);
     if ($this->target === null) {
         $cs->registerScript('wym', "jQuery('#{$id}').wymeditor({$options});");
     } else {
         $cs->registerScript('wym', "jQuery('{$this->target}').wymeditor({$options});");
     }
 }
Beispiel #6
0
 /**
  * Executes the widget.
  * This method registers all needed client scripts and renders
  * the text field.
  */
 public function init()
 {
     $this->updateOptions();
     $baseDir = dirname(__FILE__);
     $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets');
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($assets . '/edit_area_full.js', CClientScript::POS_HEAD);
     $rand = md5(uniqid(rand(), true));
     if ($this->hasModel()) {
         if ($this->form) {
             $html = $this->form->textArea($this->model, $this->attribute, array('rows' => $this->options['rows'], 'cols' => $this->options['cols'], 'id' => $rand, 'encode' => true));
         } else {
             $html = CHtml::activeTextArea($this->model, $this->attribute, array('rows' => $this->options['rows'], 'cols' => $this->options['cols'], 'id' => $rand, 'encode' => true));
         }
     } else {
         $html = CHtml::textArea($this->options['name'], $this->options['value'], array('rows' => $this->options['rows'], 'cols' => $this->options['cols'], 'id' => $rand, 'encode' => true));
     }
     unset($this->options['rows']);
     unset($this->options['cols']);
     unset($this->options['name']);
     unset($this->options['class']);
     unset($this->options['value']);
     $js = "\teditAreaLoader.init({ \n\t\tid : \"{$rand}\"";
     foreach ($this->options as $k => $v) {
         $js .= ",\n\t\t{$k}: '{$v}'";
     }
     $js .= "\n\t});";
     Yii::app()->clientScript->registerScript($rand, $js, CClientScript::POS_READY);
     echo $html;
 }
Beispiel #7
0
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $name;
     }
     if ($this->hasModel()) {
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
     $options = CJavaScript::encode($this->options);
     $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'source';
     $baseUrl = Yii::app()->getAssetManager()->publish($path);
     $js = 'jQuery(\'#' . $id . '\').xheditor(' . $options . ');';
     $cs = Yii::app()->getClientScript();
     Yii::app()->clientScript->registerCoreScript('jquery');
     if (is_null($this->language)) {
         $this->language = Yii::app()->language;
     }
     $cs->registerScriptFile($baseUrl . '/xheditor-' . $this->language . '.min.js');
     $cs->registerScript(__CLASS__ . '#' . $id, $js);
 }
	/**
	 * Run widget.
	 */
	public function run()
	{
		if($this->hasModel())
			echo CHtml::activeTextArea($this->model,$this->attribute,$this->htmlOptions);
		else
			echo CHtml::textArea($this->name,$this->value,$this->htmlOptions);
	}
Beispiel #9
0
    /**
     * Display editor
     */
    public function run()
    {
        // Resolve name and id
        list($name, $id) = $this->resolveNameID();
        // Get assets dir
        $baseDir = dirname(__FILE__);
        $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets');
        // Publish required assets
        $cs = Yii::app()->getClientScript();
        $jsFile = $this->debugMode ? 'redactor.js' : 'redactor.min.js';
        $cs->registerScriptFile($assets . '/' . $jsFile);
        $cs->registerCssFile($assets . '/css/redactor.css');
        $this->htmlOptions['id'] = $id;
        if (!array_key_exists('style', $this->htmlOptions)) {
            $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};";
        }
        $options = CJSON::encode(array_merge($this->editorOptions, array('lang' => $this->lang, 'toolbar' => $this->toolbar)));
        $js = <<<EOP
\t\t\$('#{$id}').redactor({$options});
EOP;
        // Register js code
        $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_READY);
        // Do we have a model
        if ($this->hasModel()) {
            $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
        } else {
            $html = CHtml::textArea($name, $this->value, $this->htmlOptions);
        }
        echo $html;
    }
Beispiel #10
0
 /**
  * Renders field
  */
 public function renderField()
 {
     if ($this->hasModel()) {
         echo \CHtml::activeTextArea($this->model, $this->attribute, $this->options);
     } else {
         echo \CHtml::textArea($this->options['name'], $this->value, $this->options);
     }
 }
 /**
  * Print activeTextArea
  */
 public function run()
 {
     // add class ckeditor
     if (array_key_exists('class', $this->htmlOptions) && strpos($this->htmlOptions['class'], 'ckeditor') === false) {
         $this->htmlOptions['class'] .= ' ckeditor';
     } elseif (!array_key_exists('class', $this->htmlOptions)) {
         $this->htmlOptions['class'] = 'ckeditor';
     }
     echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
 }
Beispiel #12
0
 /**
  * Run widget.
  */
 public function run()
 {
     if ($this->hasModel()) {
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         if ($this->selector !== null) {
             echo CHtml::textArea($this->name, $this->value, $this->htmlOptions);
         }
     }
 }
Beispiel #13
0
    public function run()
    {
        $type = DataType::getInputType($this->column->dbType);
        $this->htmlOptions += $this->fixedHtmlOptions[$type];
        $column = $this->column->name;
        $name = isset($this->htmlOptions['name']) ? $this->htmlOptions['name'] : 'Row[' . $column . ']';
        switch ($type) {
            case 'number':
                echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
                break;
            case 'select':
                echo CHtml::activeDropDownList($this->row, $column, $this->getEnumValues(), $this->htmlOptions);
                break;
            case 'select-multiple':
                #echo CHtml::activeListBox($this->row, $column, $this->getSetValues(), $this->htmlOptions);
                echo CHtml::listBox($name, $this->row->getAttributeAsArray($column), $this->getSetValues(), $this->htmlOptions);
                break;
            case 'text':
                echo CHtml::activeTextArea($this->row, $column, $this->htmlOptions);
                break;
            case 'file':
                echo '<script type="text/javascript">
					$(document).ready(function() {
						$("# echo CHtml::$idPrefix; ?>").submit(function() {
							alert("ok1");
							
						});
					});
					</script>';
                echo CHtml::activeFileField($this->row, $column, $this->htmlOptions);
                break;
            case 'date':
                $this->SetDateTimeHtmlOptions($column);
                echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
                echo '<script type="text/javascript">
						$(document).ready(function() {
							$("#' . $this->htmlOptions['id'] . '").datepicker({showOn: "button", dateFormat: "yy-mm-dd", buttonImage: "' . ICONPATH . '/16/calendar.png' . '", buttonImageOnly: true, buttonText: "' . Yii::t('core', 'showCalendar') . '"});
						});
						</script>';
                break;
            case 'datetime':
                $this->SetDateTimeHtmlOptions($column);
                echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
                echo '<script type="text/javascript">
						$(document).ready(function() {
							now = new Date();
							$("#' . $this->htmlOptions['id'] . '").datepicker({showOn: "button", dateFormat: "yy-mm-dd " + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(), buttonImage: "' . ICONPATH . '/16/calendar.png' . '", buttonImageOnly: true, buttonText: "' . Yii::t('core', 'showCalendar') . '"});
						});
						</script>';
                break;
            default:
                echo CHtml::activeTextField($this->row, $column, $this->htmlOptions);
                break;
        }
    }
Beispiel #14
0
 /**
  * Renders field
  */
 public function renderField()
 {
     list($name, $id) = $this->resolveNameID();
     TbArray::defaultValue('id', $id, $this->htmlOptions);
     TbArray::defaultValue('name', $name, $this->htmlOptions);
     if ($this->hasModel()) {
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
 }
Beispiel #15
0
 /**
  * @throws \Exception
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $this->htmlOptions['id'] = $id;
     if ($this->hasModel()) {
         echo \CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo \CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
     $this->registerClientScript($id);
 }
 public function getField($widgetId, $rowGroupName = '', $rowIndex, $model, $attribute, $name, $value = '', $fieldClassName = '', $htmlOptions = array(), $hasError = false, $data = '', $params = '')
 {
     if ($hasError) {
         $fieldClassName = $fieldClassName . ' ' . CHtml::$errorCss;
     }
     $htmlOptions = ClonnableFields::addClass($htmlOptions, $fieldClassName);
     if (ClonnableFields::isModel($model)) {
         return CHtml::activeTextArea($model, $attribute, $htmlOptions);
     } else {
         return CHtml::textArea($name, $value, $htmlOptions);
     }
 }
 /**
  * Display editor
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $this->htmlOptions['id'] = $id;
     $this->registerClientScript($id);
     if (!array_key_exists('style', $this->htmlOptions)) {
         $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};";
     }
     if ($this->hasModel()) {
         // Do we have a model?
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
 }
Beispiel #18
0
 /**
  * Init widget.
  */
 public function init()
 {
     parent::init();
     if ($this->selector === null) {
         list($this->name, $this->id) = $this->resolveNameID();
         $this->htmlOptions['id'] = $this->getId();
         $this->selector = '#' . $this->getId();
         if ($this->hasModel()) {
             echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo CHtml::textArea($this->name, $this->value, $this->htmlOptions);
         }
     }
     $this->registerClientScript();
 }
Beispiel #19
0
 /**
  * Renders field
  */
 public function renderField()
 {
     list($name, $id) = $this->resolveNameID();
     $this->options['id'] = ArrayHelper::getValue($this->options, 'id', $id);
     $this->options['name'] = ArrayHelper::getValue($this->options, 'name', $name);
     $tagOptions = $this->options;
     $tagOptions['id'] = 'aceEditor_' . $tagOptions['id'];
     echo \CHtml::tag('div', $tagOptions);
     $this->options['style'] = 'display:none';
     if ($this->hasModel()) {
         echo \CHtml::activeTextArea($this->model, $this->attribute, $this->options);
     } else {
         echo \CHtml::textArea($name, $this->value, $this->options);
     }
     $this->options = $tagOptions;
 }
Beispiel #20
0
 /**
  * Renders field
  */
 public function renderField()
 {
     list($name, $id) = $this->resolveNameID();
     TbArray::defaultValue('id', $id, $this->htmlOptions);
     TbArray::defaultValue('name', $name, $this->htmlOptions);
     $tagOptions = $this->htmlOptions;
     $tagOptions['id'] = 'aceEditor_' . $tagOptions['id'];
     echo CHtml::openTag('div', $tagOptions);
     echo CHtml::closeTag('div');
     $this->htmlOptions['style'] = 'display:none';
     if ($this->hasModel()) {
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
     $this->htmlOptions = $tagOptions;
 }
Beispiel #21
0
 /**
  *### .run()
  *
  * Display editor
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $this->registerClientScript($id);
     $this->htmlOptions['id'] = $id;
     // Do we have a model?
     if ($this->hasModel()) {
         if ($this->form) {
             $html = $this->form->textArea($this->model, $this->attribute, $this->htmlOptions);
         } else {
             $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
         }
     } else {
         $html = CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
     echo $html;
 }
Beispiel #22
0
    public function run()
    {
        $cs = Yii::app()->getClientScript();
        $textAreaOptions = $this->gettextareaOptions();
        $textAreaOptions['name'] = CHtml::resolveName($this->model, $this->name);
        $this->id = $textAreaOptions['id'] = CHtml::getIdByName($textAreaOptions['name']);
        echo CHtml::activeTextArea($this->model, $this->name, $textAreaOptions);
        $properties_string = CJavaScript::encode($this->getKeProperties());
        $js = <<<EOF
KindEditor.ready(function(K) {
\tvar editor_{$this->id} = K.create('#{$this->id}', 
{$properties_string}
\t);
});
EOF;
        $cs->registerScript('KE' . $this->name, $js, CClientScript::POS_HEAD);
    }
 /**
  * Display editor
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $this->registerClientScript($id);
     // Markdown Editor looks for an id of wmd-input...
     $this->htmlOptions['id'] = $id;
     $this->htmlOptions['class'] = isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] . ' wmd-input' : 'wmd-input';
     if (!array_key_exists('style', $this->htmlOptions)) {
         $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};";
     }
     // Do we have a model?
     if ($this->hasModel()) {
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
 }
Beispiel #24
0
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'jquery';
     $baseUrl = Yii::app()->getAssetManager()->publish($dir);
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('jquery');
     $cs->registerScriptFile($baseUrl . '/jquery.autogrow.js');
     if ($this->hasModel()) {
         $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         $html = CHtml::textArea($id, $this->value, $this->htmlOptions);
     }
     $js = $this->jsCode($id);
     $cs->registerScript(get_class($this) . '_' . $id, $js);
     echo $html;
 }
 /**
  * Init widget.
  */
 public function init()
 {
     parent::init();
     if ($this->selector === null) {
         list($this->name, $this->id) = $this->resolveNameID();
         $this->htmlOptions['id'] = $this->getId();
         $this->selector = '#' . $this->getId();
         if ($this->hasModel()) {
             echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo CHtml::textArea($this->name, $this->value, $this->htmlOptions);
         }
     }
     $package = array_merge(array('baseUrl' => $this->getAssetsUrl()), $this->package);
     self::initClientScript($package, isset($this->options['lang']) && $this->options['lang'] !== 'en' ? $this->options['lang'] : null);
     $this->registerClientScript();
 }
Beispiel #26
0
 public function init()
 {
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $name;
     }
     $this->registerClientScript();
     if ($this->hasModel()) {
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
 }
Beispiel #27
0
    public function run()
    {
        parent::run();
        list($name, $id) = $this->resolveNameID();
        $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets');
        $options = $this->makeOptions();
        $cs = Yii::app()->getClientScript();
        $cs->registerScriptFile($assets . '/ckeditor.js');
        $this->htmlOptions['id'] = $id;
        $js = <<<EOP
CKEDITOR.replace('{$name}',{$options});
EOP;
        $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD);
        if ($this->hasModel()) {
            $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
        } else {
            $html = CHtml::textArea($name, $this->value, $this->htmlOptions);
        }
        echo $html;
    }
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $name;
     }
     if ($this->hasModel()) {
         echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textArea($name, $this->value, $this->htmlOptions);
     }
     $options = CJavaScript::encode($this->options);
     Yii::app()->clientScript->registerScript($id, "\n\t\t\t\$('#{$id}').cleditor({$options});\n\t\t");
 }
 public function init()
 {
     parent::init();
     if (!isset($this->editorOptions['lang'])) {
         $this->editorOptions['lang'] = substr(Yii::app()->getLanguage(), 0, 2);
     }
     if ($this->selector === null) {
         list($this->name, $this->id) = $this->resolveNameID();
         $this->htmlOptions['id'] = $this->id;
         $this->selector = '#' . $this->id;
         if (!array_key_exists('style', $this->htmlOptions)) {
             $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};";
         }
         if ($this->hasModel()) {
             echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo CHtml::textArea($this->name, $this->value, $this->htmlOptions);
         }
     }
     $this->registerClientScript($this->id);
 }
Beispiel #30
-1
 public function run()
 {
     parent::run();
     // Saves $id will be the id of the element that ckeditor will target
     list($name, $id) = $this->resolveNameID();
     // Publish assets to public directory
     $baseDir = dirname(__FILE__);
     $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets');
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($assets . '/ckeditor.js');
     echo CHtml::activeTextArea($this->model, $this->attribute, array('rows' => 10, 'cols' => 70));
     $this->ECKE->replace($id, $this->_config);
 }