コード例 #1
2
 /**
  * @inheritdoc
  */
 public function run()
 {
     $inputId = $this->options['id'];
     $hasModel = $this->hasModel();
     if (array_key_exists('value', $this->options)) {
         $value = $this->options['value'];
     } elseif ($hasModel) {
         $value = Html::getAttributeValue($this->model, $this->attribute);
     } else {
         $value = $this->value;
     }
     $options = array_merge($this->options, ['multiple' => true, 'value' => $value]);
     if ($hasModel) {
         $output = Html::activeListBox($this->model, $this->attribute, $this->items, $options);
     } else {
         $output = Html::listBox($this->name, $this->value, $this->items, $options);
     }
     $clientOptions = array_merge(['filter' => $this->filter, 'multiple' => $this->multiple, 'multipleWidth' => $this->multipleWidth], $this->clientOptions);
     if (!array_key_exists('placeholder', $clientOptions) && array_key_exists('placeholder', $options)) {
         $clientOptions['placeholder'] = $options['placeholder'];
     }
     $js = 'jQuery(\'#' . $inputId . '\').multipleSelect(' . Json::htmlEncode($clientOptions) . ');';
     if (Yii::$app->getRequest()->getIsAjax()) {
         $output .= Html::script($js);
     } else {
         $view = $this->getView();
         MultipleSelectAsset::register($view);
         $view->registerJs($js);
     }
     return $output;
 }
コード例 #2
0
 /**
  * @inheritdoc
  * @throw NotSupportedException
  */
 public function run()
 {
     if ($this->hasModel()) {
         if (!is_null($this->value)) {
             if (!in_array($this->attribute, $this->model->attributes())) {
                 throw new NotSupportedException('Unable to set value of the property \'' . $this->attribute . '\'.');
             }
             $stash = $this->model->{$this->attribute};
             $this->model->{$this->attribute} = $this->value;
         }
         $output = Html::activeListBox($this->model, $this->attribute, $this->items, $this->options);
         if (isset($stash)) {
             $this->model->{$this->attribute} = $stash;
         }
     } else {
         $output = Html::listBox($this->name, $this->value, $this->items, $this->options);
     }
     $js = 'jQuery(\'#' . $this->options['id'] . '\').select2(' . Json::htmlEncode($this->clientOptions) . ');';
     if (Yii::$app->getRequest()->getIsAjax()) {
         $output .= Html::script($js);
     } else {
         $view = $this->getView();
         Select2Asset::register($view);
         Select2LanguageAsset::register($view);
         $view->registerJs($js);
     }
     return $output;
 }
コード例 #3
0
ファイル: DropDownControl.php プロジェクト: phpdn/qc-base
 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->form !== null && $this->model !== null) {
         return $this->form->field($this->model, $this->attribute)->hint($this->hint)->dropDownList($this->items, $this->options);
     }
     if ($this->model !== null) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     }
     if (empty($this->options['multiple'])) {
         return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     } else {
         return Html::listBox($this->name, $this->value, $this->items, $this->options);
     }
 }
コード例 #4
0
ファイル: Chosen.php プロジェクト: Semyonchick/yii2-chosen
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeListBox($this->model, $this->attribute, $this->items, $this->options);
     } else {
         echo Html::listBox($this->name, $this->value, $this->items, $this->options);
     }
 }
コード例 #5
0
ファイル: items.php プロジェクト: xiewulong/yii2-cms
<div class="clearfix admin-area admin-tabs"></div>
<!-- end admin-tabs -->

<!-- begin admin-options -->
<div class="clearfix admin-area-sm admin-options">
	<?php 
echo Html::beginForm(null, 'get', ['class' => 'form-inline pull-left']);
?>
		<div class="form-group">
			<?php 
echo Html::listBox('type', $type, $typeItems, ['class' => 'form-control', 'size' => 1]);
?>
		</div>
		<div class="form-group">
			<?php 
echo Html::listBox('stype', $stype, ['title' => \Yii::t($module->messageCategory, '{attribute} {action}', ['attribute' => \Yii::t($module->messageCategory, 'menu item'), 'action' => \Yii::t($module->messageCategory, 'title')])], ['class' => 'form-control', 'size' => 1]);
?>
		</div>
		<div class="form-group">
			<?php 
