示例#1
0
 public function actionIn()
 {
     if (User::hasRole('admin')) {
         $model = new Device();
         //$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
         //\Yii::trace('### ### ### Тест лога');
         //\Yii::trace(Yii::$app->request->post());
         if ($model->load(Yii::$app->request->post())) {
             //\Yii::trace('### ### ### If');
             //return $this->redirect(['/table/device/view', 'id' => $model->id]);
             $searchModel = new DataListSearch();
             $dataProvider = $searchModel->search(['DataListSearch' => ['id_device' => $model->id, 'typeDataRef' => 'b']]);
             //Получаем массив данных из таблицы
             $allq = DataList::find()->select(['data_list.id', 'number', 'time_point'])->joinWith('idDataRef')->where(['id_device' => $model->id, 'type_data_ref' => 'b'])->createCommand()->queryAll();
             return $this->render('in', ['model' => $model, 'r' => 1, 'dataProvider' => $dataProvider, 'qwery' => $allq]);
         } else {
             //\Yii::trace('### ### ### Else');
             return $this->render('in', ['model' => $model, 'r' => NULL]);
         }
     } else {
         throw new NotFoundHttpException('Страница не найдена.');
     }
 }
示例#2
0
 /**
  * Lists all DataList models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new DataListSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }