示例#1
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\modules\unicred\questionlist\models\Region;
/* @var $this yii\web\View */
/* @var $model app\modules\unicred\models\Office */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="office-form">

    <?php 
$form = ActiveForm::begin();
?>
    <?php 
$regions = yii\helpers\ArrayHelper::map(app\modules\unicred\questionlist\models\Region::find()->all(), 'id', 'name');
?>

    <?php 
echo $form->field($model, "region_id")->dropDownList($regions, [$model->region_id => ['selected' => 'selected']]);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

  
	<?php 
if (!Yii::$app->request->isAjax) {
    ?>
	  	<div class="form-group">
示例#2
0
<?php

use yii\helpers\Url;
return [['class' => 'kartik\\grid\\CheckboxColumn', 'width' => '20px'], ['class' => 'kartik\\grid\\SerialColumn', 'width' => '30px'], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'regionName', 'filter' => yii\helpers\ArrayHelper::map(app\modules\unicred\questionlist\models\Region::find()->all(), 'id', 'name')], ['class' => '\\kartik\\grid\\DataColumn', 'attribute' => 'name'], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'vAlign' => 'middle', 'urlCreator' => function ($action, $model, $key, $index) {
    return Url::to([$action, 'id' => $key]);
}, 'viewOptions' => ['role' => 'modal-remote', 'title' => 'View', 'data-toggle' => 'tooltip'], 'updateOptions' => ['role' => 'modal-remote', 'title' => 'Update', 'data-toggle' => 'tooltip'], 'deleteOptions' => ['role' => 'modal-remote', 'title' => 'Delete', 'data-confirm' => false, 'data-method' => false, 'data-request-method' => 'post', 'data-toggle' => 'tooltip', 'data-confirm-title' => 'Are you sure?', 'data-confirm-message' => 'Are you sure want to delete this item']]];