echo Html::textInput('sword', $sword, ['class' => 'form-control', 'placeholder' => \Yii::t($module->messageCategory, 'please {action} {attribute}', ['action' => \Yii::t($module->messageCategory, 'enter'), 'attribute' => \Yii::t($module->messageCategory, 'search word')]), 'autofocus' => true]);
?>
		</div>
		<div class="form-group">
			<?php 
echo Html::hiddenInput('mid', $superior['id']);
?>
			<?php 
echo Html::submitButton(\Yii::t($module->messageCategory, 'search'), ['class' => 'btn btn-primary']);
?>
		</div>
コード例 #6
0
ファイル: _ingvehiculos.php プロジェクト: ibergonzi/country
$this->registerJs('
$("#listboxVehiculos").keypress( function (e) {
		if (e.keyCode==13) {
			$("#btnAddVehiculo").click();
		}
	}
	);', yii\web\View::POS_READY);
?>
	

<div class="ingvehiculos-form">


	<?php 
//Yii::trace($vehiculos);
echo Html::listBox('listboxVehiculos', $seleccion, ArrayHelper::map($vehiculos, 'id_vehiculo', 'desc_vehiculo'), ['id' => 'listboxVehiculos', 'class' => 'form-control']);
$Url = Yii::$app->urlManager->createUrl(['accesos/add-lista', 'grupo' => 'ingvehiculos', 'id' => '']);
echo '<br/>';
echo '<div class="form-group">';
echo Html::a('Aceptar', $Url, ['title' => Yii::t('app', 'Aceptar'), 'id' => 'btnAddVehiculo', 'class' => 'btn btn-primary', 'onclick' => '
							var idVehic=$("#listboxVehiculos").val();
							if (idVehic === null) {
								return false;
							} else {
								$.ajax({
									type     :"POST",
									cache    : false,
									url      : $(this).attr("href")+idVehic,
									success  : function(r) {
												$("#modalvehiculos_persona").modal("hide");
												$("#divlistavehiculos").html(r["ingvehiculos"]);
コード例 #7
0
ファイル: EditedSelect.php プロジェクト: Liv1020/cms
    /**
     * @inheritdoc
     */
    public function run()
    {
        echo "<div class='row'>";
        echo "<div class='col-md-6'>";
        if ($this->hasModel()) {
            echo Html::activeListBox($this->model, $this->attribute, $this->items, $this->options);
        } else {
            echo Html::listBox($this->name, $this->value, $this->items, $this->options);
        }
        echo "</div>";
        echo "<div class='col-md-6'>";
        $createUrl = (string) \skeeks\cms\helpers\UrlHelper::construct($this->controllerRoute . '/' . $this->createAction)->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_NO_ACTIONS_MODEL, 'true')->enableAdmin()->toString();
        $updateUrl = (string) \skeeks\cms\helpers\UrlHelper::construct($this->controllerRoute . '/' . $this->updateAction)->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_NO_ACTIONS_MODEL, 'true')->enableAdmin()->toString();
        $create_w = \Yii::t('app', 'Create');
        $edit_w = \Yii::t('app', 'Edit');
        echo <<<HTML
            <a href="{$createUrl}" class="btn btn-default sx-btn-create sx-btn-controll" ><span class="glyphicon glyphicon-plus"></span> {$create_w}</a>
            <a href="{$updateUrl}" class="btn btn-default sx-btn-update sx-btn-controll" ><span class="glyphicon glyphicon-pencil"></span> {$edit_w}</a>
HTML;
        echo "</div>";
        echo "</div>";
        Pjax::end();
        $options = ['multiple' => (int) $this->multiple];
        $optionsString = Json::encode($options);
        $this->view->registerJs(<<<JS
        (function(sx, \$, _)
        {
            sx.classes.FormElementEditedSelect = sx.classes.Widget.extend({

                _init: function()
                {},

                getWrapper: function()
                {
                    return \$(this._wrapper);
                },

                _onDomReady: function()
                {
                    var self = this;

                    \$(this.getWrapper()).on('change', 'select', function()
                    {
                        self.updateButtons();
                    });

                    \$(this.getWrapper()).on('click', '.sx-btn-create', function()
                    {
                        var windowWidget = new sx.classes.Window(\$(this).attr('href'));

                        windowWidget.bind('close', function(e, data)
                        {
                            self.reload();
                        });

                        windowWidget.open();

                        return false;
                    });

                    \$(this.getWrapper()).on('click', '.sx-btn-update', function()
                    {
                        var windowWidget = new sx.classes.Window(\$(this).attr('href') + '&pk=' + \$('select', self.getWrapper()).val());

                        windowWidget.bind('close', function(e, data)
                        {
                            self.reload();
                        });

                        windowWidget.open();

                        return false;
                    });

                    self.updateButtons();
                },

                _onWindowReady: function()
                {},


                updateButtons: function()
                {
                    var self = this;

                    if (!self.get('multiple'))
                    {
                        if (\$('select', this.getWrapper()).val())
                        {
                            self.showUpdateControll();
                        } else
                        {
                            self.hideUpdateControll();
                        }
                    } else
                    {
                        self.hideUpdateControll();
                    }

                    return this;

                },

                /**
                *
                * @returns {sx.classes.FormElementEditedSelect}
                */
                hideUpdateControll: function()
                {
                    \$('.sx-btn-update', this.getWrapper()).hide();
                    return this;
                },

                /**
                *
                * @returns {sx.classes.FormElementEditedSelect}
                */
                showUpdateControll: function()
                {
                    \$('.sx-btn-update', this.getWrapper()).show();
                    return this;
                },

                reload: function()
                {
                    var self = this;

                    \$.pjax.reload("#" + this.getWrapper().attr('id'), {});

                    _.delay(function()
                    {
                        self.updateButtons();
                    }, 500);
                }
            });

            new sx.classes.FormElementEditedSelect('#{$this->_pjaxId}', {$optionsString});
        })(sx, sx.\$, sx._);
JS
);
    }
コード例 #8
0
ファイル: index.php プロジェクト: xingcuntian/component_test
echo Html::a('超链接', ['home/list', 'id' => 12], ['class' => 'link']);
echo Html::mailto('Contact Us', '*****@*****.**');
echo Html::img('@web/images/logo.png', ['alt' => 'logo']);
?>
<hr/>

<?php 
echo Html::beginForm(['home/add', 'id' => $id], 'post', ['enctype' => 'multipart/form-data']);
echo Html::input('text', 'username', 'name', ['class' => 'name']);
echo Html::radio('agree', true, ['label' => 'this is radio']);
echo Html::checkbox('agree', true, ['label' => 'this is checkbox']);
?>

<?php 
echo Html::dropDownList('list', 1, ArrayHelper::map($option, 'id', 'name'));
echo Html::listBox('listBox', 2, ArrayHelper::map($option, 'id', 'name'));
?>

<?php 
echo Html::checkboxList('role', [3, 4], ArrayHelper::map($option, 'id', 'name'));
?>
<br/><br/>
<?php 
echo Html::label('user name', 'username', ['class' => 'username']);
echo Html::endForm();
?>




コード例 #9
0
 /**
  * Search roles of user
  * @param  integer $id
  * @param  string  $target
  * @param  string  $term
  * @return string
  */
 public function actionBuscarPermisos()
 {
     try {
         $return = ['success' => false, 'message' => "No se pudo procesar la solicitud."];
         if (\Yii::$app->request->isAjax) {
             Yii::$app->response->format = 'json';
             $usuario = SeguridadUsuarios::findOne(Yii::$app->request->post("id"));
             $available = Grupo::getGrupos();
             $assigned = $usuario->getPermisos();
             //                $permisosGrupo = $grupo->getPermisos();
             //                $available = array_diff($available, $permisosGrupo);
             //                $assigned = array_intersect($available, $permisosGrupo);
             $available = \yii\helpers\Html::listBox("list-available", NULL, $available, ['id' => 'list-available', "multiple" => true, "size" => "20", "style" => "width:100%"]);
             $assigned = \yii\helpers\Html::listBox("list-assigned", NULL, $assigned, ['id' => 'list-assigned', "multiple" => true, "size" => "20", "style" => "width:100%"]);
             $return = ['success' => true, 'available' => $available, 'assigned' => $assigned];
         }
     } catch (Exception $ex) {
         $return = ['success' => false, 'message' => $ex->getMessage()];
     }
     return $return;
 }
コード例 #10
0
ファイル: list.php プロジェクト: xiewulong/yii2-cms
?>
</div>
<!-- end admin-title -->

<!-- begin admin-tabs -->
<div class="clearfix admin-area admin-tabs"></div>
<!-- end admin-tabs -->

<!-- begin admin-options -->
<div class="clearfix admin-area-sm admin-options">
	<?php 
echo Html::beginForm(null, 'get', ['class' => 'form-inline pull-left']);
?>
		<div class="form-group">
			<?php 
echo Html::listBox('stype', $stype, ['name' => \Yii::t($module->messageCategory, 'name'), 'position' => \Yii::t($module->messageCategory, 'position')], ['class' => 'form-control', 'size' => 1]);
?>
		</div>
		<div class="form-group">
			<?php 
echo Html::textInput('sword', $sword, ['class' => 'form-control', 'placeholder' => \Yii::t($module->messageCategory, 'please {action} {attribute}', ['action' => \Yii::t($module->messageCategory, 'enter'), 'attribute' => \Yii::t($module->messageCategory, 'search word')]), 'autofocus' => true]);
?>
		</div>
		<div class="form-group">
			<?php 
echo Html::submitButton(\Yii::t($module->messageCategory, 'search'), ['class' => 'btn btn-primary']);
?>
		</div>
	<?php 
echo Html::endForm();
?>
コード例 #11
0
ファイル: edit.php プロジェクト: styleyoung/taoshop
 if ($config['type'] == "text") {
     ?>
                         <?php 
     echo Html::input($config['type'], 'cfg_value[]', $config['value'], ['size' => 40]);
     ?>
                     <?php 
 } elseif ($config['type'] == 'textarea') {
     ?>
                         <?php 
     echo Html::textarea('cfg_value[]', $config['value'], ['cols' => 80, 'rows' => 5]);
     ?>
                     <?php 
 } elseif ($config['type'] == 'select') {
     ?>
                         <?php 
     echo Html::listBox("cfg_value[]", $config['value'], $config['range'], ['width' => 200]);
     ?>
                     <?php 
 }
 ?>
                     <?php 
 echo Html::hiddenInput('cfg_name[]', $config['name']);
 ?>
                     <?php 
 echo Html::hiddenInput('cfg_type[]', $config['type']);
 ?>
                     <?php 
 echo Html::hiddenInput('cfg_lang[]', isset($config['lang']) ? $config['lang'] : '');
 ?>
                 </td>
             </tr>
コード例 #12
0
ファイル: index.php プロジェクト: keyeMyria/YetCMS
    <div class="row">
        <div class="col-lg-5">
            <?php 
echo Html::textInput('search_av', '', ['class' => 'role-search form-control', 'data-target' => 'available', 'placeholder' => 'New:']) . ' ';
echo '<br>';
echo Html::listBox('routes', '', $new, ['id' => 'available', 'multiple' => true, 'size' => 20, 'style' => 'width:100%', 'class' => 'form-control']);
?>
        </div>
        <div class="col-lg-2">
            <div class="move-buttons">
                <?php 
echo Html::a('<i class="glyphicon glyphicon-chevron-left"></i>', '#', ['class' => 'btn btn-success', 'data-action' => 'delete']);
?>
                <?php 
echo Html::a('<i class="glyphicon glyphicon-chevron-right"></i>', '#', ['class' => 'btn btn-success', 'data-action' => 'assign']);
?>
            </div>
        </div>
        <div class="col-lg-5">
            <?php 
echo Html::textInput('search_asgn', '', ['class' => 'role-search form-control', 'data-target' => 'assigned', 'placeholder' => 'Exists:']) . '<br>';
?>
            <?php 
echo Html::listBox('routes', '', $exists, ['id' => 'assigned', 'multiple' => true, 'size' => 20, 'style' => 'width:100%', 'options' => $existsOptions, 'class' => 'form-control']);
?>
        </div>
    </div>
    </div>
<?php 
$this->registerJs("rbac.init({\n        name: " . json_encode(isset($name) ? $name : []) . ",\n        route: '" . Url::toRoute(['route-search']) . "',\n        routeAssign: '" . Url::toRoute(['assign', 'action' => 'assign']) . "',\n        routeDelete: '" . Url::toRoute(['assign', 'action' => 'delete']) . "',\n        routeSearch: '" . Url::toRoute(['route-search']) . "',\n    });", yii\web\View::POS_READY);
コード例 #13
0
ファイル: _form.php プロジェクト: Liv1020/cms
    ?>

            <div class="row">
                <div class="col-lg-6">

                    <label><?php 
    echo \Yii::t('app', 'Available fields');
    ?>
</label>
                    <p><?php 
    echo \Yii::t('app', 'Double-click for item, turn it on');
    ?>
</p>
                    <hr />
                    <?php 
    echo \yii\helpers\Html::listBox('possibleColumns', [], $columns, ['size' => "20", 'class' => "form-control", 'id' => "sx-possibleColumns"]);
    ?>

                </div>
                <div class="col-lg-6">
                    <label><?php 
    echo \Yii::t('app', 'Included fields');
    ?>
</label>
                    <p><?php 
    echo \Yii::t('app', 'Double-click for item, turn it off. You can also change the order of items by dragging them.');
    ?>
</p>
                    <hr />
                    <ul id="sx-visible-selected">
コード例 #14
0
            <div class="col-lg-5">
                <?php 
echo Yii::t('rbac-admin', 'Avaliable');
?>
:
                <?php 
echo Html::textInput('search_av', '', ['class' => 'role-search', 'data-target' => 'avaliable']) . '<br>';
echo Html::listBox('roles', '', $avaliable, ['id' => 'avaliable', 'multiple' => true, 'size' => 20, 'style' => 'width:100%']);
?>
            </div>
            <div class="col-lg-1">
                &nbsp;<br><br>
                <?php 
echo Html::a('>>', '#', ['class' => 'btn btn-success', 'data-action' => 'assign']) . '<br>';
echo Html::a('<<', '#', ['class' => 'btn btn-success', 'data-action' => 'delete']) . '<br>';
?>
            </div>
            <div class="col-lg-5">
                <?php 
echo Yii::t('rbac-admin', 'Assigned');
?>
:
                <?php 
echo Html::textInput('search_asgn', '', ['class' => 'role-search', 'data-target' => 'assigned']) . '<br>';
echo Html::listBox('roles', '', $assigned, ['id' => 'assigned', 'multiple' => true, 'size' => 20, 'style' => 'width:100%']);
?>
            </div>
        </div>
    </div>
<?php 
$this->render('_script', ['name' => $model->name]);
コード例 #15
0
ファイル: index.php プロジェクト: hscstudio/psaham
            <?php 
ActiveForm::end();
?>
            Ket: <br>
            - Sebelum/sesudah melakukan simulasi, klik kode emiten pada tabel diatas
          </div>
        </div>
      </div>
      <div class="col-md-3">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">Tanggal</h3>
          </div>
          <div class="panel-body">
            <?php 
echo Html::listBox('detemitenDates', $reportDates[1], $detemitenDates, ['class' => 'form-control', 'id' => 'detemitenDates', 'style' => 'height:275px']);
?>
          </div>
        </div>
      </div>
    </div>

    <?php 
if (Yii::$app->request->isAjax) {
    AlertBlock::widget(Yii::$app->params['alertBlockConfig']);
    GrowlLoad::reload($this);
}
?>
</div>
<?php 
$this->registerJs("\n  \$('#detemitenDates').bind('change', function(){\n      changeDate(\$(this).val());\n  });\n\n  function changeDate(date){\n    if(confirm('Apakah Anda yakin mengubah Tanggal ini?')){\n      \$.pjax.reload({\n        url: '" . Url::to(['index']) . "?date='+date,\n        container: '#pjax-report',\n        timeout:0,\n      });\n    }\n    else{\n      \$.pjax.reload({\n        url: '" . Url::to(['index']) . "?date=" . $reportDates[1] . "',\n        container: '#pjax-report',\n      });\n    }\n  }\n\n  simulate(1)\n\n  \$('#dynamicmodel-tipe').on('switchChange.bootstrapSwitch', function(event, state) {\n    tipe = state;\n    simulate(1)\n  });\n\n  \$('#dynamicmodel-harga').bind('change', function(){\n      simulate(0)\n  });\n\n  \$('#dynamicmodel-jml_lot').bind('change', function(){\n      simulate(1)\n  });\n\n  \$('#dynamicmodel-jml_saham').bind('change', function(){\n      simulate(2)\n  });\n\n\n");
コード例 #16
0
ファイル: Ui.php プロジェクト: 2amigos/yii2-semantic-ui
 /**
  * @inheritdoc
  */
 public static function listBox($name, $selection = null, $items = [], $options = [])
 {
     static::addCssClasses($options, ['ui', 'dropdown']);
     return parent::listBox($name, $selection, $items, $options);
 }
コード例 #17
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->hasModel()) {
         echo Html::hiddenInput(Html::getInputName($this->model, $this->attribute));
         //TODO:bad hardcode
         echo Html::activeListBox($this->model, $this->attribute, $this->items, $this->options);
     } else {
         echo Html::hiddenInput($this->name);
         //TODO:bad hardcode
         echo Html::listBox($this->name, $this->value, $this->items, $this->options);
     }
 }
コード例 #18
0
ファイル: index.php プロジェクト: aoopvn/EduSec4.0.0
echo "<div class='input-group form-group col-lg-10 col-xs-8 pull-right no-padding'>" . Html::textInput('search_av', '', ['class' => 'role-search form-control', 'data-target' => 'new']);
echo Html::a('<span class="glyphicon glyphicon-refresh"></span>', '', ['id' => 'btn-refresh', 'title' => 'Refresh', 'class' => 'input-group-addon']) . "</div>";
echo '<br>';
echo Html::listBox('routes', '', $new, ['id' => 'new', 'multiple' => true, 'size' => 15, 'style' => 'width:100%;padding:5px']);
?>
    </div>
    <div class="col-lg-2 col-sm-12 col-xs-12 text-center">
        <br><br>
        <?php 
echo Html::a('>>', '#', ['class' => 'btn btn-success', 'data-action' => 'assign', 'title' => 'Assign']) . '<br><br>';
echo Html::a('<<', '#', ['class' => 'btn btn-danger', 'data-action' => 'delete', 'title' => 'Delete']) . '<br>';
?>
	<br><br>
    </div>
    <div class="col-lg-5 col-sm-12 col-xs-12">
        <?php 
echo Yii::t('rbac-admin', '<b>Assigned</b>');
?>
:
        <?php 
echo "<div class='form-group col-lg-10 col-xs-8 pull-right no-padding'>" . Html::textInput('search_asgn', '', ['class' => 'role-search form-control', 'data-target' => 'exists']) . '</div>';
echo Html::listBox('routes', '', $exists, ['id' => 'exists', 'multiple' => true, 'size' => 15, 'style' => 'width:100%;padding:5px', 'options' => $existsOptions]);
?>
    </div>
   </div>

  </div>
 </div>
</div>
<?php 
$this->render('_script');
コード例 #19
0
ファイル: HtmlTest.php プロジェクト: rajanishtimes/basicyii
    public function testListBox()
    {
        $expected = <<<EOD
<select name="test" size="4">

</select>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::listBox('test'));
        $expected = <<<EOD
<select name="test" size="5">
<option value="value1">text1</option>
<option value="value2">text2</option>
</select>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems(), ['size' => 5]));
        $expected = <<<EOD
<select name="test" size="4">
<option value="value1&lt;&gt;">text1&lt;&gt;</option>
<option value="value  2">text&nbsp;&nbsp;2</option>
</select>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::listBox('test', null, $this->getDataItems2()));
        $expected = <<<EOD
