本文整理汇总了PHP中CHtml::activeTextArea方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::activeTextArea方法的具体用法?PHP CHtml::activeTextArea怎么用?PHP CHtml::activeTextArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::activeTextArea方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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);
}
示例2: run
/**
* 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()]);
}
示例3: run
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;
}
示例4: run
/**
* 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;
}
示例5: run
/**
* 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});");
}
}
示例6: init
/**
* 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;
}
示例7: run
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);
}
示例8: run
/**
* 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);
}
示例9: run
/**
* 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;
}
示例10: renderField
/**
* 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);
}
}
示例11: run
/**
* 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);
}
示例12: run
/**
* 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);
}
}
}
示例13: run
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;
}
}
示例14: renderField
/**
* 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);
}
}
示例15: run
/**
* @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);
}