public function searchAll($params)
 {
     if (Yii::$app->user->can('admin')) {
         $query = Monitoring2::find()->joinWith('user.profile.region');
     } else {
         $query = Monitoring2::find()->joinWith('user.profile.region')->where([Monitoring2::tableName() . '.user_id' => Yii::$app->user->id]);
     }
     $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 $query->all();
     }
     $query->andFilterWhere(['user_id' => $this->user_id, 'month_id' => $this->month_id, 'year_id' => $this->year_id, 'date' => $this->date, Region::tableName() . '.id' => $this->region, Monitoring2::tableName() . '.status' => $this->status]);
     return $query->all();
 }
 public function actionGetMonthByYear()
 {
     $id = Yii::$app->request->post('id');
     $monthsExist = Monitoring2::find()->select('month_id')->where(['year_id' => $id])->andWhere(['user_id' => Yii::$app->user->id])->column();
     $months = Month::find()->where(['NOT IN', 'id', $monthsExist])->all();
     $arrayMonth = ArrayHelper::map($months, 'id', 'month');
     $options = '<option value="">Оберіть місяць</option>';
     foreach ($arrayMonth as $key => $value) {
         $options .= '<option value=' . $key . '>' . $value . '</option>';
     }
     return $options;
 }