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


PHP Html::DropDownList方法代码示例

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


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

示例1: generateRoleDropdown

 public function generateRoleDropdown($person_id, $project_id)
 {
     $role_array = array();
     $roles = $this->roles;
     // Get person project id
     $person_project = PersonProject::find()->where(['user_id' => $person_id, 'project_id' => $project_id])->one();
     // Get project roles
     if ($roles) {
         foreach ($roles as $id => $role) {
             $role_array[$role->id] = $role->title;
         }
     }
     // Generate dropdown list
     if (count($role_array)) {
         return Html::DropDownList('role', $person_project->role, $role_array, ['class' => 'form-control input-sm role-select', 'data-id' => $person_project->id, 'prompt' => '']);
     }
     return '';
 }
开发者ID:jcshep,项目名称:FrontRunner,代码行数:18,代码来源:Project.php

示例2:

 * Time: 21:41
 */
$this->params['breadcrumbs'][] = ['label' => 'Employee', 'url' => ['employee/index']];
$this->params['breadcrumbs'][] = "Create Vacancy";
?>

<h2> Choose your course</h2>

<?php 
$form = RoleBasedActiveForm::begin();
?>

<div class="form-group">
<?php 
if ($mycourses) {
    echo Html::DropDownList('course_id', 1, ArrayHelper::map($mycourses, 'id', 'name'));
    echo "<br /> <br />";
    echo Html::submitButton('Create a Vacancy for above course', ['class' => 'btn btn-primary']);
} else {
    echo "You have no courses available.";
    echo Html::hiddenInput("course_id", "none");
}
?>
</div>


<div class="form-group">
    <?php 
echo Html::submitButton('Create a Vacancy without a course', ['class' => 'btn btn-default']);
?>
</div>
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:31,代码来源:pickCourse.php

示例3:

 * Created by PhpStorm.
 * User: jw
 * Date: 04/02/16
 * Time: 21:41
 */
$this->title = "Write review";
$this->params['breadcrumbs'][] = ['label' => 'Student', 'url' => ['student/index']];
$this->params['breadcrumbs'][] = "Write review";
$wizard_config = ['id' => 'stepwizard', 'steps' => [1 => ['title' => 'Pick a course', 'icon' => 'glyphicon glyphicon-education', 'content' => '<h2>Pick a TA</h2>', 'buttons' => ['next' => ['html' => ""], 'previous' => ['html' => ""], 'save' => ['html' => ""]]], 2 => ['title' => 'Pick a TA', 'icon' => 'glyphicon glyphicon-user', 'content' => '<h2>Pick a TA</h2>', 'buttons' => ['next' => ['html' => ""], 'previous' => ['html' => ""], 'save' => ['html' => ""]]], 3 => ['title' => 'Write your review', 'icon' => 'glyphicon glyphicon-pencil', 'content' => '<h2>Write a review</h2>', 'buttons' => ['next' => ['html' => ""], 'previous' => ['html' => ""], 'save' => ['html' => ""]]]], 'start_step' => 2];
echo \drsdre\wizardwidget\WizardWidget::widget($wizard_config);
?>

<?php 
$form = RoleBasedActiveForm::begin();
?>

<div class="form-group">
<?php 
echo Html::DropDownList('receiver_id', 1, ArrayHelper::map($sas, 'id', 'name'));
?>

</div>

<div class="form-group">
    <?php 
echo Html::submitButton('Continue', ['class' => 'btn btn-primary']);
?>
</div>

<?php 
RoleBasedActiveForm::end();
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:31,代码来源:pickSA.php

示例4: function

}], ['class' => 'yii\\grid\\ActionColumn', 'headerOptions' => ['width' => '100'], 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) {
    return '<a target="_blank" class="btn btn-primary btn-xs" href="/person/' . $model->id . '">View User</a>';
}]]]]);
?>
            
            <div class="row">
                <?php 
if ($model->roles) {
    ?>
                <div class="col-sm-3">
                    <?php 
    $roles = $model->roles;
    foreach ($roles as $id => $role) {
        $role_array[$role->id] = $role->title;
    }
    echo Html::DropDownList('role', NULL, $role_array, ['class' => 'form-control', 'prompt' => 'Select Role (Optional)']);
    ?>
                </div> <!--col-->
                <?php 
}
?>
                <div class="col-sm-4">
                    <?php 
echo Html::submitButton('Add Selected to ' . $list_type . ' List', ['class' => 'btn btn-primary']);
?>
   
                </div> <!--col-->
            </div> <!--row-->
            
            <?php 
echo Html::endForm();
开发者ID:jcshep,项目名称:FrontRunner,代码行数:31,代码来源:searchresults.php


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