<select name="test" size="4">
<option value="value1">text1</option>
<option value="value2" selected>text2</option>
</select>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::listBox('test', 'value2', $this->getDataItems()));
        $expected = <<<EOD
<select name="test" size="4">
<option value="value1" selected>text1</option>
<option value="value2" selected>text2</option>
</select>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::listBox('test', ['value1', 'value2'], $this->getDataItems()));
        $expected = <<<EOD
<select name="test[]" multiple size="4">

</select>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::listBox('test', null, [], ['multiple' => true]));
        $expected = <<<EOD
<input type="hidden" name="test" value="0"><select name="test" size="4">

</select>
EOD;
        $this->assertEqualsWithoutLE($expected, Html::listBox('test', '', [], ['unselect' => '0']));
    }
コード例 #20
0
ファイル: KendoField.php プロジェクト: PitcherAG/yii2-kendoui
 /**
  * @inheritdoc
  */
 public function listBox($items, $options = [])
 {
     $options = $this->mergeInputOptions($options, ['placeholder' => null]);
     $this->parts['{input}'] = Html::listBox($this->attribute, null, $items, $options);
     return $this;
 }
コード例 #21
0
ファイル: index.php プロジェクト: aitanz/BienesPublicos_
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Grupo'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id_grupo', 'nombre', 'descripcion', ['header' => 'Permisos', 'value' => function ($data) {
    $data instanceof Grupo;
    $permisos = [];
    if ($data->seguridadAccionGrupos != null && count($data->seguridadAccionGrupos) > 0) {
        foreach ($data->seguridadAccionGrupos as $accionGrupo) {
            $accionGrupo instanceof AccionGrupo;
            $aux = "Modulo: " . strtoupper($accionGrupo->idAccion->idControlador->idModulo->descripcion) . " - Controlador: " . str_ireplace("controller", "", $accionGrupo->idAccion->idControlador->descripcion);
            $permisos[$aux][] = Yii::t('app', $accionGrupo->idAccion->descripcion);
            //$return = $return . "<li>" . Html::a($accionGrupo->descripcion, ['/admin/acciones/view', 'id' => $accionGrupo->id_controlador]) . "</li>";
        }
    }
    return Html::listBox("Permisos", NULL, $permisos, []);
}, 'format' => 'raw'], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Acciones']]]);
?>

