本文整理汇总了PHP中TbHtml::activeHiddenField方法的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml::activeHiddenField方法的具体用法?PHP TbHtml::activeHiddenField怎么用?PHP TbHtml::activeHiddenField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbHtml
的用法示例。
在下文中一共展示了TbHtml::activeHiddenField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Runs the widget.
*/
public function run()
{
list($name, $id) = $this->resolveNameID();
$id = $this->resolveId($id);
echo TbHtml::openTag('div', array('class' => 'select2'));
if ($this->hasModel()) {
if ($this->asDropDownList) {
echo TbHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
} else {
echo TbHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
}
} else {
if ($this->asDropDownList) {
echo TbHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions);
} else {
echo TbHtml::hiddenField($name, $this->value, $this->htmlOptions);
}
}
echo '</div>';
if ($this->assetPath !== false) {
$this->publishAssets($this->assetPath);
$this->registerCssFile('/select2.css');
if ($this->registerJs) {
$this->registerScriptFile('/select2.js', CClientScript::POS_END);
}
}
if ($this->bindPlugin) {
$options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
$this->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').select2({$options});");
}
}
示例2: renderField
/**
* Renders the select2 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 $this->asDropDownList ? TbHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) : TbHtml::activeHiddenField($this->model, $this->attribute);
} else {
echo $this->asDropDownList ? TbHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions) : TbHtml::hiddenField($this->name, $this->value);
}
}
示例3: renderImages
public function renderImages()
{
$html = <<<EOF
<div id='imagesnow' style='display:none;min-height:330px;border:1px dashed slategray;overflow-x:scroll;' onload="startimagesnow">
<ul id="sortable"></ul>
</div>
EOF;
echo CHtml::openTag('div', array('class' => 'controls'));
echo $html;
echo TbHtml::button("图片预览", array('id' => 'Post_togglemagesnow'));
echo TbHtml::button("上传图片", array('id' => 'Post_selectImage'));
echo TbHtml::activeHiddenField($this->model, 'images');
echo CHtml::closeTag('div');
}
示例4: get_class
<?php
/* @var $this DefaultController */
Yii::import('application.modules.user.models.User');
$modelClass = get_class($news);
$this->widget('bootstrap.widgets.TbBreadcrumb', array('links' => array(Yii::t('main', ucfirst($this->module->id)) => Yii::app()->createUrl($this->module->id), Yii::t('main', ucfirst($this->action->id)))));
?>
<?php
$this->widget('bootstrap.widgets.TbAlert', array('block' => true, 'fade' => true, 'closeText' => '×', 'alerts' => array('success' => array('block' => true, 'fade' => true, 'closeText' => '×'), 'error' => array('block' => true, 'fade' => true, 'closeText' => '×'))));
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'news-form', 'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
//show errors (for all models)
echo $form->errorSummary(array($news, $post, $portfolio), null, null, array('class' => 'alert-error'));
//hidden field for post_type (set by defined controller)
echo TbHtml::activeHiddenField($post, 'post_type');
?>
<div class="control-group">
<?php
echo TbHtml::activeLabelEx($news, 'publication_date', array('class' => 'control-label'));
?>
<div class="controls">
<?php
$this->widget('yiiwheels.widgets.datetimepicker.WhDateTimePicker', array('name' => $modelClass . '[publication_date]', 'id' => $modelClass . '_publication_date', 'value' => $news->publication_date, 'format' => 'yyyy-MM-dd hh:mm:ss', 'pluginOptions' => array()));
?>
</div>
</div>
<?php
//echo $form->dropDownListControlGroup($news, 'user_id', CHtml::listData(User::model()->findAll(), 'user_id', 'email'), array('size'=>1));
?>