[ 'class' => AccessControl::className(), 'rules' => [ [ 'actions' => ['index', 'view'], 'allow' => true, 'roles' => ['@'], ], ], ], // 'verbs' => [ // 'class' => VerbFilter::className(), // 'actions' => [ // 'logout' => ['post'], // ], // ], ]; } /** * @inheritdoc */ public function actions() { return [ 'error' => [ 'class' => 'yii\web\ErrorAction', ], ]; } public function actionIndex() { //$query = (new Query())->select('*')->from('{{%importer_files}}')->where(['not', ['time_end' => null]])->orderBy(['upload_time' => SORT_DESC]); $query = Importers::find()->where(['active' => true])->orderBy(['price_date_update' => SORT_DESC]); $provider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pageSize' => 10, ], ]); return $this->render('index', [ 'dataProvider' => $provider, ]); } public function actionView ($id, $date_update) { $query = Details::find()->where(['IMPORT_ID' => $id, 'timestamp' => $date_update])->limit(20); $importer = Importers::findOne($id)->name; $date = Yii::$app->formatter->asDate( $date_update, 'yyyy-MM-dd' ); $provider = new ActiveDataProvider([ 'query' => $query, 'pagination' => false, 'sort' => false, ]); return $this->renderAjax('view', ['dataProvider' => $provider, 'importer' => $importer, 'date' => $date, ]); } }