예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Settings::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, 'active' => $this->active, 'created' => $this->created, 'modified' => $this->modified]);
     $query->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'section', $this->section])->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'value', $this->value]);
     return $dataProvider;
 }
예제 #2
0
파일: index.php 프로젝트: kdes70/hotel.lok
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Create Settings', ['create'], ['class' => 'btn btn-success']);
?>
    </p>




    <?php 
Pjax::begin();
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['attribute' => 'section', 'filter' => ArrayHelper::map(Settings::find()->select('section')->distinct()->where(['<>', 'section', ''])->all(), 'section', 'section')], 'key', 'value:ntext', ['class' => '\\pheme\\grid\\ToggleColumn', 'attribute' => 'active', 'filter' => [1 => Yii::t('yii', 'Yes'), 0 => Yii::t('yii', 'No')]], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
    <?php 
Pjax::end();
?>


    <?php 
echo SettingsWidget::widget(['title' => 'Settings']);
?>


</div>