</div>
コード例 #22
0
ファイル: group.php プロジェクト: vastander/yii2-eer
        <p style="text-align: center">
            <?php 
echo Html::a('<span class="glyphicon glyphicon-chevron-left"></span>', '#', ['id' => 'leftButton']);
?>
        </p>
    </div>

    <div class="col-md-5"  id="divChosen">
        <p>
            <?php 
echo Html::label('Список выбранных студентов', 'listChosen');
?>
        </p>
        <p>
            <?php 
echo Html::listBox('listChosen', null, [], ['id' => 'listChosen', 'size' => 10, 'multiple' => true, 'style' => 'width:100%']);
?>
        </p>
    </div>
</div>
<p>
<?php 
echo Html::submitButton('Задать группу', ['class' => 'btn btn-primary']);
?>
</p>

<?php 
echo Html::endForm();
?>

<?php 
コード例 #23
0
ファイル: update.php プロジェクト: kvazarum/prereg
?>
    
    <table>
    <tr>
        <td style="padding: 5px;">    
    <?php 
echo Html::tag('p', 'Назначенные роли');
$assignment = [];
foreach ($roles as $item) {
    $assignment[] = $item->item_name;
}
echo Html::listBox('roles', null, $assignment);
?>
            </td>
            <td style="padding: 5px;">
    <?php 
