当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::listBox方法代码示例

本文整理汇总了PHP中yii\helpers\Html::listBox方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::listBox方法的具体用法?PHP Html::listBox怎么用?PHP Html::listBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Html的用法示例。


在下文中一共展示了Html::listBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * @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;
 }
开发者ID:heartshare,项目名称:yii2-jquery-multiple-select,代码行数:34,代码来源:MultipleSelect.php

示例2: run

 /**
  * @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;
 }
开发者ID:ivan-chkv,项目名称:yii2-jquery-select2,代码行数:32,代码来源:Select2.php

示例3: renderHtml

 /**
  * @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);
     }
 }
开发者ID:phpdn,项目名称:qc-base,代码行数:17,代码来源:DropDownControl.php

示例4: run

 /**
  * @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);
     }
 }
开发者ID:Semyonchick,项目名称:yii2-chosen,代码行数:11,代码来源:Chosen.php

示例5:

<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>
开发者ID:xiewulong,项目名称:yii2-cms,代码行数:31,代码来源:items.php

示例6: function

$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"]);
开发者ID:ibergonzi,项目名称:country,代码行数:31,代码来源:_ingvehiculos.php

示例7: run

    /**
     * @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();
//.........这里部分代码省略.........
开发者ID:Liv1020,项目名称:cms,代码行数:101,代码来源:EditedSelect.php

示例8:

echo Html::a('超链接', ['home/list', 'id' => 12], ['class' => 'link']);
echo Html::mailto('Contact Us', 'xingcuntian@163.com');
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();
?>




开发者ID:xingcuntian,项目名称:component_test,代码行数:26,代码来源:index.php

示例9: actionBuscarPermisos

 /**
  * 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;
 }
开发者ID:aitanz,项目名称:BienesPublicos_,代码行数:28,代码来源:PermisosUsuarioController.php

示例10:

?>
</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();
?>
开发者ID:xiewulong,项目名称:yii2-cms,代码行数:31,代码来源:list.php

示例11: elseif

 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>
开发者ID:styleyoung,项目名称:taoshop,代码行数:31,代码来源:edit.php

示例12:

    <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);
开发者ID:keyeMyria,项目名称:YetCMS,代码行数:30,代码来源:index.php

示例13:

    ?>

            <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">
开发者ID:Liv1020,项目名称:cms,代码行数:30,代码来源:_form.php

示例14:

            <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]);
开发者ID:eugene-kei,项目名称:yii2-micro-school-crm,代码行数:31,代码来源:view.php

示例15: function

            <?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");
开发者ID:hscstudio,项目名称:psaham,代码行数:31,代码来源:index.php


注:本文中的yii\helpers\Html::listBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。