/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserLinkDev::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, 'id_user' => $this->id_user, 'id_device' => $this->id_device, 'created_at' => $this->created_at]);
     return $dataProvider;
 }
 public function actionStatus($id_device)
 {
     //if (\Yii::$app->user->isGuest) {
     //    return $this->goHome();
     //}
     //----------------------------------------------------------------------------------------
     $searchModel = new StateMapSearch();
     $searchModel->id_dev = $id_device;
     // дописал ЯЯЯ
     $dataProviderAll = $searchModel->search(Yii::$app->request->queryParams);
     $dataProviderAll->pagination->pageSize = 50;
     // хак чтобы небыло страниц
     //----------------------------------------------------------------------------------------
     $searchModel->mkey = 'zone.';
     //$dataProviderZone = $searchModel->search(Yii::$app->request->queryParams);
     $dataProviderZone = $searchModel->search_zone123456(Yii::$app->request->queryParams);
     //----------------------------------------------------------------------------------------
     $searchModel->mkey = 'power.';
     $dataProviderPower = $searchModel->search(Yii::$app->request->queryParams);
     //----------------------------------------------------------------------------------------
     $searchModel->mkey = 'sys.';
     $dataProviderSys = $searchModel->search(Yii::$app->request->queryParams);
     //----------------------------------------------------------------------------------------
     $searchModel->mkey = 'arm.';
     $dataProviderArm = $searchModel->search(Yii::$app->request->queryParams);
     //----------------------------------------------------------------------------------------
     $searchModel->mkey = 'gsm.';
     $dataProviderGSM = $searchModel->search(Yii::$app->request->queryParams);
     //----------------------------------------------------------------------------------------
     // получить название устройства, которое мониторим
     $user_link_dev = UserLinkDev::find()->where(['id_user' => Yii::$app->user->identity->id])->andFilterWhere(['id_device' => $id_device])->one();
     $device_name = $user_link_dev->dev_name;
     //----------------------------------------------------------------------------------------
     //-проверим версию прошивки---------------------------------------------------------------
     $sys = StateMap::find()->where(['id_dev' => $id_device])->andFilterWhere(['mkey' => 'sys.version'])->one();
     $firmware_ver = $sys->value;
     //-- получить номер текущей актуальной версии прошивки
     $bxsys = BxSystem::find()->where(['mkey' => 'last.firmware'])->one();
     $last_firmware_ver = $bxsys->value;
     return $this->render('status', ['dataProviderAll' => $dataProviderAll, 'dataProviderZone' => $dataProviderZone, 'dataProviderPower' => $dataProviderPower, 'dataProviderSys' => $dataProviderSys, 'dataProviderGSM' => $dataProviderGSM, 'dataProviderArm' => $dataProviderArm, 'device_name' => $device_name, 'firmware_ver' => $firmware_ver, 'last_firmware_ver' => $last_firmware_ver]);
 }