Blame view

frontend/controllers/SiteController.php 1.82 KB
3f2bc3d0   Administrator   first commit
1
  <?php
7ba4acc5   Administrator   after marge
2
  
3f2bc3d0   Administrator   first commit
3
4
  namespace frontend\controllers;
  
3f2bc3d0   Administrator   first commit
5
  use Yii;
3f2bc3d0   Administrator   first commit
6
  use yii\web\Controller;
7ba4acc5   Administrator   after marge
7
8
9
10
  use common\models\Page;
  use common\models\News;
  use common\models\Catalog;
  use common\models\Products;
3f2bc3d0   Administrator   first commit
11
  
3f2bc3d0   Administrator   first commit
12
13
  class SiteController extends Controller
  {
ccc7a9d3   Karnovsky A   Karnovsky 12052016
14
15
16
17
18
19
20
21
22
      /**
       * @inheritdoc
       */
      public function actions()
      {
          return [
              'thumb' => 'iutbay\yii2imagecache\ThumbAction',
          ];
      }
055ecc3b   Karnovsky A   Karnovsky 11052016
23
  
3f2bc3d0   Administrator   first commit
24
25
      public function actionIndex()
      {
055ecc3b   Karnovsky A   Karnovsky 11052016
26
  
7ba4acc5   Administrator   after marge
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  //            $catalogs = Catalog::find()->where(['parent_id'=>'0'])->all();
          $modelText = Page::find()->where(['translit'=>'home'])->one();
  //            $news = News::find()->orderBy('id DESC')->limit(4)->all();
  //            $products_new = Products::find()->where(['new'=>'1'])->orderBy('id DESC')->innerJoinWith(['cost'])->groupBy('id')->limit(4)->all();
  //            //print_r($products_new);
  //            $products_top = Products::find()->where(['top'=>'1'])->orderBy('id DESC')->innerJoinWith(['cost'])->groupBy('id')->limit(4)->all();
  //            //print_r($products_top);
  //            //$products_sale = Products::find()->where(['sale'=>'1'])->innerJoinWith(['cost'])->orderBy('id DESC')->limit(4)->all();
  //            $products_akciya = Products::find()->where(['akciya'=>'1'])->innerJoinWith(['cost'])->orderBy('id DESC')->limit(4)->all();
          return $this->render('index', [
              'text'=>$modelText,
  //                    'catalogs'=>$catalogs,
  //                    'news'=>$news,
  //                    'products_new'=>$products_new,
  //                    'products_top'=>$products_top,
  //                    'products_akciya'=>$products_akciya,
055ecc3b   Karnovsky A   Karnovsky 11052016
43
          ]);
3f2bc3d0   Administrator   first commit
44
      }
055ecc3b   Karnovsky A   Karnovsky 11052016
45
  
7ba4acc5   Administrator   after marge
46
      public function actionError(){
055ecc3b   Karnovsky A   Karnovsky 11052016
47
  
7ba4acc5   Administrator   after marge
48
49
50
          return $this->render('error', [
              'code'=>Yii::$app->errorHandler->exception->statusCode,
              'message'=>Yii::$app->errorHandler->exception->getMessage(),
055ecc3b   Karnovsky A   Karnovsky 11052016
51
52
53
          ]);
      }
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
54
55
  
  
7ba4acc5   Administrator   after marge
56
  }