Exemplo n.º 1
0
 /**
  * @param $params
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Setting::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'active' => $this->active, 'section' => $this->section]);
     $query->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'value', $this->value]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 * @var yii\data\ActiveDataProvider $dataProvider
 */
$this->title = Module::t('admin', 'admin');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="setting-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
//echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Module::t('admin', 'Create {modelClass}', ['modelClass' => Module::t('admin', 'Setting')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
Pjax::begin();
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['attribute' => 'section', 'filter' => ArrayHelper::map(Setting::find()->select('section')->distinct()->where('section <> ""')->all(), 'section', 'section')], 'key', 'user', '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();
?>
</div>