Generates a control group with a drop down list.
public static dropDownListControlGroup ( string $name, string $select = '', array $data = [], array $htmlOptions = [] ) : string | ||
$name | string | the input name. |
$select | string | the selected value. |
$data | array | data for generating the list options (value=>display). |
$htmlOptions | array | additional HTML attributes. |
Résultat | string | the generated control group. |
<div style="margin-top:30px;"> <?php echo TbHtml::dropDownListControlGroup('rangodesde[]', '',$data, array('label'=>TbHtml::labelTb('Desde', array('color' => TbHtml::LABEL_COLOR_SUCCESS ,'style'=>'padding:5px;')), 'prompt' => 'Código', )); echo TbHtml::dropDownListControlGroup('rangohasta[]', '', $data , array('label'=>TbHtml::labelTb('Hasta', array('color' => TbHtml::LABEL_COLOR_IMPORTANT ,'style'=>'padding:5px;')), 'prompt' => 'Código', )); ?> </div>
/** * Renders the "Watch as playlist" button */ private function renderWatchButton() { // Select the default playlist format by default $dropdownOptions = array(Setting::getString('playlistFormat') => array('selected' => 'selected')); echo TbHtml::dropDownListControlGroup('playlistFormat', 'playlistFormat', PlaylistFactory::getTypes(), array('label' => Yii::t('Settings', 'Playlist format'), 'options' => $dropdownOptions)); echo TbHtml::submitButton(Yii::t('RetrieveMediaWidget', 'Watch as playlist'), $this->getWatchButtonsOptions()); }
// la busqueda de las practicas se hace enviando al controlador Practicas las // opciones seleccionadas. //Una vez hecha la seleccion, se envia con el formulario completo al controlador //osplan/update echo TbHtml::dropDownListControlGroup('idnomenclador',false, CHtml::listData(Nomenclador::model()->findAll(array('order' => 'nombre')), 'idnomenclador', 'nombre'), array( 'prompt'=>'Seleccionar', // 'label' =>'Nomenclador Base', 'label'=>TbHtml::labelTb('Nomenclador base', array('color' => TbHtml::LABEL_COLOR_WARNING, 'style' => 'padding: 5px ; margin:-2px;')), // esta funcion la deshabilito y pongo el boton ajaxbutton mas abajo, para // enviar los datos idnomenclador junto con el filtro de tipo de practicas // // 'ajax' => array( // 'type' => 'GET', //request type, pongo GET para que funcione el pager en la _grillapracticas generada // 'dataType' => 'html', // // data usa javascript, en otros casos, puede ser de la forma php array('id'=>'js:this.value') // 'data' => 'js:$(".tipopract:checked").serialize()+ "&idnomenclador=" + this.value', // 'url' => CController::createUrl('Practica/listarpracticaspornomenclador'), //url to call. //// 'update' => "#formunidades", // 'success'=> 'js:function(data){ $("#form2").show();$("#formunidades").html(data).show()}', // // ) )); echo TbHtml::ajaxButton(Yii::t('app', 'Buscar'), array('Practica/listarpracticaspornomenclador'), $ajaxOptions = array( // aca la funcion and && valida que se haya seleccionado un nomenclador // si es asi, se envia el tipo de practica a filtrar y el idnomenclador al controlador
public function testDropDownListControlGroup() { $I = $this->codeGuy; $html = TbHtml::dropDownListControlGroup('dropdown', '', array('1', '2', '3', '4', '5')); $group = $I->createNode($html, 'div.control-group'); $controls = $group->filter('div.controls'); $I->seeNodeChildren($controls, array('select')); }
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'category-form', 'htmlOptions' => array('class' => 'form-horizontal', 'enctype' => 'multipart/form-data'), 'enableAjaxValidation' => false, 'enableClientValidation' => true)); if ($model->hasErrors()) { ?> <div class="control-group"> <?php echo $form->errorSummary($model); ?> </div> <?php } ?> <div class="control-group"><p class="help-block">带 <span class="required">*</span> 的字段为必填项.</p></div> <?php $parent_id = $model->isNewRecord ? 0 : $model->parent()->find()->category_id; $data = Category::model()->getSelectOptions(3, true); echo TbHtml::dropDownListControlGroup('Category[node]', $parent_id, $data, array('label' => '上级分类')); echo $form->textFieldControlGroup($model, 'name'); echo $form->inlineRadioButtonListControlGroup($model, 'label', $model->getLabelList()); echo $form->textFieldControlGroup($model, 'url'); //echo $form->fileFieldControlGroup($model, 'pic'); ?> <div class="control-group"> <?php echo $form->labelEx($model, 'pic', array('class' => 'control-label')); ?> <div class="controls"> <?php $this->widget('ext.elFinder.ServerFileInput', array('model' => $model, 'attribute' => 'pic', 'filebrowserBrowseUrl' => Yii::app()->createUrl('core/elfinder/view'))); ?> </div> </div>
$itemProps = ItemProp::model()->with('propValues')->findAll(new CDbCriteria(array('condition' => "t.`category_id` = {$model->category_id} AND t.`type` > 1"))); foreach ($itemProps as $itemProp) { if (!$itemProp->is_sale_prop) { $itemPropValue = ''; if (isset($itemPropValues[$itemProp->item_prop_id])) { $values = explode(':', $itemPropValues[$itemProp->item_prop_id]); $itemPropValue = $values[1]; } $name = 'ItemProp[' . $itemProp->item_prop_id . ']'; switch ($itemProp->type) { case 1: echo TbHtml::textFieldControlGroup($name, $itemPropValue, array('label' => $itemProp->prop_name)); break; case 2: $propValueData = CHtml::listData($itemProp->propValues, 'prop_value_id', 'value_name'); echo TbHtml::dropDownListControlGroup($name, $itemPropValue, $propValueData, array('label' => $itemProp->prop_name)); break; case 3: $propValueData = CHtml::listData($itemProp->propValues, 'prop_value_id', 'value_name'); echo TbHtml::inlineCheckBoxListControlGroup($name, $itemPropValue, $propValueData, array('label' => $itemProp->prop_name)); break; } } } ?> <hr/> <?php $thead = ''; $i = 0; foreach ($itemProps as $itemProp) { if ($itemProp->is_sale_prop) {