本文整理汇总了PHP中TbHtml::activeDropDownList方法的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml::activeDropDownList方法的具体用法?PHP TbHtml::activeDropDownList怎么用?PHP TbHtml::activeDropDownList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbHtml
的用法示例。
在下文中一共展示了TbHtml::activeDropDownList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFilterCellContent
/**
* Renders the filter cell content. Here we can provide HTML options for actual filter input
*/
protected function renderFilterCellContent()
{
if (is_string($this->filter)) {
echo $this->filter;
} else {
if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) {
if ($this->filterInputOptions) {
$filterInputOptions = $this->filterInputOptions;
if (empty($filterInputOptions['id'])) {
$filterInputOptions['id'] = false;
}
} else {
$filterInputOptions = array();
}
if (is_array($this->filter)) {
$filterInputOptions['prompt'] = '';
echo TbHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, $filterInputOptions);
} else {
if ($this->filter === null) {
echo TbHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions);
}
}
} else {
parent::renderFilterCellContent();
}
}
}
示例2: 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});");
}
}
示例3: 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);
}
}
示例4: testActiveDropDownList
public function testActiveDropDownList()
{
$I = $this->codeGuy;
$html = TbHtml::activeDropDownList(new Dummy(), 'dropdown', array('1', '2', '3', '4', '5'), array('class' => 'list', 'empty' => 'Empty text', 'size' => TbHtml::INPUT_SIZE_LARGE, 'textAlign' => TbHtml::TEXT_ALIGN_CENTER));
$select = $I->createNode($html, 'select');
$I->seeNodeCssClass($select, 'input-large text-center list');
$I->dontSeeNodeAttribute($select, 'size');
}
示例5: dropDownList
/**
* Renders a dropdown list for a model attribute.
* @param CModel $model the data model.
* @param string $attribute the attribute.
* @param array $data data for generating the list options (value=>display).
* @param array $htmlOptions additional HTML attributes.
* @return string the generated drop down list.
* @see TbHtml::activeDropDownList
*/
public function dropDownList($model, $attribute, $data, $htmlOptions = array())
{
return TbHtml::activeDropDownList($model, $attribute, $data, $htmlOptions);
}
示例6: dropDownList
/**
* Renders a dropdown list for a model attribute.
* This method is a wrapper of {@link CHtml::activeDropDownList}.
* Please check {@link CHtml::activeDropDownList} for detailed information
* about the parameters for this method.
* @param CModel $model the data model
* @param string $attribute the attribute
* @param array $data data for generating the list options (value=>display)
* @param array $htmlOptions additional HTML attributes.
* @return string the generated drop down list
*/
public function dropDownList($model, $attribute, $data, $htmlOptions = array())
{
return $this->wrapControl(TbHtml::activeDropDownList($model, $attribute, $data, $htmlOptions));
}
示例7: array
?>
<?php
echo TbHtml::error($model, 'position');
?>
<p class="hint"><?php
echo UserModule::t('Display order of fields.');
?>
</p>
</div>
<div class="row visible">
<?php
echo TbHtml::activeLabelEx($model, 'visible');
?>
<?php
echo TbHtml::activeDropDownList($model, 'visible', ProfileField::itemAlias('visible'));
?>
<?php
echo TbHtml::error($model, 'visible');
?>
</div>
<div class="row buttons">
<?php
echo TbHtml::button($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save'), array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'submit' => ''));
?>
</div>
<?php
echo TbHtml::endForm();
?>
示例8: array
?>
<?php
echo $form->textField($description, 'name', array('size' => 60, 'maxlength' => 64));
?>
<?php
echo $form->error($description, 'name');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'attribute_group_id');
?>
<?php
echo TbHtml::activeDropDownList($model, 'attribute_group_id', TbHtml::listData(AttributeGroup::model()->findAll(), 'id', function ($data) {
return $data->getName();
}));
?>
<?php
echo $form->error($model, 'attribute_group_id');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'sort_order');
?>
<?php
echo $form->textField($model, 'sort_order');
?>
<?php