/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = RecStatus::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'rec_status_id' => $this->rec_status_id, 'user_id' => $this->user_id, 'dc' => $this->dc]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'note', $this->note]); return $dataProvider; }
?> <?php echo $form->field($model, 'firm_id')->dropDownList(ArrayHelper::map(\app\models\Firm::find()->active()->orderBy('name asc')->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'workplace_id')->dropDownList(ArrayHelper::map(\app\models\Workplace::find()->active()->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'note')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'rec_status_id')->radioList(ArrayHelper::map(\app\models\RecStatus::find()->active()->all(), 'id', 'name'), ['class' => 'btn-group', 'data-toggle' => 'buttons', 'unselect' => null, 'item' => function ($index, $label, $name, $checked, $value) { return '<label class="btn btn-default' . ($checked ? ' active' : '') . '">' . Html::radio($name, $checked, ['value' => $value, 'class' => 'project-status-btn']) . $label . '</label>'; }]); ?> <?php echo $form->field($model, 'user_id')->dropDownList(ArrayHelper::map(\app\models\User::find()->active()->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'dc')->textInput(); ?> <div class="form-group"> <div class="col-lg-offset-2 col-lg-10"> <?php
/** * @return \yii\db\ActiveQuery */ public function getRecStatus() { return $this->hasOne(RecStatus::className(), ['id' => 'rec_status_id']); }
/* @var $model app\models\DocInn */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="doc-inn-form"> <?php $form = ActiveForm::begin(['options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-4\">{input}</div>\n<div class=\"col-lg-6\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-2 control-label']]]); ?> <?php echo $this->render('_fields', ['model' => $model, 'form' => $form]); ?> <?php echo $form->field($model, 'rec_status_id')->dropDownList(ArrayHelper::map(\app\models\RecStatus::find()->active()->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'user_id')->dropDownList(ArrayHelper::map(\app\models\User::find()->active()->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'dc')->textInput(); ?> <div class="form-group"> <div class="col-lg-offset-2 col-lg-10"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Save') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?>
<h1><?php //echo Html::encode($this->title) ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p class='pull-left'> <?php echo \yii\helpers\Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'Create new'), ['create'], ['class' => 'btn btn-success']); ?> </p> <div class="clearfix"></div> <?php \yii\widgets\Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'note:ntext', 'rec_status_id' => ['attribute' => 'rec_status_id', 'value' => 'recStatus.name', 'filter' => ArrayHelper::map(\app\models\RecStatus::find()->active()->all(), 'id', 'name')], 'user_id' => ['attribute' => 'user_id', 'value' => 'user.name', 'filter' => ArrayHelper::map(\app\models\User::find()->active()->all(), 'id', 'name')], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'white-space: nowrap;']]], 'tableOptions' => ['class' => 'table table-striped table-hover']]); ?> <?php \yii\widgets\Pjax::end(); ?> </div>
/** * Finds the RecStatus model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return RecStatus the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = RecStatus::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }