Commit 693c46cb4ace73f78affd7fcaaa35a52f8c3c975
1 parent
500b481a
add base classes od AR and Controller
Showing
5 changed files
with
36 additions
and
6 deletions
Show diff stats
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: Cibermag | ||
| 5 | + * Date: 31.08.2015 | ||
| 6 | + * Time: 9:58 | ||
| 7 | + */ | ||
| 8 | +namespace backend\components\base; | ||
| 9 | + | ||
| 10 | +use yii\web\Controller; | ||
| 11 | + | ||
| 12 | +class BaseController extends Controller { | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +} | ||
| 0 | \ No newline at end of file | 16 | \ No newline at end of file |
backend/controllers/ParserController.php
| @@ -3,7 +3,7 @@ namespace backend\controllers; | @@ -3,7 +3,7 @@ namespace backend\controllers; | ||
| 3 | 3 | ||
| 4 | use Yii; | 4 | use Yii; |
| 5 | use yii\filters\AccessControl; | 5 | use yii\filters\AccessControl; |
| 6 | -use yii\web\Controller; | 6 | +use backend\components\base\BaseController; |
| 7 | use yii\filters\VerbFilter; | 7 | use yii\filters\VerbFilter; |
| 8 | use backend\models\UploadFileParsingForm; | 8 | use backend\models\UploadFileParsingForm; |
| 9 | use yii\web\UploadedFile; | 9 | use yii\web\UploadedFile; |
| @@ -15,7 +15,7 @@ use common\components\debug\CustomVarDamp; | @@ -15,7 +15,7 @@ use common\components\debug\CustomVarDamp; | ||
| 15 | * Parser controller | 15 | * Parser controller |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | -class ParserController extends Controller | 18 | +class ParserController extends BaseController |
| 19 | { | 19 | { |
| 20 | public $layout = "/column"; | 20 | public $layout = "/column"; |
| 21 | /** | 21 | /** |
| @@ -75,10 +75,9 @@ class ParserController extends Controller | @@ -75,10 +75,9 @@ class ParserController extends Controller | ||
| 75 | $filePath = Yii::getAlias('@webroot') . '/uploads/' . $model->file->baseName . '.' . $model->file->extension; | 75 | $filePath = Yii::getAlias('@webroot') . '/uploads/' . $model->file->baseName . '.' . $model->file->extension; |
| 76 | 76 | ||
| 77 | $model->file->saveAs( $filePath ); | 77 | $model->file->saveAs( $filePath ); |
| 78 | - | ||
| 79 | $data = $model->readFile($filePath); | 78 | $data = $model->readFile($filePath); |
| 80 | 79 | ||
| 81 | - Yii::$app->getCache()->set( 'parser_data', json_encode($data),200 ); | 80 | + Yii::$app->getCache()->set( 'parser_data', json_encode($data), 200 ); |
| 82 | 81 | ||
| 83 | $provider = new ArrayDataProvider([ | 82 | $provider = new ArrayDataProvider([ |
| 84 | 'allModels' => $data, | 83 | 'allModels' => $data, |
backend/controllers/SiteController.php
| @@ -3,14 +3,14 @@ namespace backend\controllers; | @@ -3,14 +3,14 @@ namespace backend\controllers; | ||
| 3 | 3 | ||
| 4 | use Yii; | 4 | use Yii; |
| 5 | use yii\filters\AccessControl; | 5 | use yii\filters\AccessControl; |
| 6 | -use yii\web\Controller; | 6 | +use backend\components\base\BaseController; |
| 7 | use common\models\LoginForm; | 7 | use common\models\LoginForm; |
| 8 | use yii\filters\VerbFilter; | 8 | use yii\filters\VerbFilter; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | * Site controller | 11 | * Site controller |
| 12 | */ | 12 | */ |
| 13 | -class SiteController extends Controller | 13 | +class SiteController extends BaseController |
| 14 | { | 14 | { |
| 15 | 15 | ||
| 16 | public $layout = '/column'; | 16 | public $layout = '/column'; |
backend/views/parser/results.php
| @@ -21,4 +21,6 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -21,4 +21,6 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 21 | 'dataProvider' => $dataProvider, | 21 | 'dataProvider' => $dataProvider, |
| 22 | ]); ?> | 22 | ]); ?> |
| 23 | 23 | ||
| 24 | + <?= Html::a('Вернуться', ['parser/index'], ['class' => 'btn btn-primary', 'name' => 'Return',]) ?> | ||
| 25 | + | ||
| 24 | </div> | 26 | </div> |
| 25 | \ No newline at end of file | 27 | \ No newline at end of file |