/** * 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});"); } }
/** * 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); } }
<?php /* *EDITOR DE SUBZONA */ ?> <div class='controles'> <h2>Editor de subzona.</h2> <?php echo TbHtml::dropDownList('SubzonaId', $subzona->SubzonaId, TbHtml::listData($subzona->hermanas, 'SubzonaId', 'nombre'), array('class' => 'input-medium panel-head')); ?> <br /> <?php echo TbHtml::buttonGroup(array(array('title' => 'Alinear todo a la izquierda', 'class' => 'fa fa-align-left fa-3x btn btn-large btn-alinear', 'url' => array('alinearSubzona', 'EventoId' => $subzona->EventoId, 'FuncionesId' => $subzona->FuncionesId, 'ZonasId' => $subzona->ZonasId, 'SubzonaId' => $subzona->SubzonaId, 'direccion' => 'izquierda')), array('title' => 'Alinear todo al centro', 'class' => 'fa fa-align-center fa-3x btn btn-large btn-alinear', 'url' => array('alinearSubzona', 'EventoId' => $subzona->EventoId, 'FuncionesId' => $subzona->FuncionesId, 'ZonasId' => $subzona->ZonasId, 'SubzonaId' => $subzona->SubzonaId, 'direccion' => 'centro')), array('title' => 'Alinear todo a la derecha', 'class' => 'fa fa-align-right fa-3x btn btn-large btn-alinear', 'url' => array('alinearSubzona', 'EventoId' => $subzona->EventoId, 'FuncionesId' => $subzona->FuncionesId, 'ZonasId' => $subzona->ZonasId, 'SubzonaId' => $subzona->SubzonaId, 'direccion' => 'derecha'))), array('vertical' => false)); ?> <br /> <?php echo TbHtml::link(' Regresar', array('editor', 'EventoId' => $subzona->EventoId, 'FuncionesId' => $subzona->FuncionesId, 'scenario' => 'editar', '#' => 'zona-' . $subzona->ZonasId), array('class' => 'btn fa fa-arrow-left', 'style' => 'margin:10px')); ?> </div> <div id='area-subzona'> <?php $this->renderPartial('_subzona', compact('subzona')); ?> </div> <br /> <style type="text/css" media="screen"> table{background:#eeD} th,td{margin:5px;padding:5px !important;}
<div class="form"> <?php echo TbHtml::beginForm($request_url, 'post', array('enctype' => 'multipart/form-data')); ?> <div class="form-group has-success clearfix"> <div class="wr col-sm-6"> <?php echo TbHtml::dropDownList('reader_list', 'id', $reader_list, array('empty' => 'Выберите Пользователя', 'required' => 'true', 'options' => array(isset($reader_id_checked) ? $reader_id_checked : '' => array('selected' => true)))); ?> </div> <div class="wr col-sm-6"> <?php echo TbHtml::dropDownList('books_list', 'id', $books_list, array('empty' => 'Выберите Книгу', 'required' => 'true', 'options' => array(isset($book_id_checked) ? $book_id_checked : '' => array('selected' => true)))); ?> </div> <div class="wr col-sm-6"> <?php echo TbHtml::activeTextField($model, 'count_books', array('placeholder' => 'Количество', 'required' => true, 'pattern' => '[0-9]{1,2}', 'value' => isset($count) ? $count : '')); ?> </div> </div> <div> <?php echo TbHtml::submitButton('Выдать', array('color' => TbHtml::BUTTON_COLOR_PRIMARY)); ?> </div> <?php echo TbHtml::endForm(); ?> </div>
echo Yii::t('ReisModule.default', 'Добавить из личного кабинета'); ?> :</h3> </section> </div> <div class="row"> <section class="col-sm-6"> <?php echo $form->dropDownListGroup($Reis, 'transport_type_id', ['widgetOptions' => ['data' => ['' => '---'] + Reis::getTransportType()], 'label' => '']); ?> </section> <section class="col-sm-6"> <?php Yii::import('bootstrap.helpers.TbHtml'); echo TbHtml::dropDownList('data_from_autopark', '', $listAvtoparkData, ['class' => 'form-control', 'empty' => '---', 'onChange' => 'fillFormFromAutoparkData(this)']); ?> </section> </div> <?php } // filldata from avtopark end ?> <div class="row"> <section class="col-sm-6"> <div class="row address"> <section class="col-sm-12 row-buttons-section"> <?php $this->widget('application.components.mapwindow.MapWindowWidget', array('model' => $addreses, 'form' => $form, 'name' => 'from_1_name', 'addressLat' => 'from_1_address_lat', 'addressLong' => 'from_1_address_long', 'addressInd' => 'from_1_ind', 'id' => 'from_1')); ?> </section>
?> ' /> <?php // the massive actions dropup button $massiveAction = App()->getController()->renderPartial('/admin/responses/massive_actions/_selector', array(), true, false); // The first few colums are fixed. // Specific columns at start $aColumns = array(array('id' => 'id', 'class' => 'CCheckBoxColumn', 'selectableRows' => '100'), array('header' => '', 'name' => 'actions', 'id' => 'action', 'value' => '$data->buttons', 'type' => 'raw', 'htmlOptions' => array('class' => 'text-left'), 'filter' => false), array('header' => 'id', 'name' => 'id')); /* array( 'header' => 'seed', 'name' => 'seed' )); */ $aColumns[] = array('header' => 'lastpage', 'name' => 'lastpage', 'type' => 'number', 'filter' => TbHtml::textField('SurveyDynamic[lastpage]', $model->lastpage)); $aColumns[] = array('header' => gT("completed"), 'name' => 'completed_filter', 'value' => '$data->completed', 'type' => 'raw', 'filter' => TbHtml::dropDownList('SurveyDynamic[completed_filter]', $model->completed_filter, array('' => gT('All'), 'Y' => gT('Yes'), 'N' => gT('No')))); //add token to top of list if survey is not private if ($bHaveToken) { $aColumns[] = array('header' => 'token', 'name' => 'token', 'type' => 'raw', 'value' => '$data->tokenForGrid'); $aColumns[] = array('header' => gT("First name"), 'name' => 'tokens.firstname', 'id' => 'firstname', 'type' => 'raw', 'value' => '$data->firstNameForGrid', 'filter' => TbHtml::textField('SurveyDynamic[firstname_filter]', $model->firstname_filter)); $aColumns[] = array('header' => gT("Last name"), 'name' => 'tokens.lastname', 'type' => 'raw', 'id' => 'lastname', 'value' => '$data->lastNameForGrid', 'filter' => TbHtml::textField('SurveyDynamic[lastname_filter]', $model->lastname_filter)); $aColumns[] = array('header' => gT("Email"), 'name' => 'tokens.email', 'id' => 'email', 'filter' => TbHtml::textField('SurveyDynamic[email_filter]', $model->email_filter)); } $aColumns[] = array('header' => 'startlanguage', 'name' => 'startlanguage'); // The column model must be built dynamically, since the columns will differ from survey to survey, depending on the questions. // All other columns are based on the questions. // An array to control unicity of $code (EM code) foreach ($model->metaData->columns as $column) { if (!in_array($column->name, $aDefaultColumns)) { $colName = viewHelper::getFieldCode($fieldmap[$column->name], array('LEMcompat' => true)); // This must be unique ......
// echo $form->dropDownListGroup($model, 'categoryId',CHtml::listData($categorys,'id','name')); // echo CHtml::dropDownList('categoryId') $categories = Category::model()->findAllByAttributes(array('type' => 'course', 'parentId' => 0)); $firstItems = CHtml::listData($categories, 'id', 'name'); echo $form->labelEx($model, 'categoryId'); if ($model->categoryId) { $category = Category::model()->findByPk($model->categoryId); echo "<div>" . Yii::t('app', '当前分类:'); if ($category && $category->parent) { echo $category->parent->name . " / "; } if ($category) { echo $category->name . "</div>"; } } echo TbHtml::dropDownList('parentId', "", $firstItems, array('empty' => Yii::t('app', '选择分类'), 'ajax' => array('type' => 'GET', 'url' => CController::createUrl('//category/children'), 'update' => '#cateId'))); echo "  "; //empty since it will be filled by the other dropdown echo $form->dropDownList($model, 'categoryId', array(), array('id' => 'cateId')); echo $form->error($model, 'categoryId'); ?> <div class="row buttons"> <?php $this->widget('booster.widgets.TbButton', array('label' => $model->isNewRecord ? Yii::t('app', '创建') : Yii::t('app', '保存'), 'buttonType' => 'submit', 'context' => 'primary')); ?> </div> <div class="clearfix"></div> <?php $this->endWidget(); ?>
?> <br> <?php echo TbHtml::textField('text', '', array('placeholder' => '.span3', 'span' => 3)); ?> <br> <?php echo TbHtml::dropDownList('dropDown', '', array('1'), array('span' => 1)); ?> <br> <?php echo TbHtml::dropDownList('dropDown', '', array('1'), array('span' => 2)); ?> <br> <?php echo TbHtml::dropDownList('dropDown', '', array('1'), array('span' => 3)); ?> </div> <pre class="prettyprint linenums"> <?php echo TbHtml::textField('text', '', array('placeholder' => '.span1', 'span' => 1)); ?> <?php echo TbHtml::textField('text', '', array('placeholder' => '.span2', 'span' => 2)); ? <?php echo TbHtml::textField('text', '', array('placeholder' => '.span3', 'span' => 3)); ?> <?php echo TbHtml::dropDownList('dropDown', '', array('1'), array('span' => 1)); ?> <?php echo TbHtml::dropDownList('dropDown', '', array('1'), array('span' => 2)); ?> <?php echo TbHtml::dropDownList('dropDown', '', array('1'), array('span' => 3)); ?></pre> <div class="bs-docs-example"> <?php echo TbHtml::controls(TbHtml::textField('text', '', array('placeholder' => '.span5', 'span' => 5))); ?> <?php
</tr> <?php foreach ($models as $model) { ?> <tr> <td class="td3"> <div> <?php echo TbHtml::CheckBox("ID_{$i}", '#', array('class' => 'class="with-font', 'label' => $model->description, 'id' => "chk_{$i}", "value" => $model->id, 'onchange' => "set({$i})")); ?> </div> </td> <td class="td4"> <div> <?php echo TbHtml::dropDownList("type_{$i}", '#', array('interval' => 'Interval', 'nominal' => 'Nominal'), array('id' => "dd_{$i}", 'empty' => '--- Choose ---')); ?> </div> </td> </tr> <script type="text/javascript"> <?php echo "var j = " . $i . ";\n"; ?> disableAll(j); </script> <?php $i = $i + 1; ?> <?php
public function testDropDownList() { $I = $this->codeGuy; $html = TbHtml::dropDownList('dropdown', null, 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'); }
<div class="form-group has-success clearfix"> <div class="wr col-sm-6"> <?php echo TbHtml::activeTextField($model, 'name', array('placeholder' => 'Наименование Книги', 'required' => 'true', 'autofocus' => 'true', 'class' => 'form-control', 'value' => isset($result) ? $result->name : '')); ?> </div> <div class="wr col-sm-6"> <?php echo TbHtml::activeTextField($model, 'count_books', array('placeholder' => 'Количество', 'required' => 'true', 'autofocus' => 'true', 'class' => 'form-control', 'pattern' => '[0-9]{1,2}', 'value' => isset($result) ? $result->count_books : '')); ?> </div> <div class="wr col-sm-6"> <?php echo TbHtml::dropDownList('author_list', 'id', $author_list, array('multiple' => true, 'required' => 'true')); ?> </div> </div> <div> <?php echo TbHtml::submitButton('Сохранить', array('color' => TbHtml::BUTTON_COLOR_PRIMARY)); ?> </div> <?php echo TbHtml::endForm(); ?> </div>
<div class="row"> <span class="span2"> <?php $this->widget('yiiwheels.widgets.select2.WhSelect2', array('asDropDownList' => true, 'name' => 'optvalsearch', 'model' => new Option(), 'attribute' => 'name', 'htmlOptions' => array('id' => 'optSelect'), 'data' => TbHtml::listData(Option::model()->findAll(), 'id', function ($data) { return $data->getName(); }), 'pluginOptions' => array('placeholder' => 'Enter Option', 'width' => '100%'))); ?> </span> <span class="span2"><?php echo TbHtml::button(Yii::t('label', 'Add Option'), array('class' => 'add-opt', 'color' => TbHtml::BUTTON_COLOR_PRIMARY)); ?> </span> </div> <div id="copyGrid" class="row hide"> <?php $this->widget('bootstrap.widgets.TbGridView', array('type' => array(TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED), 'dataProvider' => new CArrayDataProvider(array()), 'columns' => array('id', array('name' => 'option_value_id', 'header' => Yii::t('label', 'Option Value')), array('name' => 'quantity', 'header' => Yii::t('label', 'Quantity')), array('name' => 'subtract', 'header' => Yii::t('label', 'Subtract')), array('name' => 'price_prefix', 'header' => Yii::t('label', 'Price Operator')), array('name' => 'price', 'header' => Yii::t('label', 'Price')), array('name' => 'weight_prefix', 'header' => Yii::t('label', 'Weight Operator')), array('name' => 'weight', 'header' => Yii::t('label', 'Weight')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'htmlOptions' => array('style' => 'width: 20px'), 'buttons' => array('delete' => array('label' => Yii::t('label', 'Delete'), 'options' => array("class" => "doptval", 'title' => Yii::t('label', 'Delete')))), 'template' => ' {delete}')))); ?> <div class="row"><span class="span2 offset7"><?php echo TbHtml::button(Yii::t('label', 'Add Option Value'), array('class' => 'add-opval', 'color' => TbHtml::BUTTON_COLOR_PRIMARY)); ?> </span></div> </div> <div class="row optiontype hide"><?php echo TbHtml::dropDownList('option_type', '', TbHtml::listData(Option::model()->findAll(), 'id', 'type'), array('id' => 'option_type_list')); ?> </div> <?php $this->endWidget(); ?> <br/> <br/>
$usrval->UsuarioId = $model->UsuariosId; //$usrval->UsrValRef='evento.EventoId'; //$usrval->UsrValRef2='funciones.FuncionesId'; $usrval->usrValIdRef2 = 'TODAS'; $this->widget('bootstrap.widgets.TbGridView', array('id' => 'usrval-grid', 'dataProvider' => $usrval->search(), 'template' => "{items}\n{pager}", 'type' => 'striped hover', 'columns' => array(array('header' => 'Evento', 'value' => 'coalesce(@$data->evento->EventoNom,$data->usrValIdRef)'), array('header' => 'Funcion', 'value' => 'coalesce(@$data->funcion->funcionesTexto,$data->usrValIdRef2)'), array('class' => 'CButtonColumn', 'header' => '', 'template' => ' {eliminar} {permisos} ', 'buttons' => array('eliminar' => array('label' => '<span class="text-error fa fa-times-circle"> Quitar</span>', 'url' => 'Yii::app()->createUrl("usuarios/desasignarEvento",array( "id"=>$data->UsuarioId, "evento"=>$data->usrValIdRef, "nick"=>"' . $model->UsuariosNick . '", "funcion"=>$data->usrValIdRef2))', 'click' => 'function(event){ $.get( $(this).attr("href")).done( function(){ $.fn.yiiGridView.update("usrval-grid"); }); event.preventDefault(); }'), 'permisos' => array('label' => TbHtml::button('Reportes', array('class' => 'btn btn-info', 'data-toggle' => 'modal', 'data-target' => '#modal-permisos-reportes')))))))); ?> </div><!-- asignacion de eventos--> <?php $asignadosHtml = TbHtml::openTag('div', array('class' => 'text-center')); $asignadosHtml .= TbHtml::dropDownList('eventos_asignados', 0, CHtml::listData($model->getEventosAsignados(), 'EventoId', 'EventoNom'), array('class' => 'span3 ', 'empty' => 'SELECCIONE UN EVENTO')); $asignadosHtml .= "<br/><br/>"; $asignadosHtml .= TbHtml::tag('table', array('id' => 'tabla-reportes'), ''); $asignadosHtml .= TbHtml::closeTag('div'); $this->widget('bootstrap.widgets.TbModal', array('id' => 'modal-permisos-reportes', 'header' => 'Reportes permitidos', 'htmlOptions' => array('class' => 'text-center'), 'content' => $asignadosHtml, 'footer' => TbHtml::button('Cerrar', array('data-dismiss' => 'modal')))); ?> <br /> <?php $this->widget('bootstrap.widgets.TbModal', array('id' => 'conModal', 'header' => 'Cambio de contraseña', 'content' => $this->renderPartial('_cambioContrasena', array('model' => $model), true, true), 'footer' => implode(' ', array(CHtml::ajaxSubmitButton('Confirmar', Yii::app()->createUrl('usuarios/cambiarClave', array('id' => $model->UsuariosId, 'nick' => $model->UsuariosNick)), array('type' => 'POST', 'data' => 'js:{up: $("#up").val() }', 'success' => 'js:function(string){ $("#formulario").html(string); $("#btn-cambiar-clave").attr("data-dismiss","modal"); $("#btn-cambiar-clave").val("Continuar..."); }'), array('class' => 'btn btn-primary ', 'disabled' => true, 'data-dismiss' => false, 'id' => 'btn-cambiar-clave')), TbHtml::button('Cerrar', array('data-dismiss' => 'modal')))))); ?>
<?php /* @var $this EssaysController */ /* @var $model Essays */ /* @var $form TbActiveForm */ ?> <div class="form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'status-form', 'enableAjaxValidation' => false)); ?> <legend>Status de Essay</legend> <?php echo TbHtml::dropDownList('Status', '', CHtml::listData(Status::model()->findAll(array('order' => 'name ASC')), 'idstatus', 'name')); ?> <?php echo CHtml::hiddenField('idEssay', $essay->id_essay_cruge); ?> <div class="form-actions"> <?php echo TbHtml::submitButton('Actualizar', array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'size' => TbHtml::BUTTON_SIZE_DEFAULT)); ?> </div> <?php $this->endWidget();
<?php //titulo label echo "<div class='bordeada' style='margin-top:0px;' >"; echo "<div style='margin:5px;' >"; echo TbHtml::labelTb('Prácticas', array('color' => TbHtml::LABEL_COLOR_WARNING, 'style' => 'margin-bottom:0px;font-size:16px;padding:9px;')); if ($accion=='carga'){ $data = CHtml::listData(Practica::model()->findAll(array('order' => 'nombre')), 'codigocarga', 'nombrecomp'); // listado oculto de los codigos de carga $codigoscarga = CHtml::listData(Practica::model()->findAll(array('order' => 'codigocarga')), 'idpractica', 'codigocarga'); echo TbHtml::dropDownList('codigoscarga', 'codigoscarga', $codigoscarga, array('style' => 'display:none;')); // campo de carga de codigos de practica (codigocarga) echo TbHtml::labelTb('Código', array('style' => 'margin-left:115px;padding:7px;')); echo TbHtml::textField('codpractica', '', array('span' => 1)); // listado de practicas con select 2 echo TbHtml::labelTb('Nombre', array('style' => 'margin-left:106px;padding:7px;')); $this->widget('yiiwheels.widgets.select2.WhSelect2', array( 'asDropDownList' => true, 'data' => $data, 'name' => 'cargapractica', 'htmlOptions' =>