echo Html::tag('p', 'Доступные роли');
$auth = AuthAssignment::find()->all();
$assignment = [];
foreach ($auth as $item) {
    $assignment[] = $item->item_name;
}
echo Html::listBox('roles', null, $assignment);
?>
  
            </td>            
        </tr>
    </table>       

</div>
コード例 #24
0
ファイル: BaseColumn.php プロジェクト: wqcsimple/wwhis-weixin
 /**
  * @param $name
  * @param $value
  * @param $options
  * @return string
  */
 protected function renderListBox($name, $value, $options)
 {
     Html::addCssClass($options, 'form-control');
     return Html::listBox($name, $value, $this->prepareItems($this->items), $options);
 }
コード例 #25
0
ファイル: bulk.php プロジェクト: kleitz/golfleague
?>
<div class="registration-index">
    <h1>Competition: <?php 
echo $model->name;
?>
</h1>

    <div class="col-lg-5">
        Golfers:
        <?php 
echo Html::textInput('search_avail', '', ['class' => 'golfer-search', 'data-target' => 'availables']) . '<br>';
echo Html::listBox('golfers', '', $availables, ['id' => 'availables', 'multiple' => true, 'size' => 20, 'style' => 'width:100%']);
?>
    </div>
    <div class="col-lg-1">
        &nbsp;<br><br>
        <?php 
echo Html::a('>>', '#', ['class' => 'btn btn-success', 'data-action' => 'register']) . '<br>';
echo Html::a('<<', '#', ['class' => 'btn btn-success', 'data-action' => 'deregister']) . '<br>';
?>
    </div>
    <div class="col-lg-5">
        Registered:
        <?php 
echo Html::textInput('search_regs', '', ['class' => 'golfer-search', 'data-target' => 'registereds']) . '<br>';
echo Html::listBox('golfers', '', $registereds, ['id' => 'registereds', 'multiple' => true, 'size' => 20, 'style' => 'width:100%']);
?>
    </div>
</div>
<?php 
$this->render('_bulkscript', ['id' => $model->id]);
コード例 #26
-1
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     Html::addCssClass($this->options, 'form-control');
     $this->options['multiple'] = true;
     if ($this->hasModel()) {
         return Html::activeListBox($this->model, $this->attribute, $this->items, $this->options);
     } else {
         return Html::listBox($this->name, $this->selection, $this->items, $this->options);
     }
 }