Exemplo n.º 1
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->options = array_merge(array('filebrowserBrowseUrl' => array('/backend/elfinderBrowse'), 'height' => '250px', 'allowedContent' => true), $this->options);
     $this->setConfig($this->options);
     $this->ECKE->replace($id, $this->_config);
 }
Exemplo n.º 2
0
 /**
  * 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()]);
 }
Exemplo n.º 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;
 }
Exemplo n.º 4
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 . '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;
    }
Exemplo n.º 5
0
 /**
  * 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});");
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
	}
Exemplo n.º 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;
    }
Exemplo n.º 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);
     }
 }
Exemplo n.º 11
0
 /**
  * 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);
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 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;
        }
    }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 16
0
 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);
     }
 }
Exemplo n.º 17
0
 /**
  * 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);
     }
 }
Exemplo n.º 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();
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
    }
Exemplo n.º 23
0
 /**
  * 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);
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 25
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);
         }
     }
     $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();
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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");
 }
Exemplo n.º 29
0
 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);
 }
Exemplo n.º 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);
 }