Commit 8074cc4e7fb3031cfadec4b8ed49f9dedfa20bdd
Merge branch 'master' of gitlab.artweb.com.ua:root/new_rukzachok
# Conflicts: # backend/controllers/BrandController.php # backend/views/brand/_form.php # common/modules/product/models/Brand.php # common/modules/product/widgets/views/products_block.php
Showing
127 changed files
with
907 additions
and
139 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 127 files are displayed.
backend/config/main.php
| 1 | <?php | 1 | <?php |
| 2 | +use developeruz\db_rbac\behaviors\AccessBehavior; | ||
| 2 | $params = array_merge( | 3 | $params = array_merge( |
| 3 | require(__DIR__ . '/../../common/config/params.php'), | 4 | require(__DIR__ . '/../../common/config/params.php'), |
| 4 | require(__DIR__ . '/../../common/config/params-local.php'), | 5 | require(__DIR__ . '/../../common/config/params-local.php'), |
| @@ -12,7 +13,27 @@ return [ | @@ -12,7 +13,27 @@ return [ | ||
| 12 | 'layout' => 'admin', | 13 | 'layout' => 'admin', |
| 13 | 'controllerNamespace' => 'backend\controllers', | 14 | 'controllerNamespace' => 'backend\controllers', |
| 14 | 'bootstrap' => ['log'], | 15 | 'bootstrap' => ['log'], |
| 16 | +// 'as AccessBehavior' => [ | ||
| 17 | +// 'class' => AccessBehavior::className(), | ||
| 18 | +// 'rules' => | ||
| 19 | +// ['permit/access' => | ||
| 20 | +// [ | ||
| 21 | +// [ | ||
| 22 | +// 'actions' => ['role', 'permission','add-role', 'update-role','add-permission', 'update-permission' ], | ||
| 23 | +// 'allow' => true, | ||
| 24 | +// ] | ||
| 25 | +// ] | ||
| 26 | +// ], | ||
| 27 | +// | ||
| 28 | +// ], | ||
| 15 | 'modules' => [ | 29 | 'modules' => [ |
| 30 | + 'permit' => [ | ||
| 31 | + 'class' => 'developeruz\db_rbac\Yii2DbRbac', | ||
| 32 | + 'params' => [ | ||
| 33 | + 'userClass' => 'backend\models\User' | ||
| 34 | + ] | ||
| 35 | + ], | ||
| 36 | + | ||
| 16 | 'rubrication' => [ | 37 | 'rubrication' => [ |
| 17 | 'class' => 'common\modules\rubrication\Module', | 38 | 'class' => 'common\modules\rubrication\Module', |
| 18 | 'types' => [ | 39 | 'types' => [ |
| @@ -30,6 +51,7 @@ return [ | @@ -30,6 +51,7 @@ return [ | ||
| 30 | ] | 51 | ] |
| 31 | ], | 52 | ], |
| 32 | 'components' => [ | 53 | 'components' => [ |
| 54 | + | ||
| 33 | 'user' => [ | 55 | 'user' => [ |
| 34 | 'identityClass' => 'common\models\User', | 56 | 'identityClass' => 'common\models\User', |
| 35 | 'enableAutoLogin' => true, | 57 | 'enableAutoLogin' => true, |
backend/controllers/ArticlesController.php
| @@ -8,7 +8,7 @@ use common\models\ArticlesSearch; | @@ -8,7 +8,7 @@ use common\models\ArticlesSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * ArticlesController implements the CRUD actions for Articles model. | 13 | * ArticlesController implements the CRUD actions for Articles model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class ArticlesController extends Controller | @@ -20,6 +20,18 @@ class ArticlesController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/BannerController.php
| @@ -9,7 +9,7 @@ use common\models\BannerSearch; | @@ -9,7 +9,7 @@ use common\models\BannerSearch; | ||
| 9 | use yii\web\Controller; | 9 | use yii\web\Controller; |
| 10 | use yii\web\NotFoundHttpException; | 10 | use yii\web\NotFoundHttpException; |
| 11 | use yii\filters\VerbFilter; | 11 | use yii\filters\VerbFilter; |
| 12 | - | 12 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 13 | /** | 13 | /** |
| 14 | * BannerController implements the CRUD actions for Banner model. | 14 | * BannerController implements the CRUD actions for Banner model. |
| 15 | */ | 15 | */ |
| @@ -21,6 +21,18 @@ class BannerController extends Controller | @@ -21,6 +21,18 @@ class BannerController extends Controller | ||
| 21 | public function behaviors() | 21 | public function behaviors() |
| 22 | { | 22 | { |
| 23 | return [ | 23 | return [ |
| 24 | + 'access'=>[ | ||
| 25 | + 'class' => AccessBehavior::className(), | ||
| 26 | + 'rules' => | ||
| 27 | + ['site' => | ||
| 28 | + [ | ||
| 29 | + [ | ||
| 30 | + 'actions' => ['login', 'error'], | ||
| 31 | + 'allow' => true, | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ] | ||
| 35 | + ], | ||
| 24 | 'verbs' => [ | 36 | 'verbs' => [ |
| 25 | 'class' => VerbFilter::className(), | 37 | 'class' => VerbFilter::className(), |
| 26 | 'actions' => [ | 38 | 'actions' => [ |
| @@ -8,7 +8,7 @@ use common\models\BgSearch; | @@ -8,7 +8,7 @@ use common\models\BgSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * BgController implements the CRUD actions for Bg model. | 13 | * BgController implements the CRUD actions for Bg model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class BgController extends Controller | @@ -20,6 +20,18 @@ class BgController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/BlogController.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | namespace backend\controllers; | 3 | namespace backend\controllers; |
| 4 | - | 4 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 5 | use common\models\Fields; | 5 | use common\models\Fields; |
| 6 | use Yii; | 6 | use Yii; |
| 7 | use common\models\Blog; | 7 | use common\models\Blog; |
| @@ -22,19 +22,17 @@ class BlogController extends Controller | @@ -22,19 +22,17 @@ class BlogController extends Controller | ||
| 22 | public function behaviors() | 22 | public function behaviors() |
| 23 | { | 23 | { |
| 24 | return [ | 24 | return [ |
| 25 | - 'access' => [ | ||
| 26 | - 'class' => AccessControl::className(), | ||
| 27 | - 'rules' => [ | ||
| 28 | - [ | ||
| 29 | - 'actions' => ['login', 'error'], | ||
| 30 | - 'allow' => true, | ||
| 31 | - ], | ||
| 32 | - [ | ||
| 33 | - 'actions' => ['logout', 'index'], | ||
| 34 | - 'allow' => true, | ||
| 35 | - 'roles' => ['@'], | ||
| 36 | - ], | ||
| 37 | - ], | 25 | + 'access'=>[ |
| 26 | + 'class' => AccessBehavior::className(), | ||
| 27 | + 'rules' => | ||
| 28 | + ['site' => | ||
| 29 | + [ | ||
| 30 | + [ | ||
| 31 | + 'actions' => ['login', 'error'], | ||
| 32 | + 'allow' => true, | ||
| 33 | + ] | ||
| 34 | + ] | ||
| 35 | + ] | ||
| 38 | ], | 36 | ], |
| 39 | 'verbs' => [ | 37 | 'verbs' => [ |
| 40 | 'class' => VerbFilter::className(), | 38 | 'class' => VerbFilter::className(), |
backend/controllers/BrandController.php
| @@ -97,7 +97,6 @@ class BrandController extends Controller | @@ -97,7 +97,6 @@ class BrandController extends Controller | ||
| 97 | public function actionUpdate($id) | 97 | public function actionUpdate($id) |
| 98 | { | 98 | { |
| 99 | $model = $this->findModel($id); | 99 | $model = $this->findModel($id); |
| 100 | - $model->setScenario('update'); | ||
| 101 | 100 | ||
| 102 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 101 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
| 103 | return $this->redirect(['view', 'id' => $model->brand_id]); | 102 | return $this->redirect(['view', 'id' => $model->brand_id]); |
backend/controllers/CategoryController.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | namespace backend\controllers; | 3 | namespace backend\controllers; |
| 4 | - | 4 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 5 | use common\components\artboxtree\ArtboxTreeHelper; | 5 | use common\components\artboxtree\ArtboxTreeHelper; |
| 6 | use Yii; | 6 | use Yii; |
| 7 | use common\modules\product\models\Category; | 7 | use common\modules\product\models\Category; |
| @@ -22,19 +22,17 @@ class CategoryController extends Controller | @@ -22,19 +22,17 @@ class CategoryController extends Controller | ||
| 22 | public function behaviors() | 22 | public function behaviors() |
| 23 | { | 23 | { |
| 24 | return [ | 24 | return [ |
| 25 | - 'access' => [ | ||
| 26 | - 'class' => AccessControl::className(), | ||
| 27 | - 'rules' => [ | ||
| 28 | - [ | ||
| 29 | - 'actions' => ['login', 'error'], | ||
| 30 | - 'allow' => true, | ||
| 31 | - ], | ||
| 32 | - [ | ||
| 33 | - 'actions' => ['logout', 'index', 'create', 'update', 'view', 'delete'], | ||
| 34 | - 'allow' => true, | ||
| 35 | - 'roles' => ['@'], | ||
| 36 | - ], | ||
| 37 | - ], | 25 | + 'access'=>[ |
| 26 | + 'class' => AccessBehavior::className(), | ||
| 27 | + 'rules' => | ||
| 28 | + ['site' => | ||
| 29 | + [ | ||
| 30 | + [ | ||
| 31 | + 'actions' => ['login', 'error'], | ||
| 32 | + 'allow' => true, | ||
| 33 | + ] | ||
| 34 | + ] | ||
| 35 | + ] | ||
| 38 | ], | 36 | ], |
| 39 | 'verbs' => [ | 37 | 'verbs' => [ |
| 40 | 'class' => VerbFilter::className(), | 38 | 'class' => VerbFilter::className(), |
| @@ -8,7 +8,7 @@ use common\models\CustomerSearch; | @@ -8,7 +8,7 @@ use common\models\CustomerSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * CustomerController implements the CRUD actions for Customer model. | 13 | * CustomerController implements the CRUD actions for Customer model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class CustomerController extends Controller | @@ -20,6 +20,18 @@ class CustomerController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/EventController.php
| @@ -8,7 +8,7 @@ use common\models\EventSearch; | @@ -8,7 +8,7 @@ use common\models\EventSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * EventController implements the CRUD actions for Event model. | 13 | * EventController implements the CRUD actions for Event model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class EventController extends Controller | @@ -20,6 +20,18 @@ class EventController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
| @@ -12,7 +12,7 @@ use backend\models\Orders; | @@ -12,7 +12,7 @@ use backend\models\Orders; | ||
| 12 | use backend\models\OrdersProducts; | 12 | use backend\models\OrdersProducts; |
| 13 | use common\modules\product\models\ProductVariant; | 13 | use common\modules\product\models\ProductVariant; |
| 14 | use yii\web\NotFoundHttpException; | 14 | use yii\web\NotFoundHttpException; |
| 15 | - | 15 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 16 | 16 | ||
| 17 | class OrdersController extends Controller | 17 | class OrdersController extends Controller |
| 18 | { | 18 | { |
| @@ -22,6 +22,18 @@ class OrdersController extends Controller | @@ -22,6 +22,18 @@ class OrdersController extends Controller | ||
| 22 | public function behaviors() | 22 | public function behaviors() |
| 23 | { | 23 | { |
| 24 | return [ | 24 | return [ |
| 25 | + 'access'=>[ | ||
| 26 | + 'class' => AccessBehavior::className(), | ||
| 27 | + 'rules' => | ||
| 28 | + ['site' => | ||
| 29 | + [ | ||
| 30 | + [ | ||
| 31 | + 'actions' => ['login', 'error'], | ||
| 32 | + 'allow' => true, | ||
| 33 | + ] | ||
| 34 | + ] | ||
| 35 | + ] | ||
| 36 | + ], | ||
| 25 | 'verbs' => [ | 37 | 'verbs' => [ |
| 26 | 'class' => VerbFilter::className(), | 38 | 'class' => VerbFilter::className(), |
| 27 | 'actions' => [ | 39 | 'actions' => [ |
| @@ -47,7 +59,7 @@ class OrdersController extends Controller | @@ -47,7 +59,7 @@ class OrdersController extends Controller | ||
| 47 | 59 | ||
| 48 | $model = $this->findModel((int)$id); | 60 | $model = $this->findModel((int)$id); |
| 49 | $dataProvider = new ActiveDataProvider([ | 61 | $dataProvider = new ActiveDataProvider([ |
| 50 | - 'query' => OrdersProducts::find()->where(['order_id'=>(int)$_GET['id']]), | 62 | + 'query' => OrdersProducts::find()->where(['order_id'=>(int)$id]), |
| 51 | 'pagination' => [ | 63 | 'pagination' => [ |
| 52 | 'pageSize' => 20, | 64 | 'pageSize' => 20, |
| 53 | ], | 65 | ], |
backend/controllers/PageController.php
| @@ -8,7 +8,7 @@ use common\models\PageSearch; | @@ -8,7 +8,7 @@ use common\models\PageSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * PageController implements the CRUD actions for Page model. | 13 | * PageController implements the CRUD actions for Page model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class PageController extends Controller | @@ -20,6 +20,18 @@ class PageController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/SeoCategoryController.php
| @@ -8,7 +8,7 @@ use common\models\SeoCategorySearch; | @@ -8,7 +8,7 @@ use common\models\SeoCategorySearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * SeoCategoryController implements the CRUD actions for SeoCategory model. | 13 | * SeoCategoryController implements the CRUD actions for SeoCategory model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class SeoCategoryController extends Controller | @@ -20,6 +20,18 @@ class SeoCategoryController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/SeoController.php
| @@ -8,7 +8,7 @@ use common\models\SeoSearch; | @@ -8,7 +8,7 @@ use common\models\SeoSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * SeoController implements the CRUD actions for Seo model. | 13 | * SeoController implements the CRUD actions for Seo model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class SeoController extends Controller | @@ -20,6 +20,18 @@ class SeoController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/SeoDynamicController.php
| @@ -8,7 +8,7 @@ use common\models\SeoDynamicSearch; | @@ -8,7 +8,7 @@ use common\models\SeoDynamicSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * SeoDynamicController implements the CRUD actions for SeoDynamic model. | 13 | * SeoDynamicController implements the CRUD actions for SeoDynamic model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class SeoDynamicController extends Controller | @@ -20,6 +20,18 @@ class SeoDynamicController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/ServiceController.php
| @@ -8,7 +8,7 @@ use common\models\ServiceSearch; | @@ -8,7 +8,7 @@ use common\models\ServiceSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * ServiceController implements the CRUD actions for Service model. | 13 | * ServiceController implements the CRUD actions for Service model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class ServiceController extends Controller | @@ -20,6 +20,18 @@ class ServiceController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
backend/controllers/SiteController.php
| 1 | <?php | 1 | <?php |
| 2 | namespace backend\controllers; | 2 | namespace backend\controllers; |
| 3 | - | 3 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 4 | use common\modules\product\models\Brand; | 4 | use common\modules\product\models\Brand; |
| 5 | use common\modules\product\models\BrandName; | 5 | use common\modules\product\models\BrandName; |
| 6 | use common\modules\product\models\Category; | 6 | use common\modules\product\models\Category; |
| @@ -27,19 +27,17 @@ class SiteController extends Controller | @@ -27,19 +27,17 @@ class SiteController extends Controller | ||
| 27 | public function behaviors() | 27 | public function behaviors() |
| 28 | { | 28 | { |
| 29 | return [ | 29 | return [ |
| 30 | - 'access' => [ | ||
| 31 | - 'class' => AccessControl::className(), | ||
| 32 | - 'rules' => [ | ||
| 33 | - [ | ||
| 34 | - 'actions' => ['login', 'error', 'go'], | ||
| 35 | - 'allow' => true, | ||
| 36 | - ], | ||
| 37 | - [ | ||
| 38 | - 'actions' => ['logout', 'index'], | ||
| 39 | - 'allow' => true, | ||
| 40 | - 'roles' => ['@'], | ||
| 41 | - ], | ||
| 42 | - ], | 30 | + 'access'=>[ |
| 31 | + 'class' => AccessBehavior::className(), | ||
| 32 | + 'rules' => | ||
| 33 | + ['site' => | ||
| 34 | + [ | ||
| 35 | + [ | ||
| 36 | + 'actions' => ['login', 'error'], | ||
| 37 | + 'allow' => true, | ||
| 38 | + ] | ||
| 39 | + ] | ||
| 40 | + ] | ||
| 43 | ], | 41 | ], |
| 44 | 'verbs' => [ | 42 | 'verbs' => [ |
| 45 | 'class' => VerbFilter::className(), | 43 | 'class' => VerbFilter::className(), |
backend/controllers/SliderController.php
| @@ -10,7 +10,7 @@ use yii\helpers\ArrayHelper; | @@ -10,7 +10,7 @@ use yii\helpers\ArrayHelper; | ||
| 10 | use yii\web\Controller; | 10 | use yii\web\Controller; |
| 11 | use yii\web\NotFoundHttpException; | 11 | use yii\web\NotFoundHttpException; |
| 12 | use yii\filters\VerbFilter; | 12 | use yii\filters\VerbFilter; |
| 13 | - | 13 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 14 | /** | 14 | /** |
| 15 | * SliderController implements the CRUD actions for Slider model. | 15 | * SliderController implements the CRUD actions for Slider model. |
| 16 | */ | 16 | */ |
| @@ -22,6 +22,18 @@ class SliderController extends Controller | @@ -22,6 +22,18 @@ class SliderController extends Controller | ||
| 22 | public function behaviors() | 22 | public function behaviors() |
| 23 | { | 23 | { |
| 24 | return [ | 24 | return [ |
| 25 | + 'access'=>[ | ||
| 26 | + 'class' => AccessBehavior::className(), | ||
| 27 | + 'rules' => | ||
| 28 | + ['site' => | ||
| 29 | + [ | ||
| 30 | + [ | ||
| 31 | + 'actions' => ['login', 'error'], | ||
| 32 | + 'allow' => true, | ||
| 33 | + ] | ||
| 34 | + ] | ||
| 35 | + ] | ||
| 36 | + ], | ||
| 25 | 'verbs' => [ | 37 | 'verbs' => [ |
| 26 | 'class' => VerbFilter::className(), | 38 | 'class' => VerbFilter::className(), |
| 27 | 'actions' => [ | 39 | 'actions' => [ |
backend/controllers/SliderImageController.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | namespace backend\controllers; | 3 | namespace backend\controllers; |
| 4 | - | 4 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 5 | use common\models\Slider; | 5 | use common\models\Slider; |
| 6 | use Yii; | 6 | use Yii; |
| 7 | use common\models\SliderImage; | 7 | use common\models\SliderImage; |
| @@ -21,6 +21,18 @@ class SliderImageController extends Controller | @@ -21,6 +21,18 @@ class SliderImageController extends Controller | ||
| 21 | public function behaviors() | 21 | public function behaviors() |
| 22 | { | 22 | { |
| 23 | return [ | 23 | return [ |
| 24 | + 'access'=>[ | ||
| 25 | + 'class' => AccessBehavior::className(), | ||
| 26 | + 'rules' => | ||
| 27 | + ['site' => | ||
| 28 | + [ | ||
| 29 | + [ | ||
| 30 | + 'actions' => ['login', 'error'], | ||
| 31 | + 'allow' => true, | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ] | ||
| 35 | + ], | ||
| 24 | 'verbs' => [ | 36 | 'verbs' => [ |
| 25 | 'class' => VerbFilter::className(), | 37 | 'class' => VerbFilter::className(), |
| 26 | 'actions' => [ | 38 | 'actions' => [ |
| @@ -8,7 +8,7 @@ use common\models\SubscribeSearch; | @@ -8,7 +8,7 @@ use common\models\SubscribeSearch; | ||
| 8 | use yii\web\Controller; | 8 | use yii\web\Controller; |
| 9 | use yii\web\NotFoundHttpException; | 9 | use yii\web\NotFoundHttpException; |
| 10 | use yii\filters\VerbFilter; | 10 | use yii\filters\VerbFilter; |
| 11 | - | 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; |
| 12 | /** | 12 | /** |
| 13 | * SubscribeController implements the CRUD actions for Subscribe model. | 13 | * SubscribeController implements the CRUD actions for Subscribe model. |
| 14 | */ | 14 | */ |
| @@ -20,6 +20,18 @@ class SubscribeController extends Controller | @@ -20,6 +20,18 @@ class SubscribeController extends Controller | ||
| 20 | public function behaviors() | 20 | public function behaviors() |
| 21 | { | 21 | { |
| 22 | return [ | 22 | return [ |
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ] | ||
| 33 | + ] | ||
| 34 | + ], | ||
| 23 | 'verbs' => [ | 35 | 'verbs' => [ |
| 24 | 'class' => VerbFilter::className(), | 36 | 'class' => VerbFilter::className(), |
| 25 | 'actions' => [ | 37 | 'actions' => [ |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace backend\controllers; | ||
| 4 | + | ||
| 5 | +use Yii; | ||
| 6 | +use backend\models\User; | ||
| 7 | +use backend\models\UserSearch; | ||
| 8 | +use yii\web\Controller; | ||
| 9 | +use yii\web\NotFoundHttpException; | ||
| 10 | +use yii\filters\VerbFilter; | ||
| 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; | ||
| 12 | +/** | ||
| 13 | + * UserController implements the CRUD actions for User model. | ||
| 14 | + */ | ||
| 15 | +class UserController extends Controller | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * @inheritdoc | ||
| 19 | + */ | ||
| 20 | + public function behaviors() | ||
| 21 | + { | ||
| 22 | + return [ | ||
| 23 | + 'access'=>[ | ||
| 24 | + 'class' => AccessBehavior::className(), | ||
| 25 | + 'rules' => | ||
| 26 | + ['site' => | ||
| 27 | + [ | ||
| 28 | + [ | ||
| 29 | + 'actions' => ['login', 'error'], | ||
| 30 | + 'allow' => true, | ||
| 31 | + ] | ||
| 32 | + ], | ||
| 33 | + 'user' => | ||
| 34 | + [ | ||
| 35 | + [ | ||
| 36 | + 'actions' => ['index', 'create', 'update'], | ||
| 37 | + 'allow' => true, | ||
| 38 | + ] | ||
| 39 | + ] | ||
| 40 | + ], | ||
| 41 | + ], | ||
| 42 | + 'verbs' => [ | ||
| 43 | + 'class' => VerbFilter::className(), | ||
| 44 | + 'actions' => [ | ||
| 45 | + 'delete' => ['POST'], | ||
| 46 | + ], | ||
| 47 | + ], | ||
| 48 | + ]; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * Lists all User models. | ||
| 53 | + * @return mixed | ||
| 54 | + */ | ||
| 55 | + public function actionIndex() | ||
| 56 | + { | ||
| 57 | + $searchModel = new UserSearch(); | ||
| 58 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
| 59 | + | ||
| 60 | + return $this->render('index', [ | ||
| 61 | + 'searchModel' => $searchModel, | ||
| 62 | + 'dataProvider' => $dataProvider, | ||
| 63 | + ]); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * Displays a single User model. | ||
| 68 | + * @param integer $id | ||
| 69 | + * @return mixed | ||
| 70 | + */ | ||
| 71 | + public function actionView($id) | ||
| 72 | + { | ||
| 73 | + return $this->render('view', [ | ||
| 74 | + 'model' => $this->findModel($id), | ||
| 75 | + ]); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * Creates a new User model. | ||
| 80 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
| 81 | + * @return mixed | ||
| 82 | + */ | ||
| 83 | + public function actionCreate() | ||
| 84 | + { | ||
| 85 | + $model = new User(); | ||
| 86 | + | ||
| 87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
| 88 | + return $this->redirect(['view', 'id' => $model->id]); | ||
| 89 | + } else { | ||
| 90 | + return $this->render('create', [ | ||
| 91 | + 'model' => $model, | ||
| 92 | + ]); | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * Updates an existing User model. | ||
| 98 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
| 99 | + * @param integer $id | ||
| 100 | + * @return mixed | ||
| 101 | + */ | ||
| 102 | + public function actionUpdate($id) | ||
| 103 | + { | ||
| 104 | + $model = $this->findModel($id); | ||
| 105 | + | ||
| 106 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
| 107 | + return $this->redirect(['view', 'id' => $model->id]); | ||
| 108 | + } else { | ||
| 109 | + return $this->render('update', [ | ||
| 110 | + 'model' => $model, | ||
| 111 | + ]); | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + /** | ||
| 116 | + * Deletes an existing User model. | ||
| 117 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
| 118 | + * @param integer $id | ||
| 119 | + * @return mixed | ||
| 120 | + */ | ||
| 121 | + public function actionDelete($id) | ||
| 122 | + { | ||
| 123 | + $this->findModel($id)->delete(); | ||
| 124 | + | ||
| 125 | + return $this->redirect(['index']); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * Finds the User model based on its primary key value. | ||
| 130 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
| 131 | + * @param integer $id | ||
| 132 | + * @return User the loaded model | ||
| 133 | + * @throws NotFoundHttpException if the model cannot be found | ||
| 134 | + */ | ||
| 135 | + protected function findModel($id) | ||
| 136 | + { | ||
| 137 | + if (($model = User::findOne($id)) !== null) { | ||
| 138 | + return $model; | ||
| 139 | + } else { | ||
| 140 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace backend\models; | ||
| 4 | + | ||
| 5 | +use developeruz\db_rbac\interfaces\UserRbacInterface; | ||
| 6 | +use common\models\Share; | ||
| 7 | +use common\modules\comment\models\Comment; | ||
| 8 | +use common\modules\comment\models\Rating; | ||
| 9 | +use Yii; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * This is the model class for table "user". | ||
| 13 | + * | ||
| 14 | + * @property integer $id | ||
| 15 | + * @property string $username | ||
| 16 | + * @property string $auth_key | ||
| 17 | + * @property string $password_hash | ||
| 18 | + * @property string $password_reset_token | ||
| 19 | + * @property string $email | ||
| 20 | + * @property integer $status | ||
| 21 | + * @property integer $created_at | ||
| 22 | + * @property integer $updated_at | ||
| 23 | + * | ||
| 24 | + * @property Comment[] $comments | ||
| 25 | + * @property Rating[] $ratings | ||
| 26 | + * @property Share[] $shares | ||
| 27 | + */ | ||
| 28 | +class User extends \common\models\User implements UserRbacInterface | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * @inheritdoc | ||
| 32 | + */ | ||
| 33 | + public static function tableName() | ||
| 34 | + { | ||
| 35 | + return 'user'; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @inheritdoc | ||
| 40 | + */ | ||
| 41 | + public function rules() | ||
| 42 | + { | ||
| 43 | + return [ | ||
| 44 | + [['username', 'auth_key', 'password_hash', 'email'], 'required'], | ||
| 45 | + [['status', 'created_at', 'updated_at'], 'integer'], | ||
| 46 | + [['username', 'password_hash', 'password_reset_token', 'email'], 'string', 'max' => 255], | ||
| 47 | + [['auth_key'], 'string', 'max' => 32], | ||
| 48 | + [['email'], 'unique'], | ||
| 49 | + [['password_reset_token'], 'unique'], | ||
| 50 | + [['username'], 'unique'], | ||
| 51 | + ]; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * @inheritdoc | ||
| 56 | + */ | ||
| 57 | + public function attributeLabels() | ||
| 58 | + { | ||
| 59 | + return [ | ||
| 60 | + 'id' => 'ID', | ||
| 61 | + 'username' => 'Username', | ||
| 62 | + 'auth_key' => 'Auth Key', | ||
| 63 | + 'password_hash' => 'Password Hash', | ||
| 64 | + 'password_reset_token' => 'Password Reset Token', | ||
| 65 | + 'email' => 'Email', | ||
| 66 | + 'status' => 'Status', | ||
| 67 | + 'created_at' => 'Created At', | ||
| 68 | + 'updated_at' => 'Updated At', | ||
| 69 | + ]; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @return \yii\db\ActiveQuery | ||
| 74 | + */ | ||
| 75 | + public function getComments() | ||
| 76 | + { | ||
| 77 | + return $this->hasMany(Comment::className(), ['user_id' => 'id']); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * @return \yii\db\ActiveQuery | ||
| 82 | + */ | ||
| 83 | + public function getRatings() | ||
| 84 | + { | ||
| 85 | + return $this->hasMany(Rating::className(), ['user_id' => 'id']); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * @return \yii\db\ActiveQuery | ||
| 90 | + */ | ||
| 91 | + public function getShares() | ||
| 92 | + { | ||
| 93 | + return $this->hasMany(Share::className(), ['user_id' => 'id']); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public function getId() | ||
| 97 | + { | ||
| 98 | + return $this->getPrimaryKey(); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public function getUserName() | ||
| 102 | + { | ||
| 103 | + return $this->username; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public static function findIdentity($id) | ||
| 107 | + { | ||
| 108 | + return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace backend\models; | ||
| 4 | + | ||
| 5 | +use Yii; | ||
| 6 | +use yii\base\Model; | ||
| 7 | +use yii\data\ActiveDataProvider; | ||
| 8 | +use backend\models\User; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * UserSearch represents the model behind the search form about `backend\models\User`. | ||
| 12 | + */ | ||
| 13 | +class UserSearch extends User | ||
| 14 | +{ | ||
| 15 | + /** | ||
| 16 | + * @inheritdoc | ||
| 17 | + */ | ||
| 18 | + public function rules() | ||
| 19 | + { | ||
| 20 | + return [ | ||
| 21 | + [['id', 'status', 'created_at', 'updated_at'], 'integer'], | ||
| 22 | + [['username', 'auth_key', 'password_hash', 'password_reset_token', 'email'], 'safe'], | ||
| 23 | + ]; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @inheritdoc | ||
| 28 | + */ | ||
| 29 | + public function scenarios() | ||
| 30 | + { | ||
| 31 | + // bypass scenarios() implementation in the parent class | ||
| 32 | + return Model::scenarios(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * Creates data provider instance with search query applied | ||
| 37 | + * | ||
| 38 | + * @param array $params | ||
| 39 | + * | ||
| 40 | + * @return ActiveDataProvider | ||
| 41 | + */ | ||
| 42 | + public function search($params) | ||
| 43 | + { | ||
| 44 | + $query = User::find(); | ||
| 45 | + | ||
| 46 | + // add conditions that should always apply here | ||
| 47 | + | ||
| 48 | + $dataProvider = new ActiveDataProvider([ | ||
| 49 | + 'query' => $query, | ||
| 50 | + ]); | ||
| 51 | + | ||
| 52 | + $this->load($params); | ||
| 53 | + | ||
| 54 | + if (!$this->validate()) { | ||
| 55 | + // uncomment the following line if you do not want to return any records when validation fails | ||
| 56 | + // $query->where('0=1'); | ||
| 57 | + return $dataProvider; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + // grid filtering conditions | ||
| 61 | + $query->andFilterWhere([ | ||
| 62 | + 'id' => $this->id, | ||
| 63 | + 'status' => $this->status, | ||
| 64 | + 'created_at' => $this->created_at, | ||
| 65 | + 'updated_at' => $this->updated_at, | ||
| 66 | + ]); | ||
| 67 | + | ||
| 68 | + $query->andFilterWhere(['like', 'username', $this->username]) | ||
| 69 | + ->andFilterWhere(['like', 'auth_key', $this->auth_key]) | ||
| 70 | + ->andFilterWhere(['like', 'password_hash', $this->password_hash]) | ||
| 71 | + ->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token]) | ||
| 72 | + ->andFilterWhere(['like', 'email', $this->email]); | ||
| 73 | + | ||
| 74 | + return $dataProvider; | ||
| 75 | + } | ||
| 76 | +} |
backend/views/brand/_form.php
| @@ -18,8 +18,6 @@ use yii\widgets\ActiveForm; | @@ -18,8 +18,6 @@ use yii\widgets\ActiveForm; | ||
| 18 | 18 | ||
| 19 | <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | 19 | <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> |
| 20 | 20 | ||
| 21 | - <?php /*= \common\components\artboximage\ArtboxImageHelper::fileinputWidget($model, 'imageUrl');*/?> | ||
| 22 | - | ||
| 23 | <?= $form->field($model, 'image')->fileInput(['accept' => 'image/*']) ?> | 21 | <?= $form->field($model, 'image')->fileInput(['accept' => 'image/*']) ?> |
| 24 | 22 | ||
| 25 | <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | 23 | <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> |
backend/views/layouts/main-sidebar.php
| @@ -56,6 +56,16 @@ use yii\widgets\Menu; | @@ -56,6 +56,16 @@ use yii\widgets\Menu; | ||
| 56 | ['label' => 'ะะพะดะฟะธัะบะฐ', 'url' => ['/subscribe/index']], | 56 | ['label' => 'ะะพะดะฟะธัะบะฐ', 'url' => ['/subscribe/index']], |
| 57 | ['label' => 'ะะพะปัะทะพะฒะฐัะตะปะธ', 'url' => ['/customer/index']], | 57 | ['label' => 'ะะพะปัะทะพะฒะฐัะตะปะธ', 'url' => ['/customer/index']], |
| 58 | ['label' => 'ะััะฟะฟั ะฟะพะปัะทะพะฒะฐัะตะปะตะน', 'url' => ['/group/index']], | 58 | ['label' => 'ะััะฟะฟั ะฟะพะปัะทะพะฒะฐัะตะปะตะน', 'url' => ['/group/index']], |
| 59 | + [ | ||
| 60 | + 'label' => 'ะะฐัััะพะนะบะฐ ัะพะปะตะน', | ||
| 61 | + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>', | ||
| 62 | + 'items' => [ | ||
| 63 | + ['label' => 'ะะดะผะธะฝะธัััะฐัะพัั', 'url' => ['/user/index']], | ||
| 64 | + ['label' => 'ัะฟัะฐะฒะปะตะฝะธะต ัะพะปัะผะธ', 'url' => ['/permit/access/role']], | ||
| 65 | + ['label' => 'ัะฟัะฐะฒะปะตะฝะธะต ะฟัะฐะฒะฐะผะธ ะดะพัััะฟะฐ', 'url' => ['/permit/access/permission']] | ||
| 66 | + ] | ||
| 67 | + ], | ||
| 68 | + | ||
| 59 | 69 | ||
| 60 | ], | 70 | ], |
| 61 | 71 |
| @@ -11,37 +11,24 @@ $this->title = 'ะะฐะบะฐะทั'; | @@ -11,37 +11,24 @@ $this->title = 'ะะฐะบะฐะทั'; | ||
| 11 | $this->params['breadcrumbs'][] = $this->title; | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 12 | ?> | 12 | ?> |
| 13 | <h1>ะะฐะบะฐะทั</h1> | 13 | <h1>ะะฐะบะฐะทั</h1> |
| 14 | +<?php \yii\widgets\Pjax::begin( [ | ||
| 14 | 15 | ||
| 15 | - <?php $form = ActiveForm::begin(['id' => 'label-form','method'=>'get','action'=>['/admin/orders/index']]); ?> | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - <?php ActiveForm::end(); ?> | ||
| 19 | - | 16 | +]); ?> |
| 20 | <?= GridView::widget([ | 17 | <?= GridView::widget([ |
| 21 | 'dataProvider' => $dataProvider, | 18 | 'dataProvider' => $dataProvider, |
| 22 | 'filterModel' => $searchModel, | 19 | 'filterModel' => $searchModel, |
| 23 | 'columns' => [ | 20 | 'columns' => [ |
| 24 | - // ['class' => 'yii\grid\SerialColumn'], | ||
| 25 | 21 | ||
| 26 | [ | 22 | [ |
| 27 | 'attribute' => 'id', | 23 | 'attribute' => 'id', |
| 28 | 'format' => 'raw', | 24 | 'format' => 'raw', |
| 29 | 'options' => ['class' => 'btn btn-warning'], | 25 | 'options' => ['class' => 'btn btn-warning'], |
| 30 | 'value' => function($model){ | 26 | 'value' => function($model){ |
| 31 | - return Html::button($model->id, ['id'=>$model->id, 'class' => 'btn btn-warning']); '/admin/orders/show?id=47'; | ||
| 32 | - //return Html::a($model->id, ['/admin/orders/show', 'id'=>$model->id], ['class'=>'btn btn-warning'] ); | ||
| 33 | - // return Html::a($data->name, ['/admin/orders/show','id'=>$data->id]); | 27 | + return Html::button($model->id, ['id'=>$model->id, 'class' => 'btn btn-warning']); |
| 28 | + | ||
| 34 | } | 29 | } |
| 35 | 30 | ||
| 36 | ], | 31 | ], |
| 37 | - /*[ | ||
| 38 | - 'attribute' =>'username', | ||
| 39 | - 'value'=>function($data){ | ||
| 40 | - if(!empty($data->user->username))return Html::a($data->user->username, ['/admin/users/show','id'=>$data->user->id]); | ||
| 41 | - }, | ||
| 42 | - 'format'=>'raw', | ||
| 43 | - //'contentOptions'=>['style'=>'width: 160px;'] | ||
| 44 | - ], */ | ||
| 45 | [ | 32 | [ |
| 46 | 'attribute' => 'date_time', | 33 | 'attribute' => 'date_time', |
| 47 | 'value'=>'date_time', | 34 | 'value'=>'date_time', |
| @@ -55,18 +42,15 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -55,18 +42,15 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 55 | [ | 42 | [ |
| 56 | 'attribute' => 'phone', | 43 | 'attribute' => 'phone', |
| 57 | 'value'=>'phone', | 44 | 'value'=>'phone', |
| 58 | - //'contentOptions'=>['style'=>'max-width: 300px;'] | ||
| 59 | ], | 45 | ], |
| 60 | [ | 46 | [ |
| 61 | 'attribute' => 'total', | 47 | 'attribute' => 'total', |
| 62 | 'value'=>'total', | 48 | 'value'=>'total', |
| 63 | - //'contentOptions'=>['style'=>'max-width: 300px;'] | ||
| 64 | ], | 49 | ], |
| 65 | [ | 50 | [ |
| 66 | 'filter' => yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), | 51 | 'filter' => yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), |
| 67 | 'attribute' => 'label', | 52 | 'attribute' => 'label', |
| 68 | 'value' => function ($model, $key, $index, $column) { | 53 | 'value' => function ($model, $key, $index, $column) { |
| 69 | - // var_dump($model); var_dump($key); exit; | ||
| 70 | return Html::activeDropDownList($model, 'label', | 54 | return Html::activeDropDownList($model, 'label', |
| 71 | yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), | 55 | yii\helpers\ArrayHelper::map(Label::find()->orderBy('id')->asArray()->all(), 'id', 'label'), |
| 72 | [ | 56 | [ |
| @@ -84,11 +68,12 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -84,11 +68,12 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 84 | ], | 68 | ], |
| 85 | [ | 69 | [ |
| 86 | 'attribute' => 'pay', | 70 | 'attribute' => 'pay', |
| 87 | - 'value' => function ($model, $key, $index, $column) { | ||
| 88 | - // var_dump($model); var_dump($key); exit; | 71 | + 'filter' => [ |
| 72 | + 0 => 'ะะตั',1=>'ะะฐ' | ||
| 73 | + ], | ||
| 74 | + 'value' => function ($model, $key, $index, $column) { | ||
| 89 | return Html::activeDropDownList($model, 'pay',[0 => 'ะะตั',1=>'ะะฐ'], | 75 | return Html::activeDropDownList($model, 'pay',[0 => 'ะะตั',1=>'ะะฐ'], |
| 90 | [ | 76 | [ |
| 91 | - // 'prompt' => 'ะะตั', | ||
| 92 | 'onchange' => "$.ajax({ | 77 | 'onchange' => "$.ajax({ |
| 93 | url: \"/admin/orders/payupdate\", | 78 | url: \"/admin/orders/payupdate\", |
| 94 | type: \"post\", | 79 | type: \"post\", |
| @@ -112,3 +97,4 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -112,3 +97,4 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 112 | ], | 97 | ], |
| 113 | ], | 98 | ], |
| 114 | ]) ?> | 99 | ]) ?> |
| 100 | +<?php \yii\widgets\Pjax::end(); ?> | ||
| 115 | \ No newline at end of file | 101 | \ No newline at end of file |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | +use yii\widgets\ActiveForm; | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $model backend\models\User */ | ||
| 8 | +/* @var $form yii\widgets\ActiveForm */ | ||
| 9 | +?> | ||
| 10 | + | ||
| 11 | +<div class="user-form"> | ||
| 12 | + | ||
| 13 | + <?php $form = ActiveForm::begin(); ?> | ||
| 14 | + | ||
| 15 | + <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?> | ||
| 16 | + | ||
| 17 | + <?= $form->field($model, 'auth_key')->textInput(['maxlength' => true]) ?> | ||
| 18 | + | ||
| 19 | + <?= $form->field($model, 'password_hash')->textInput(['maxlength' => true]) ?> | ||
| 20 | + | ||
| 21 | + <?= $form->field($model, 'password_reset_token')->textInput(['maxlength' => true]) ?> | ||
| 22 | + | ||
| 23 | + <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?> | ||
| 24 | + | ||
| 25 | + <?= $form->field($model, 'status')->textInput() ?> | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + <div class="form-group"> | ||
| 29 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
| 30 | + </div> | ||
| 31 | + | ||
| 32 | + <?php ActiveForm::end(); ?> | ||
| 33 | + | ||
| 34 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | +use yii\widgets\ActiveForm; | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $model backend\models\UserSearch */ | ||
| 8 | +/* @var $form yii\widgets\ActiveForm */ | ||
| 9 | +?> | ||
| 10 | + | ||
| 11 | +<div class="user-search"> | ||
| 12 | + | ||
| 13 | + <?php $form = ActiveForm::begin([ | ||
| 14 | + 'action' => ['index'], | ||
| 15 | + 'method' => 'get', | ||
| 16 | + ]); ?> | ||
| 17 | + | ||
| 18 | + <?= $form->field($model, 'id') ?> | ||
| 19 | + | ||
| 20 | + <?= $form->field($model, 'username') ?> | ||
| 21 | + | ||
| 22 | + <?= $form->field($model, 'auth_key') ?> | ||
| 23 | + | ||
| 24 | + <?= $form->field($model, 'password_hash') ?> | ||
| 25 | + | ||
| 26 | + <?= $form->field($model, 'password_reset_token') ?> | ||
| 27 | + | ||
| 28 | + <?php // echo $form->field($model, 'email') ?> | ||
| 29 | + | ||
| 30 | + <?php // echo $form->field($model, 'status') ?> | ||
| 31 | + | ||
| 32 | + <?php // echo $form->field($model, 'created_at') ?> | ||
| 33 | + | ||
| 34 | + <?php // echo $form->field($model, 'updated_at') ?> | ||
| 35 | + | ||
| 36 | + <div class="form-group"> | ||
| 37 | + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | ||
| 38 | + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | ||
| 39 | + </div> | ||
| 40 | + | ||
| 41 | + <?php ActiveForm::end(); ?> | ||
| 42 | + | ||
| 43 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $model backend\models\User */ | ||
| 8 | + | ||
| 9 | +$this->title = 'Create User'; | ||
| 10 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | ||
| 11 | +$this->params['breadcrumbs'][] = $this->title; | ||
| 12 | +?> | ||
| 13 | +<div class="user-create"> | ||
| 14 | + | ||
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 16 | + | ||
| 17 | + <?= $this->render('_form', [ | ||
| 18 | + 'model' => $model, | ||
| 19 | + ]) ?> | ||
| 20 | + | ||
| 21 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | +use yii\grid\GridView; | ||
| 5 | +use yii\helpers\Url; | ||
| 6 | + | ||
| 7 | +/* @var $this yii\web\View */ | ||
| 8 | +/* @var $searchModel backend\models\UserSearch */ | ||
| 9 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
| 10 | + | ||
| 11 | +$this->title = 'Users'; | ||
| 12 | +$this->params['breadcrumbs'][] = $this->title; | ||
| 13 | +?> | ||
| 14 | +<div class="user-index"> | ||
| 15 | + | ||
| 16 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
| 18 | + | ||
| 19 | + <p> | ||
| 20 | + <?= Html::a('Create User', ['create'], ['class' => 'btn btn-success']) ?> | ||
| 21 | + </p> | ||
| 22 | + <?= GridView::widget([ | ||
| 23 | + 'dataProvider' => $dataProvider, | ||
| 24 | + 'filterModel' => $searchModel, | ||
| 25 | + 'columns' => [ | ||
| 26 | + ['class' => 'yii\grid\SerialColumn'], | ||
| 27 | + | ||
| 28 | + 'id', | ||
| 29 | + 'username', | ||
| 30 | + 'auth_key', | ||
| 31 | + 'password_hash', | ||
| 32 | + 'password_reset_token', | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + ['class' => 'yii\grid\ActionColumn', | ||
| 36 | + 'template' => '{view} {update} {permit} {delete}', | ||
| 37 | + 'buttons' => | ||
| 38 | + [ | ||
| 39 | + 'permit' => function ($url, $model) { | ||
| 40 | + return Html::a('<span class="glyphicon glyphicon-wrench"></span>', Url::to(['/permit/user/view', 'id' => $model->id]), [ | ||
| 41 | + 'title' => Yii::t('yii', 'Change user role') | ||
| 42 | + ]); }, | ||
| 43 | + ] | ||
| 44 | + ], | ||
| 45 | + ], | ||
| 46 | + ]); ?> | ||
| 47 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | + | ||
| 5 | +/* @var $this yii\web\View */ | ||
| 6 | +/* @var $model backend\models\User */ | ||
| 7 | + | ||
| 8 | +$this->title = 'Update User: ' . $model->id; | ||
| 9 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | ||
| 10 | +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; | ||
| 11 | +$this->params['breadcrumbs'][] = 'Update'; | ||
| 12 | +?> | ||
| 13 | +<div class="user-update"> | ||
| 14 | + | ||
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 16 | + | ||
| 17 | + <?= $this->render('_form', [ | ||
| 18 | + 'model' => $model, | ||
| 19 | + ]) ?> | ||
| 20 | + | ||
| 21 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | +use yii\widgets\DetailView; | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $model backend\models\User */ | ||
| 8 | + | ||
| 9 | +$this->title = $model->id; | ||
| 10 | +$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']]; | ||
| 11 | +$this->params['breadcrumbs'][] = $this->title; | ||
| 12 | +?> | ||
| 13 | +<div class="user-view"> | ||
| 14 | + | ||
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 16 | + | ||
| 17 | + <p> | ||
| 18 | + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | ||
| 19 | + <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | ||
| 20 | + 'class' => 'btn btn-danger', | ||
| 21 | + 'data' => [ | ||
| 22 | + 'confirm' => 'Are you sure you want to delete this item?', | ||
| 23 | + 'method' => 'post', | ||
| 24 | + ], | ||
| 25 | + ]) ?> | ||
| 26 | + </p> | ||
| 27 | + | ||
| 28 | + <?= DetailView::widget([ | ||
| 29 | + 'model' => $model, | ||
| 30 | + 'attributes' => [ | ||
| 31 | + 'id', | ||
| 32 | + 'username', | ||
| 33 | + 'auth_key', | ||
| 34 | + 'password_hash', | ||
| 35 | + 'password_reset_token', | ||
| 36 | + 'email:email', | ||
| 37 | + 'status', | ||
| 38 | + ], | ||
| 39 | + ]) ?> | ||
| 40 | + | ||
| 41 | +</div> |
| @@ -2,14 +2,9 @@ $(document).ready(function(){ | @@ -2,14 +2,9 @@ $(document).ready(function(){ | ||
| 2 | 2 | ||
| 3 | var iii = true; | 3 | var iii = true; |
| 4 | 4 | ||
| 5 | - // console.log(ddd); | ||
| 6 | - // if (ddd) {console.log('hello var ddd is correnct') | ||
| 7 | - // }else { | ||
| 8 | - // console.log('var ddd is not exist'); | ||
| 9 | - // }; | ||
| 10 | - | ||
| 11 | - console.log($('button')); | ||
| 12 | - $('button').click(function(){ | 5 | + |
| 6 | + | ||
| 7 | + $('body').on('click','.btn-warning', function(){ | ||
| 13 | 8 | ||
| 14 | var testt = $(this); | 9 | var testt = $(this); |
| 15 | 10 |
common/components/artboximage/ArtboxImage.php
100644 โ 100755
| @@ -28,7 +28,7 @@ class ArtboxImage extends Component { | @@ -28,7 +28,7 @@ class ArtboxImage extends Component { | ||
| 28 | 'bmp' => 'bmp', | 28 | 'bmp' => 'bmp', |
| 29 | ]; | 29 | ]; |
| 30 | 30 | ||
| 31 | - public $uploadUrl = '@web/artboxfile/action/upload'; | 31 | + public $uploadUrl = '/admin/artboxfile/action/upload'; |
| 32 | 32 | ||
| 33 | public function load($file = null, $driver = null) { | 33 | public function load($file = null, $driver = null) { |
| 34 | if(empty($file) || !realpath($file)) { | 34 | if(empty($file) || !realpath($file)) { |
| @@ -37,8 +37,7 @@ class ArtboxImage extends Component { | @@ -37,8 +37,7 @@ class ArtboxImage extends Component { | ||
| 37 | return Image::factory($file, $driver ? $driver : $this->driver); | 37 | return Image::factory($file, $driver ? $driver : $this->driver); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | - public function fileinputWidget($model, $modelField = 'file', $formField = 'fileUpload', $multiple = false, $imageOnly = true) { | ||
| 41 | - $uploadUrl = Yii::getAlias($this->uploadUrl); | 40 | + public function fileinputWidget($model, $modelField, $formField = 'fileUpload', $multiple = false, $imageOnly = true) { |
| 42 | $options = [ | 41 | $options = [ |
| 43 | 'multiple' => $multiple, | 42 | 'multiple' => $multiple, |
| 44 | ]; | 43 | ]; |
| @@ -55,7 +54,7 @@ class ArtboxImage extends Component { | @@ -55,7 +54,7 @@ class ArtboxImage extends Component { | ||
| 55 | 'overwriteInitial' => !$multiple, | 54 | 'overwriteInitial' => !$multiple, |
| 56 | 'showRemove' => true, | 55 | 'showRemove' => true, |
| 57 | 'showUpload' => false, | 56 | 'showUpload' => false, |
| 58 | - 'uploadUrl' => $uploadUrl, | 57 | + 'uploadUrl' => $this->uploadUrl, |
| 59 | 'uploadExtraData' => [ | 58 | 'uploadExtraData' => [ |
| 60 | 'fileField' => $modelField, | 59 | 'fileField' => $modelField, |
| 61 | 'multiple' => intval($multiple), | 60 | 'multiple' => intval($multiple), |
common/components/artboximage/ArtboxImageHelper.php
100644 โ 100755
common/config/main.php
| @@ -130,11 +130,8 @@ return [ | @@ -130,11 +130,8 @@ return [ | ||
| 130 | ], | 130 | ], |
| 131 | 131 | ||
| 132 | 'modules' => [ | 132 | 'modules' => [ |
| 133 | -// 'file' => [ | ||
| 134 | -// 'class' => 'common\modules\file\Module', | ||
| 135 | -// ], | ||
| 136 | - 'artboxfile' => [ | ||
| 137 | - 'class' => 'common\modules\artboxfile\Module', | 133 | + 'file' => [ |
| 134 | + 'class' => 'common\modules\file\Module', | ||
| 138 | ], | 135 | ], |
| 139 | 'relation' => [ | 136 | 'relation' => [ |
| 140 | 'class' => 'common\modules\relation\Module', | 137 | 'class' => 'common\modules\relation\Module', |
common/models/User.php
common/modules/artboxfile/controllers/ActionController.php
100644 โ 100755
common/modules/product/models/Brand.php
| @@ -27,6 +27,7 @@ use Yii; | @@ -27,6 +27,7 @@ use Yii; | ||
| 27 | */ | 27 | */ |
| 28 | class Brand extends \yii\db\ActiveRecord | 28 | class Brand extends \yii\db\ActiveRecord |
| 29 | { | 29 | { |
| 30 | + public $imageUpload; | ||
| 30 | 31 | ||
| 31 | public function behaviors() | 32 | public function behaviors() |
| 32 | { | 33 | { |
| @@ -80,7 +81,8 @@ class Brand extends \yii\db\ActiveRecord | @@ -80,7 +81,8 @@ class Brand extends \yii\db\ActiveRecord | ||
| 80 | [['alias', 'name'], 'string', 'max' => 250], | 81 | [['alias', 'name'], 'string', 'max' => 250], |
| 81 | [['image', 'meta_title'], 'string', 'max' => 255], | 82 | [['image', 'meta_title'], 'string', 'max' => 255], |
| 82 | [['meta_robots'], 'string', 'max' => 50], | 83 | [['meta_robots'], 'string', 'max' => 50], |
| 83 | - ['image', 'file', 'extensions' => 'jpg, gif, png', 'on' => ['insert', 'update']], | 84 | + [['imageUpload'], 'safe'], |
| 85 | + [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], | ||
| 84 | // [['brand_name_id'], 'exist', 'skipOnError' => true, 'targetClass' => BrandName::className(), 'targetAttribute' => ['brand_name_id' => 'brand_name_id']], | 86 | // [['brand_name_id'], 'exist', 'skipOnError' => true, 'targetClass' => BrandName::className(), 'targetAttribute' => ['brand_name_id' => 'brand_name_id']], |
| 85 | ]; | 87 | ]; |
| 86 | } | 88 | } |
common/modules/product/widgets/lastProducts.php
100644 โ 100755
common/modules/product/widgets/specialProducts.php
100644 โ 100755
common/modules/product/widgets/views/product_smart.php
100644 โ 100755
common/modules/product/widgets/views/products_block.php
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace console\controllers; | ||
| 4 | + | ||
| 5 | +use Yii; | ||
| 6 | +use yii\console\Controller; | ||
| 7 | + | ||
| 8 | +class RbacController extends Controller | ||
| 9 | +{ | ||
| 10 | + public function actionInit() | ||
| 11 | + { | ||
| 12 | + $auth = Yii::$app->authManager; | ||
| 13 | + | ||
| 14 | + // add "createPost" permission | ||
| 15 | + $createPost = $auth->createPermission('createPost'); | ||
| 16 | + $createPost->description = 'Create a post'; | ||
| 17 | + $auth->add($createPost); | ||
| 18 | + | ||
| 19 | + // add "updatePost" permission | ||
| 20 | + $updatePost = $auth->createPermission('updatePost'); | ||
| 21 | + $updatePost->description = 'Update post'; | ||
| 22 | + $auth->add($updatePost); | ||
| 23 | + | ||
| 24 | +// // add "author" role and give this role the "createPost" permission | ||
| 25 | + $author = $auth->createRole('author'); | ||
| 26 | + $auth->add($author); | ||
| 27 | + $auth->addChild($author, $createPost); | ||
| 28 | +// | ||
| 29 | +// // add "admin" role and give this role the "updatePost" permission | ||
| 30 | +// // as well as the permissions of the "author" role | ||
| 31 | + $admin = $auth->createRole('admin'); | ||
| 32 | + $auth->add($admin); | ||
| 33 | + $auth->addChild($admin, $updatePost); | ||
| 34 | + $auth->addChild($admin, $author); | ||
| 35 | +// | ||
| 36 | +// // Assign roles to users. 1 and 2 are IDs returned by IdentityInterface::getId() | ||
| 37 | +// // usually implemented in your User model. | ||
| 38 | +// $auth->assign($author, 2); | ||
| 39 | +// $auth->assign($admin, 1); | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + } | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + |
console/migrations/m160512_153443_subscribe.php
100644 โ 100755
console/migrations/m160516_222821_orders.php
100644 โ 100755
console/migrations/m160516_234753_orders_delivery.php
100644 โ 100755
console/migrations/m160517_072059_delete_product_fk.php
100644 โ 100755
console/migrations/m160517_073502_orders_label.php
100644 โ 100755
console/migrations/m160518_185644_change_order.php
100644 โ 100755
| @@ -38,7 +38,7 @@ class BasketController extends Controller | @@ -38,7 +38,7 @@ class BasketController extends Controller | ||
| 38 | } | 38 | } |
| 39 | $body .= "\n\r"; | 39 | $body .= "\n\r"; |
| 40 | 40 | ||
| 41 | - if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->save() && $modelOrder->contact('borisenko.pavel@gmail.com',$body)) { | 41 | + if ($modelOrder->load(Yii::$app->request->post()) && $modelOrder->save()) { |
| 42 | foreach ($_POST['ProductVariant'] as $index=>$row) { | 42 | foreach ($_POST['ProductVariant'] as $index=>$row) { |
| 43 | $modelOrdersProducts = new OrdersProducts(); | 43 | $modelOrdersProducts = new OrdersProducts(); |
| 44 | $mod_id = $row['id']; | 44 | $mod_id = $row['id']; |
frontend/views/catalog/product_item.php
| @@ -5,23 +5,17 @@ use yii\helpers\Url; | @@ -5,23 +5,17 @@ use yii\helpers\Url; | ||
| 5 | <li class="item"> | 5 | <li class="item"> |
| 6 | <div class="boxitem"> | 6 | <div class="boxitem"> |
| 7 | <div class="pixbox"> | 7 | <div class="pixbox"> |
| 8 | - <a href="<?= Url::to(['catalog/product', 'product' => $product])?>"> | ||
| 9 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->imageUrl, 'list')?> | 8 | + <a href="<?= Url::to([ |
| 9 | + 'catalog/product', | ||
| 10 | + 'product' => $product]) | ||
| 11 | + ?>"> | ||
| 12 | + <?php if (empty($product->image)) :?> | ||
| 13 | + <img src="/img/no_photo.png"> | ||
| 14 | + <?php else :?> | ||
| 15 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->image->imageUrl, 'list')?> | ||
| 16 | + <?php endif?> | ||
| 10 | </a> | 17 | </a> |
| 11 | </div> | 18 | </div> |
| 12 | - <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?> | ||
| 13 | - <ul class="product-special"> | ||
| 14 | - <?php if(!empty($product->is_top)) :?> | ||
| 15 | - <li class="top">top </li> | ||
| 16 | - <?php endif?> | ||
| 17 | - <?php if(!empty($product->is_new)) :?> | ||
| 18 | - <li class="new">new </li> | ||
| 19 | - <?php endif?> | ||
| 20 | - <?php if(!empty($product->akciya)) :?> | ||
| 21 | - <li class="promo">promo </li> | ||
| 22 | - <?php endif?> | ||
| 23 | - </ul> | ||
| 24 | - <?php endif?> | ||
| 25 | <a href="<?= Url::to([ | 19 | <a href="<?= Url::to([ |
| 26 | 'catalog/product', | 20 | 'catalog/product', |
| 27 | 'product' => $product]) | 21 | 'product' => $product]) |
| @@ -52,11 +46,16 @@ use yii\helpers\Url; | @@ -52,11 +46,16 @@ use yii\helpers\Url; | ||
| 52 | <div class="mycarousel"> | 46 | <div class="mycarousel"> |
| 53 | <ul class="jcarousel jcarousel-skin-tango"> | 47 | <ul class="jcarousel jcarousel-skin-tango"> |
| 54 | <?php foreach ($product->variants as $variant) : ?> | 48 | <?php foreach ($product->variants as $variant) : ?> |
| 49 | + <?php if (!empty($variant->image)) :?> | ||
| 55 | <li> | 50 | <li> |
| 56 | - <a href="<?= Url::to(['catalog/product', 'product' => $product, '#' => 'm' . $variant->product_variant_id]) ?>"> | ||
| 57 | - <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?> | 51 | + <a href="<?= Url::to([ |
| 52 | + 'catalog/product', | ||
| 53 | + 'product' => $product, | ||
| 54 | + '#' => 'm' . $variant->product_variant_id]) ?>"> | ||
| 55 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->image->imageUrl, 'product_variant')?> | ||
| 58 | </a> | 56 | </a> |
| 59 | </li> | 57 | </li> |
| 58 | + <?php endif; ?> | ||
| 60 | <?php endforeach; ?> | 59 | <?php endforeach; ?> |
| 61 | </ul> | 60 | </ul> |
| 62 | </div> | 61 | </div> |
frontend/views/site/index.php
| @@ -16,17 +16,17 @@ $this->registerJsFile ( | @@ -16,17 +16,17 @@ $this->registerJsFile ( | ||
| 16 | 16 | ||
| 17 | <?php | 17 | <?php |
| 18 | 18 | ||
| 19 | -echo '<div class="home_banner_up">'; | ||
| 20 | - echo SliderWidget::widget(["title"=>"HOME_SLIDER"]); | ||
| 21 | - echo BannerWidget::widget(['title' => 'HOME_RIGHT']); | 19 | +echo SliderWidget::widget(["title"=>"HOME_SLIDER"]); |
| 22 | 20 | ||
| 23 | - echo '<div id="HOME_UNDER_SLIDER">'; | ||
| 24 | - echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_1']); | ||
| 25 | - echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_2']); | ||
| 26 | - echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_3']); | ||
| 27 | - echo '</div>'; | 21 | +echo BannerWidget::widget(['title' => 'HOME_RIGHT']); |
| 28 | 22 | ||
| 29 | -echo '</div>' | 23 | +echo '<div id="HOME_UNDER_SLIDER">'; |
| 24 | + | ||
| 25 | +echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_1']); | ||
| 26 | +echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_2']); | ||
| 27 | +echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_3']); | ||
| 28 | + | ||
| 29 | +echo '</div>'; | ||
| 30 | ?> | 30 | ?> |
| 31 | 31 | ||
| 32 | <?= \frontend\widgets\Rubrics::widget(['wrapper' => 'rubrics', 'includes' => [117,118,119,120,121]])?> | 32 | <?= \frontend\widgets\Rubrics::widget(['wrapper' => 'rubrics', 'includes' => [117,118,119,120,121]])?> |
frontend/web/css/ion.rangeSlider.skinHTML5.css
100644 โ 100755
frontend/web/css/style.css
| @@ -91,7 +91,7 @@ a.myorders{color:#f75d50} | @@ -91,7 +91,7 @@ a.myorders{color:#f75d50} | ||
| 91 | .sub{margin:2px 0px 0px 0px;} | 91 | .sub{margin:2px 0px 0px 0px;} |
| 92 | .sub img{float:left;margin-right:2px;} | 92 | .sub img{float:left;margin-right:2px;} |
| 93 | 93 | ||
| 94 | -.rubrics{margin:60px 0 0 0;padding-bottom:10px;} | 94 | +.rubrics{margin:60px 0 0 0;padding-bottom:27px;} |
| 95 | .rubrics ul{list-style:none;margin:0px;padding:0px;} | 95 | .rubrics ul{list-style:none;margin:0px;padding:0px;} |
| 96 | .rubrics ul li{float:left;margin:0px 35px;} | 96 | .rubrics ul li{float:left;margin:0px 35px;} |
| 97 | .rubrics ul li a{float:left;width:120px;padding-top:130px;text-align:center;text-transform: uppercase;color:#494949;text-decoration:none;font-weight:bold;} | 97 | .rubrics ul li a{float:left;width:120px;padding-top:130px;text-align:center;text-transform: uppercase;color:#494949;text-decoration:none;font-weight:bold;} |
| @@ -102,7 +102,10 @@ a.myorders{color:#f75d50} | @@ -102,7 +102,10 @@ a.myorders{color:#f75d50} | ||
| 102 | .rubrics ul li.item_koshelki a{background:url('../img/ico5.png') no-repeat;} | 102 | .rubrics ul li.item_koshelki a{background:url('../img/ico5.png') no-repeat;} |
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | -.products{border-top:1px solid #d2d2d2;padding-bottom:30px;padding-top:20px;} | 105 | +.products{padding-bottom:30px;padding-top:20px;} |
| 106 | +.why_me_, .products { | ||
| 107 | + border-top: 1px solid #d2d2d2; | ||
| 108 | +} | ||
| 106 | .products ul{list-style:none;margin:0px;padding:0px;} | 109 | .products ul{list-style:none;margin:0px;padding:0px;} |
| 107 | .products ul li.item{float:left;width:160px;margin:0px 35px 15px;text-align:center;position:relative;} | 110 | .products ul li.item{float:left;width:160px;margin:0px 35px 15px;text-align:center;position:relative;} |
| 108 | .products ul li a.name{display:block;color:#494949;text-decoration:none;margin:15px 0px;height:30px;text-transform: uppercase;} | 111 | .products ul li a.name{display:block;color:#494949;text-decoration:none;margin:15px 0px;height:30px;text-transform: uppercase;} |
| @@ -125,14 +128,14 @@ h2.why{width:213px;height:49px;background:url('../img/logo-why.png') no-repeat;m | @@ -125,14 +128,14 @@ h2.why{width:213px;height:49px;background:url('../img/logo-why.png') no-repeat;m | ||
| 125 | h2.why span{display:none;} | 128 | h2.why span{display:none;} |
| 126 | 129 | ||
| 127 | ul.why_list{list-style:none;margin:0px;padding:0px;} | 130 | ul.why_list{list-style:none;margin:0px;padding:0px;} |
| 128 | -ul.why_list li{float:left;width:180px;margin-right:30px;} | 131 | +ul.why_list li{float:left;margin-left:58px; width: 288px; height:96px;box-sizing: border-box;padding-left: 110px;} |
| 129 | ul.why_list li span{font-weight:bold;color:#799920;} | 132 | ul.why_list li span{font-weight:bold;color:#799920;} |
| 130 | -ul.why_list li.item1{background:url('../img/why_item1.png') left no-repeat;padding:36px 0px 20px 110px;} | ||
| 131 | -ul.why_list li.item2{background:url('../img/why_item2.png') left no-repeat;padding:20px 0px 20px 110px;} | ||
| 132 | -ul.why_list li.item3{background:url('../img/why_item3.png') left no-repeat;padding:40px 0px 40px 110px;} | ||
| 133 | -ul.why_list li.item4{background:url('../img/why_item4.png') left no-repeat;padding:20px 0px 20px 110px;} | ||
| 134 | -ul.why_list li.item5{background:url('../img/why_item5.png') left no-repeat;padding:30px 0px 30px 110px;} | ||
| 135 | -ul.why_list li.item6{background:url('../img/why_item6.png') left no-repeat;padding:40px 0px 40px 110px;} | 133 | +ul.why_list li.item1{background:url('../img/why_item1.png') left no-repeat;} |
| 134 | +ul.why_list li.item2{background:url('../img/why_item2.png') left no-repeat;} | ||
| 135 | +ul.why_list li.item3{background:url('../img/why_item3.png') left no-repeat;} | ||
| 136 | +ul.why_list li.item4{background:url('../img/why_item4.png') left no-repeat;} | ||
| 137 | +ul.why_list li.item5{background:url('../img/why_item5.png') left no-repeat;} | ||
| 138 | +ul.why_list li.item6{background:url('../img/why_item6.png') left no-repeat;} | ||
| 136 | 139 | ||
| 137 | .banner_akciya{margin:50px 0px;} | 140 | .banner_akciya{margin:50px 0px;} |
| 138 | 141 | ||
| @@ -858,4 +861,15 @@ a.active{font-weight:bold;text-decoration: underline;} | @@ -858,4 +861,15 @@ a.active{font-weight:bold;text-decoration: underline;} | ||
| 858 | #HOME_SLIDER .jssorb03 div.av:hover, #HOME_SLIDER .jssorb03 div.av:active { | 861 | #HOME_SLIDER .jssorb03 div.av:hover, #HOME_SLIDER .jssorb03 div.av:active { |
| 859 | cursor: default; | 862 | cursor: default; |
| 860 | background: none; | 863 | background: none; |
| 861 | -} | ||
| 862 | \ No newline at end of file | 864 | \ No newline at end of file |
| 865 | +} | ||
| 866 | +.special-products { | ||
| 867 | + padding-top: 30px; | ||
| 868 | +} | ||
| 869 | +.special-products .link_buy { | ||
| 870 | + margin-bottom: 0; | ||
| 871 | +} | ||
| 872 | +.special-products .item { | ||
| 873 | + margin-bottom: 0 !important; | ||
| 874 | +} | ||
| 875 | +.why_me_ {padding-top: 30px; overflow: hidden;} | ||
| 876 | +.why_me_ .why_list {width: 1038px; margin-left: -58px} | ||
| 863 | \ No newline at end of file | 877 | \ No newline at end of file |
frontend/web/images/products/1305887984-2604-2605.jpg deleted
219 KB
frontend/web/images/products/1348483804-512-2445.jpg deleted
101 KB
frontend/web/images/products/1348484212-3723-3585.jpg deleted
99.2 KB
frontend/web/images/products/1348484611-4020-7396.jpg deleted
100 KB
frontend/web/images/products/1348485104-4555-7650.jpg deleted
71.5 KB
frontend/web/images/products/1348487239-495-4299.jpg deleted
111 KB