/** * 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); } }
<div class="form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'form-ventaslevel1', 'enableClientValidation' => true, 'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL, 'method' => 'get', 'action' => array('reportes/buscarBoleto'), 'clientOptions' => array('validateOnSubmit' => true))); ?> <div class='col-2'> <?php $boton = TbHtml::buttonDropdown('Buscar', array(array('label' => 'Referencia', 'url' => '#', 'class' => 'tipo', 'data-tipo' => 'venta'), array('label' => 'No. Boleto', 'url' => '#', 'class' => 'tipo', 'data-tipo' => 'boleto'), array('label' => 'No. Boleto Reimpreso', 'url' => '#', 'class' => 'tipo', 'data-tipo' => 'reimpresion'), TbHtml::menuDivider(), array('label' => 'Reservación Farmatodo', 'url' => '#', 'class' => 'tipo', 'data-tipo' => 'reservado')), array('color' => TbHtml::BUTTON_COLOR_PRIMARY)); ?> <?php echo TbHtml::textFieldControlGroup('ref', $ref > 0 ? $ref : '', array('span' => 4, 'placeholder' => 'Referencia o número de boleto', 'label' => 'Ingrese la referencia o el número de boleto:', 'id' => 'filtro', 'autofocus' => "autofocus", 'append' => $boton)); ?> </div> <div class="box1 text-left"> <?php echo TbHtml::hiddenField('tipo'); //echo TbHtml::radioButtonList('tipo',isset($tipo)?$tipo:'venta',array( //'venta'=>'Referencia', //'boleto'=>'No. Boleto', //'reimpresion'=>'Reimpresion', //)); ?> </div> <?php $this->endWidget(); ?> </div><!-- form --> </div><!-- Controles -->
/** * 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});"); } }
<?php echo CHtml::tag('legend', array(), 'Configuración de la Distribución'); ?> <div class="box box4 white-box"> <h3>Información básica</h3> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'form-forolevel1', 'enableAjaxValidation' => false, 'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL)); ?> <?php echo $form->dropDownListControlGroup($dist, 'ForoId', CHtml::listData(Foro::model()->findAll(), 'ForoId', 'ForoNom'), array('class' => '', 'disabled' => true)); $this->widget('bootstrap.widgets.TbAlert'); ?> <?php echo $form->textFieldControlGroup($dist, 'ForoMapIntNom', array('class' => 'forolevel1')); echo TbHtml::hiddenField('YII_CSRF_TOKEN', Yii::app()->request->csrfToken); //echo TbHtml::submitButton(' Guardar información', //array( //'id'=>'btn-guardar', //'class'=> 'btn fa fa-save ') //); $this->endWidget(); ?> </div> <!--- ------------------------------------------------------------------------- Distribucion-------- --> <div class="box box6 white-box"> <h3>Configuración del mapa</h3> <?php $this->renderPartial('actualizar', compact('model'), false, true); ?>