本文整理汇总了PHP中CHtml::textArea方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::textArea方法的具体用法?PHP CHtml::textArea怎么用?PHP CHtml::textArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::textArea方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
//begin form
echo CHtml::beginForm($this->action, $this->method, array('id' => $this->id, 'enctype' => $this->enctype, 'class' => $this->class));
foreach ($this->model as $item) {
if ($this->selector) {
echo CHtml::checkBox('selector_' . $item['key']);
}
$name = Awecms::generateFriendlyName($item["key"]);
?>
<div class="settings row">
<?php
echo $this->getlabel($item['key']);
switch ($item['type']) {
//add new types here
case 'textfield':
echo $this->getFullTextField($item);
break;
case 'boolean':
echo CHtml::hiddenField($item['key'], 0);
echo CHtml::checkBox($item['key'], $item['value']);
break;
case 'image_url':
echo $this->getFullTextField($item);
echo "<a class=\"right\" href=\"{$item["value"]}\" target=\"_blank\"><img src=\"{$item["value"]}\" title=\"{$name}\" alt=\"{$name}\" /></a>";
break;
case 'email':
echo $this->getFullTextField($item);
break;
case 'textarea':
echo CHtml::textArea($item['key'], $item['value']);
case 'NULL':
break;
default:
echo "Unsupported type: " . $item['type'] . " of " . $item['key'] . " with value " . $item['value'] . "<br/>";
break;
}
if (isset($item['hint'])) {
?>
<p class="hint">
<?php
echo $item['hint'];
?>
</p>
<?php
}
?>
</div>
<?php
}
?>
<div class="row buttons">
<?php
echo CHtml::submitButton('Submit!');
?>
</div>
<?php
echo CHtml::endForm();
}
示例2: 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;
}
示例3: 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});");
}
}
示例4: 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);
}
示例5: 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;
}
示例6: 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);
}
示例7: 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;
}
示例8: 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;
}
示例9: 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()]);
}
示例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
public function run()
{
$htmlOptions = $this->htmlOptions;
list($name, $id) = $this->resolveNameID();
echo CHtml::tag('div', $htmlOptions, CHtml::textArea($name, $this->value, array('id' => $id)));
$config = json_encode($this->editorOptions);
App()->getClientScript()->registerScript("initJsonEditor" . $id, "\$('#{$id}').jsonEditor({$config});", CClientScript::POS_READY);
}
示例12: run
public function run()
{
list($name, $id) = $this->resolveNameID();
echo CHtml::tag('div', array('id' => $id . '_container', 'class' => 'editor'), false, false);
echo CHtml::tag('div', array('id' => $id . '_editor', 'style' => 'height: ' . $this->height . 'px'), false, false);
echo CHtml::closeTag('div');
echo CHtml::textArea($name, $this->value, array('id' => $id, 'class' => 'editorTextarea'));
echo CHtml::closeTag('div');
}
示例13: 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);
}
}
}
示例14: textArea
/**
* Generates a text area input.
* @param string the input name
* @param string the input value
* @param array additional HTML attributes. Besides normal HTML attributes, a few special
* attributes are also recognized (see {@link clientChange} and {@link tag} for more details.)
* @return string the generated text area
* @see clientChange
* @see inputField
*/
public static function textArea($name, $value = '', $htmlOptions = array())
{
if (isset($htmlOptions['class'])) {
if (stripos($htmlOptions['class'], 'ui-corner-all') === false) {
$htmlOptions['class'] .= ' ui-corner-all';
}
} else {
$htmlOptions['class'] = 'ui-corner-all';
}
return parent::textArea($name, $value, $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);
}