예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PatternType::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, 'is_editor' => $this->is_editor]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'alias', $this->alias]);
     return $dataProvider;
 }
예제 #2
0
파일: _form.php 프로젝트: BeforyDeath/tfa
<div class="domain-pattern-form">

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

    <?php 
echo $form->field($model, 'domain_id')->dropdownList(\backend\models\Domain::find()->select(['name', 'id'])->indexBy('id')->column(), ['prompt' => 'Domain:'])->label('Domain Name');
?>

    <?php 
echo $form->field($model, 'model_id')->dropdownList(\backend\models\PatternModel::find()->select(['name', 'id'])->indexBy('id')->column(), ['prompt' => 'Pattern Model:'])->label('Pattern Model Name');
?>

    <?php 
echo $form->field($model, 'type_id')->dropdownList(\backend\models\PatternType::find()->select(['name', 'id'])->indexBy('id')->column(), ['prompt' => 'Pattern Type:'])->label('Pattern Type Name');
?>

    <?php 
echo $form->field($model, 'value')->textarea(['rows' => 6]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>