<div class="form-group form-group-md"> <?php //= $form->field($model, 'id') ?> <?php echo $form->field($model, 'name', ['options' => ['class' => 'col-md-2']]); ?> <?php echo $form->field($model, 'nickname', ['options' => ['class' => 'col-md-2']]); ?> <?php echo $form->field($model, 'rank', ['options' => ['class' => 'col-md-2']])->dropDownList(Rank::getList()); ?> <?php echo $form->field($model, 'position', ['options' => ['class' => 'col-md-2']])->dropDownList(Position::getList()); ?> <?php echo $form->field($model, 'unit', ['options' => ['class' => 'col-md-2']])->dropDownList($units); ?> <?php // echo $form->field($model, 'phone') ?> <?php
<div class="soldier-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'nickname')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'rank')->dropDownList(Rank::getList()); ?> <?php echo $form->field($model, 'unit')->dropDownList($units); ?> <?php echo $form->field($model, 'position')->dropDownList(Position::getList()); ?> <?php echo $form->field($model, 'phone')->textInput(['maxlength' => true]); ?> <?php
use yii\widgets\DetailView; use common\models\Rank; use common\models\Position; /* @var $this yii\web\View */ /* @var $model common\models\Soldier */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'Службовець', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="soldier-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Правити', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Видалити', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Ви впевнені що хочете видалити цього службовця?', 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['name', 'nickname', ['attribute' => 'rank', 'value' => Rank::getTextValue($model->rank)], ['attribute' => 'unit', 'value' => $model->getUnitLink(), 'format' => 'html'], ['attribute' => 'position', 'value' => Position::getTextValue($model->position)], 'phone', 'email:email']]); ?> </div>