/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::readFilter(Contact_group::find());
     //$query = Yii::$app->user->identity->readFilter(Contact_group::find());
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->nome]);
     return $dataProvider;
 }
Beispiel #2
0
 public static function getAllGruppi()
 {
     $queryGruppi = Contact_group::find()->andWhere(['or', ['visibility' => 'privato', 'permissions' => Yii::$app->user->id], ['visibility' => 'gruppo', 'permissions' => Yii::$app->session['group'][0]], ['visibility' => 'tenant', 'permissions' => Yii::$app->session['tenant']]])->asArray()->all();
     $arrayGruppi = ArrayHelper::map($queryGruppi, 'id', 'name');
     return $arrayGruppi;
 }