/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PatternGroup::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, 'priority' => $this->priority, 'project_id' => Yii::$app->request->get('project_id')]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
$this->title = 'Clone Group'; $this->params['breadcrumbs'][] = ['label' => 'Projects', 'url' => ['/project']]; $this->params['breadcrumbs'][] = ['label' => 'Groups', 'url' => ['/group', 'project_id' => Yii::$app->request->get('project_id')]]; $this->params['breadcrumbs'][] = 'Clone'; ?> <div class="pattern-group-create"> <h1><?php echo Html::encode($this->title); ?> </h1> <div class="pattern-group-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'id')->dropdownList(\common\models\PatternGroup::find()->select(['name', 'id'])->indexBy('id')->column()); ?> <div class="form-group"><?php echo Html::submitButton('Clone', ['class' => 'btn btn-success']); ?> </div> <?php ActiveForm::end(); ?> </div> </div>
use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model common\models\Pattern */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="pattern-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'group_id')->dropdownList(\common\models\PatternGroup::find()->select(['name', 'id'])->indexBy('id')->column(), ['prompt' => 'Group:'])->label('Group'); ?> <?php echo $form->field($model, 'module')->dropDownList(['country' => 'Country', 'city' => 'City', 'direction' => 'Direction', 'airport' => 'Airport', 'airline' => 'Airline'], ['prompt' => '']); ?> <?php echo $form->field($model, 'type_id')->dropdownList(\common\models\PatternType::find()->select(['alias', 'id'])->indexBy('id')->column(), ['prompt' => 'Type:'])->label('Type'); ?> <?php // if ($model && $model->type->is_editor) ?> <?php