Commit 8774e5a31dd6731150215acedd864398eb1e70c2
1 parent
f57bf6b7
31.03.16 finish 1
Showing
714 changed files
with
4801 additions
and
406 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 714 files are displayed.
.gitignore
@@ -41,3 +41,5 @@ phpunit.phar | @@ -41,3 +41,5 @@ phpunit.phar | ||
41 | /frontend/web/assets/ | 41 | /frontend/web/assets/ |
42 | /frontend/web/css/node_modules/ | 42 | /frontend/web/css/node_modules/ |
43 | composer.lock | 43 | composer.lock |
44 | + | ||
45 | +tests/_output/* | ||
44 | \ No newline at end of file | 46 | \ No newline at end of file |
@@ -54,6 +54,17 @@ return [ | @@ -54,6 +54,17 @@ return [ | ||
54 | 'adminUrl' => '/admin' | 54 | 'adminUrl' => '/admin' |
55 | 55 | ||
56 | ], | 56 | ], |
57 | + 'urlManager' => [ | ||
58 | + 'baseUrl' => '/admin', | ||
59 | + 'enablePrettyUrl' => true, | ||
60 | + 'showScriptName' => false, | ||
61 | + 'rules' => [ | ||
62 | + 'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>/<id:[A-Za-z0-9_-]+>' => 'slider-image/<action>', | ||
63 | + 'slider-image/<action>/<slider_id:[A-Za-z0-9_-]+>' => 'slider-image/<action>', | ||
64 | + | ||
65 | + | ||
66 | + ] | ||
67 | + ] | ||
57 | 68 | ||
58 | ], | 69 | ], |
59 | 'params' => $params, | 70 | 'params' => $params, |
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use common\modules\file\widgets\ImageUploader; | ||
6 | +use Yii; | ||
7 | +use common\models\Banner; | ||
8 | +use common\models\BannerSearch; | ||
9 | +use yii\web\Controller; | ||
10 | +use yii\web\NotFoundHttpException; | ||
11 | +use yii\filters\VerbFilter; | ||
12 | + | ||
13 | +/** | ||
14 | + * BannerController implements the CRUD actions for Banner model. | ||
15 | + */ | ||
16 | +class BannerController extends Controller | ||
17 | +{ | ||
18 | + /** | ||
19 | + * @inheritdoc | ||
20 | + */ | ||
21 | + public function behaviors() | ||
22 | + { | ||
23 | + return [ | ||
24 | + 'verbs' => [ | ||
25 | + 'class' => VerbFilter::className(), | ||
26 | + 'actions' => [ | ||
27 | + 'delete' => ['POST'], | ||
28 | + ], | ||
29 | + ], | ||
30 | + ]; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * Lists all Banner models. | ||
35 | + * @return mixed | ||
36 | + */ | ||
37 | + public function actionIndex() | ||
38 | + { | ||
39 | + $searchModel = new BannerSearch(); | ||
40 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
41 | + | ||
42 | + return $this->render('index', [ | ||
43 | + 'searchModel' => $searchModel, | ||
44 | + 'dataProvider' => $dataProvider, | ||
45 | + ]); | ||
46 | + } | ||
47 | + | ||
48 | + public function actionSaveImageSettings(){ | ||
49 | + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | ||
50 | + $width = Yii::$app->request->post('width'); | ||
51 | + $height = Yii::$app->request->post('height'); | ||
52 | + | ||
53 | + $html = ImageUploader::widget([ | ||
54 | + 'model'=> new Banner(), | ||
55 | + 'field'=>'image', | ||
56 | + 'size' => [ | ||
57 | + [ | ||
58 | + 'width'=>$width, | ||
59 | + 'height'=>$height, | ||
60 | + ], | ||
61 | + ], | ||
62 | + 'name' => "Загрузить баннер" | ||
63 | + ]); | ||
64 | + | ||
65 | + return ['html'=>$html]; | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Displays a single Banner model. | ||
70 | + * @param integer $id | ||
71 | + * @return mixed | ||
72 | + */ | ||
73 | + public function actionView($id) | ||
74 | + { | ||
75 | + return $this->render('view', [ | ||
76 | + 'model' => $this->findModel($id), | ||
77 | + ]); | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * Creates a new Banner model. | ||
82 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
83 | + * @return mixed | ||
84 | + */ | ||
85 | + public function actionCreate() | ||
86 | + { | ||
87 | + $model = new Banner(); | ||
88 | + | ||
89 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
90 | + return $this->redirect(['view', 'id' => $model->banner_id]); | ||
91 | + } else { | ||
92 | + return $this->render('create', [ | ||
93 | + 'model' => $model, | ||
94 | + ]); | ||
95 | + } | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * Updates an existing Banner model. | ||
100 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
101 | + * @param integer $id | ||
102 | + * @return mixed | ||
103 | + */ | ||
104 | + public function actionUpdate($id) | ||
105 | + { | ||
106 | + $model = $this->findModel($id); | ||
107 | + | ||
108 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
109 | + return $this->redirect(['view', 'id' => $model->banner_id]); | ||
110 | + } else { | ||
111 | + return $this->render('update', [ | ||
112 | + 'model' => $model, | ||
113 | + ]); | ||
114 | + } | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * Deletes an existing Banner model. | ||
119 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
120 | + * @param integer $id | ||
121 | + * @return mixed | ||
122 | + */ | ||
123 | + public function actionDelete($id) | ||
124 | + { | ||
125 | + $this->findModel($id)->delete(); | ||
126 | + | ||
127 | + return $this->redirect(['index']); | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * Finds the Banner model based on its primary key value. | ||
132 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
133 | + * @param integer $id | ||
134 | + * @return Banner the loaded model | ||
135 | + * @throws NotFoundHttpException if the model cannot be found | ||
136 | + */ | ||
137 | + protected function findModel($id) | ||
138 | + { | ||
139 | + if (($model = Banner::findOne($id)) !== null) { | ||
140 | + return $model; | ||
141 | + } else { | ||
142 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
143 | + } | ||
144 | + } | ||
145 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use common\models\TemplateLocation; | ||
6 | +use Yii; | ||
7 | +use common\models\Slider; | ||
8 | +use common\models\SliderSearch; | ||
9 | +use yii\helpers\ArrayHelper; | ||
10 | +use yii\web\Controller; | ||
11 | +use yii\web\NotFoundHttpException; | ||
12 | +use yii\filters\VerbFilter; | ||
13 | + | ||
14 | +/** | ||
15 | + * SliderController implements the CRUD actions for Slider model. | ||
16 | + */ | ||
17 | +class SliderController extends Controller | ||
18 | +{ | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public function behaviors() | ||
23 | + { | ||
24 | + return [ | ||
25 | + 'verbs' => [ | ||
26 | + 'class' => VerbFilter::className(), | ||
27 | + 'actions' => [ | ||
28 | + 'delete' => ['POST'], | ||
29 | + ], | ||
30 | + ], | ||
31 | + ]; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Lists all Slider models. | ||
36 | + * @return mixed | ||
37 | + */ | ||
38 | + public function actionIndex() | ||
39 | + { | ||
40 | + $searchModel = new SliderSearch(); | ||
41 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
42 | + | ||
43 | + return $this->render('index', [ | ||
44 | + 'searchModel' => $searchModel, | ||
45 | + 'dataProvider' => $dataProvider, | ||
46 | + ]); | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Displays a single Slider model. | ||
51 | + * @param integer $id | ||
52 | + * @return mixed | ||
53 | + */ | ||
54 | + public function actionView($id) | ||
55 | + { | ||
56 | + return $this->render('view', [ | ||
57 | + 'model' => $this->findModel($id), | ||
58 | + ]); | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Creates a new Slider model. | ||
63 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
64 | + * @return mixed | ||
65 | + */ | ||
66 | + public function actionCreate() | ||
67 | + { | ||
68 | + $model = new Slider(); | ||
69 | + | ||
70 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
71 | + return $this->redirect(['view', 'id' => $model->slider_id]); | ||
72 | + } else { | ||
73 | + | ||
74 | + | ||
75 | + return $this->render('create', [ | ||
76 | + 'model' => $model, | ||
77 | + ]); | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * Updates an existing Slider model. | ||
83 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
84 | + * @param integer $id | ||
85 | + * @return mixed | ||
86 | + */ | ||
87 | + public function actionUpdate($id) | ||
88 | + { | ||
89 | + $model = $this->findModel($id); | ||
90 | + | ||
91 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
92 | + return $this->redirect(['view', 'id' => $model->slider_id]); | ||
93 | + } else { | ||
94 | + return $this->render('update', [ | ||
95 | + 'model' => $model, | ||
96 | + ]); | ||
97 | + } | ||
98 | + } | ||
99 | + | ||
100 | + /** | ||
101 | + * Deletes an existing Slider model. | ||
102 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
103 | + * @param integer $id | ||
104 | + * @return mixed | ||
105 | + */ | ||
106 | + public function actionDelete($id) | ||
107 | + { | ||
108 | + $this->findModel($id)->delete(); | ||
109 | + | ||
110 | + return $this->redirect(['index']); | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * Finds the Slider model based on its primary key value. | ||
115 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
116 | + * @param integer $id | ||
117 | + * @return Slider the loaded model | ||
118 | + * @throws NotFoundHttpException if the model cannot be found | ||
119 | + */ | ||
120 | + protected function findModel($id) | ||
121 | + { | ||
122 | + if (($model = Slider::findOne($id)) !== null) { | ||
123 | + return $model; | ||
124 | + } else { | ||
125 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
126 | + } | ||
127 | + } | ||
128 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use common\modules\file\widgets\ImageUploader; | ||
4 | +use kartik\select2\Select2; | ||
5 | +use yii\helpers\Html; | ||
6 | +use yii\widgets\ActiveForm; | ||
7 | + | ||
8 | +/* @var $this yii\web\View */ | ||
9 | +/* @var $model common\models\Banner */ | ||
10 | +/* @var $form yii\widgets\ActiveForm */ | ||
11 | +?> | ||
12 | + | ||
13 | +<div class="banner-form"> | ||
14 | + | ||
15 | + <?php $form = ActiveForm::begin(); ?> | ||
16 | + | ||
17 | + | ||
18 | + <?= $form->field($model, 'alt')->textInput(['maxlength' => true]) ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'status')->widget(Select2::className(),([ | ||
25 | + 'name' => 'status', | ||
26 | + 'hideSearch' => true, | ||
27 | + 'data' => [1 => 'Active', 2 => 'Inactive'], | ||
28 | + 'options' => ['placeholder' => 'Select status...'], | ||
29 | + 'pluginOptions' => [ | ||
30 | + 'allowClear' => true | ||
31 | + ] | ||
32 | + ])) ?> | ||
33 | + | ||
34 | + <?= $form->field($model, 'width')->textInput(['maxlength' => true]) ?> | ||
35 | + | ||
36 | + <?= $form->field($model, 'height')->textInput(['maxlength' => true]) ?> | ||
37 | + | ||
38 | + <p id="save_image_widget_settings" class = "btn btn-primary" >Применить настройки</p> | ||
39 | + | ||
40 | + <div id="image_widget_block"> | ||
41 | + <?php if(!empty($model->image)){ | ||
42 | + echo ImageUploader::widget([ | ||
43 | + 'model'=> $model, | ||
44 | + 'field'=>'image', | ||
45 | + 'size' => [ | ||
46 | + [ | ||
47 | + 'width'=>$model->width, | ||
48 | + 'height'=>$model->height, | ||
49 | + ], | ||
50 | + ], | ||
51 | + 'gallery' =>$model->image, | ||
52 | + 'name' => "Загрузить баннер" | ||
53 | + ]); | ||
54 | + }?> | ||
55 | + </div> | ||
56 | + | ||
57 | + <div class="form-group"> | ||
58 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
59 | + </div> | ||
60 | + | ||
61 | + <?php ActiveForm::end(); ?> | ||
62 | + | ||
63 | +</div> | ||
64 | +<script> | ||
65 | + $('#save_image_widget_settings').click(function(){ | ||
66 | + var width = $('#banner-width').val(); | ||
67 | + var height = $('#banner-height').val(); | ||
68 | + save_image_widget_settings( width, height, function(data){ | ||
69 | + $('#image_widget_block').html = ''; | ||
70 | + $('#image_widget_block').html(data.html); | ||
71 | + }); | ||
72 | + }); | ||
73 | + function save_image_widget_settings( width, height, callback ) | ||
74 | + { | ||
75 | + $.ajax({ | ||
76 | + url: '/admin/banner/save-image-settings', | ||
77 | + data : | ||
78 | + { | ||
79 | + 'width' : width, | ||
80 | + 'height' : height | ||
81 | + }, | ||
82 | + type : 'POST', | ||
83 | + dataType: 'json', | ||
84 | + success: function (data) | ||
85 | + { | ||
86 | + if(callback) | ||
87 | + callback(data); | ||
88 | + }, | ||
89 | + error: function() | ||
90 | + { | ||
91 | + console.info('error'); | ||
92 | + } | ||
93 | + }); | ||
94 | + } | ||
95 | +</script> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\BannerSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="banner-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'banner_id') ?> | ||
19 | + | ||
20 | + | ||
21 | + <?= $form->field($model, 'image') ?> | ||
22 | + | ||
23 | + <?= $form->field($model, 'alt') ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'title') ?> | ||
26 | + | ||
27 | + <?php // echo $form->field($model, 'url') ?> | ||
28 | + | ||
29 | + <?php // echo $form->field($model, 'status') ?> | ||
30 | + | ||
31 | + <div class="form-group"> | ||
32 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
33 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
34 | + </div> | ||
35 | + | ||
36 | + <?php ActiveForm::end(); ?> | ||
37 | + | ||
38 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Banner */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Banner'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="banner-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 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel common\models\BannerSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Banners'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="banner-index"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
17 | + | ||
18 | + <p> | ||
19 | + <?= Html::a(Yii::t('app', 'Create Banner'), ['create'], ['class' => 'btn btn-success']) ?> | ||
20 | + </p> | ||
21 | + <?= GridView::widget([ | ||
22 | + 'dataProvider' => $dataProvider, | ||
23 | + 'filterModel' => $searchModel, | ||
24 | + 'columns' => [ | ||
25 | + ['class' => 'yii\grid\SerialColumn'], | ||
26 | + | ||
27 | + 'banner_id', | ||
28 | + 'image', | ||
29 | + 'alt', | ||
30 | + 'title', | ||
31 | + // 'url:url', | ||
32 | + // 'status', | ||
33 | + | ||
34 | + ['class' => 'yii\grid\ActionColumn'], | ||
35 | + ], | ||
36 | + ]); ?> | ||
37 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model common\models\Banner */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Banner', | ||
10 | +]) . $model->title; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->banner_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="banner-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Banner */ | ||
8 | + | ||
9 | +$this->title = $model->title; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Banners'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="banner-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->banner_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->banner_id], [ | ||
20 | + 'class' => 'btn btn-danger', | ||
21 | + 'data' => [ | ||
22 | + 'confirm' => Yii::t('app', '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 | + 'banner_id', | ||
32 | + 'image', | ||
33 | + 'alt', | ||
34 | + 'title', | ||
35 | + 'url:url', | ||
36 | + 'status', | ||
37 | + ], | ||
38 | + ]) ?> | ||
39 | + | ||
40 | +</div> |
@@ -35,6 +35,14 @@ use yii\widgets\Menu; | @@ -35,6 +35,14 @@ use yii\widgets\Menu; | ||
35 | ] | 35 | ] |
36 | ], | 36 | ], |
37 | [ | 37 | [ |
38 | + 'label' => 'Слайдер/Банеры', | ||
39 | + 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-barcode"></i> <span>{label}</span></a>', | ||
40 | + 'items' => [ | ||
41 | + ['label' => 'Слайдер', 'url' => ['/slider/index']], | ||
42 | + ['label' => 'Банер', 'url' => ['/banner/index']], | ||
43 | + ] | ||
44 | + ], | ||
45 | + [ | ||
38 | 'label' => 'Характеристики', | 46 | 'label' => 'Характеристики', |
39 | 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>', | 47 | 'template'=>'<a href="{url}"> <i class="glyphicon glyphicon-search"></i> <span>{label}</span></a>', |
40 | 'url' => ['/rubrication/tax-group'], | 48 | 'url' => ['/rubrication/tax-group'], |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | +use kartik\select2\Select2; | ||
6 | + | ||
7 | +/* @var $this yii\web\View */ | ||
8 | +/* @var $model common\models\Slider */ | ||
9 | +/* @var $form yii\widgets\ActiveForm */ | ||
10 | +?> | ||
11 | + | ||
12 | +<div class="slider-form"> | ||
13 | + | ||
14 | + <?php $form = ActiveForm::begin(); ?> | ||
15 | + | ||
16 | + <?= $form->field($model, 'speed')->textInput() ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'duration')->textInput() ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> | ||
21 | + | ||
22 | + | ||
23 | + <?= $form->field($model, 'width')->textInput(['maxlength' => true]) ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'height')->textInput(['maxlength' => true]) ?> | ||
26 | + | ||
27 | + | ||
28 | + <?= $form->field($model, 'status')->widget(Select2::className(),([ | ||
29 | + 'name' => 'status', | ||
30 | + 'hideSearch' => true, | ||
31 | + 'data' => [1 => 'Active', 2 => 'Inactive'], | ||
32 | + 'options' => ['placeholder' => 'Select status...'], | ||
33 | + 'pluginOptions' => [ | ||
34 | + 'allowClear' => true | ||
35 | + ] | ||
36 | + ])) ?> | ||
37 | + | ||
38 | + <div class="form-group"> | ||
39 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
40 | + </div> | ||
41 | + | ||
42 | + <?php ActiveForm::end(); ?> | ||
43 | + | ||
44 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\SliderSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="slider-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'slider_id') ?> | ||
19 | + | ||
20 | + | ||
21 | + <?= $form->field($model, 'speed') ?> | ||
22 | + | ||
23 | + <?= $form->field($model, 'duration') ?> | ||
24 | + | ||
25 | + <?= $form->field($model, 'title') ?> | ||
26 | + | ||
27 | + <?php // echo $form->field($model, 'status') ?> | ||
28 | + | ||
29 | + <div class="form-group"> | ||
30 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
31 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
32 | + </div> | ||
33 | + | ||
34 | + <?php ActiveForm::end(); ?> | ||
35 | + | ||
36 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Slider */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Slider'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Sliders'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="slider-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 common\models\SliderSearch */ | ||
9 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
10 | + | ||
11 | +$this->title = Yii::t('app', 'Sliders'); | ||
12 | +$this->params['breadcrumbs'][] = $this->title; | ||
13 | +?> | ||
14 | +<div class="slider-index"> | ||
15 | + | ||
16 | + <h1><?= Html::encode($this->title) ?></h1> | ||
17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
18 | + | ||
19 | + <p> | ||
20 | + <?= Html::a(Yii::t('app', 'Create Slider'), ['create'], ['class' => 'btn btn-success']) ?> | ||
21 | + </p> | ||
22 | + <?= GridView::widget([ | ||
23 | + 'dataProvider' => $dataProvider, | ||
24 | + 'filterModel' => $searchModel, | ||
25 | + 'columns' => [ | ||
26 | + [ | ||
27 | + 'attribute' => 'slider_id', | ||
28 | + 'value' => 'slider_id', | ||
29 | + 'contentOptions' => ['style' => 'width: 70px;'], | ||
30 | + ], | ||
31 | + [ | ||
32 | + 'attribute' => 'title', | ||
33 | + 'value' => 'title', | ||
34 | + ], | ||
35 | + | ||
36 | + [ | ||
37 | + 'attribute' => 'status', | ||
38 | + 'value' => function ($model) | ||
39 | + { | ||
40 | + return ($model->status == 0) ? 'Скрыто' : 'Показать'; | ||
41 | + }, | ||
42 | + ], | ||
43 | + [ | ||
44 | + 'class' => 'yii\grid\ActionColumn', | ||
45 | + 'template' => '{update} {image} {delete}', | ||
46 | + 'buttons' => [ | ||
47 | + 'update' => function ($url, $model) | ||
48 | + { | ||
49 | + return Html::a ( | ||
50 | + '<span class="glyphicon glyphicon-pencil"></span>', | ||
51 | + Url::toRoute(['slider/update', 'id' => $model->slider_id]), | ||
52 | + [ | ||
53 | + 'title' => "Редактировать", | ||
54 | + ] | ||
55 | + ); | ||
56 | + }, | ||
57 | + 'image' => function ($url, $model) | ||
58 | + { | ||
59 | + return Html::a ( | ||
60 | + '<span class="glyphicon glyphicon-picture"></span>', | ||
61 | + Url::toRoute(['slider-image/index', 'slider_id' => $model->slider_id]), | ||
62 | + [ | ||
63 | + 'title' => "слайды", | ||
64 | + ] | ||
65 | + ); | ||
66 | + }, | ||
67 | + 'delete' => function ($url, $model) | ||
68 | + { | ||
69 | + return Html::a ( | ||
70 | + '<span class="glyphicon glyphicon-trash"></span>', | ||
71 | + Url::toRoute(['slider/delete', 'id' => $model->slider_id]), | ||
72 | + [ | ||
73 | + 'title' => "Удалить", | ||
74 | + ] | ||
75 | + ); | ||
76 | + }, | ||
77 | + ], | ||
78 | + 'contentOptions' => ['style' => 'width: 70px;'], | ||
79 | + ], | ||
80 | + ], | ||
81 | + ]); ?> | ||
82 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model common\models\Slider */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Slider', | ||
10 | +]) . $model->title; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Sliders'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->slider_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="slider-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Slider */ | ||
8 | + | ||
9 | +$this->title = $model->title; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Sliders'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="slider-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->slider_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->slider_id], [ | ||
20 | + 'class' => 'btn btn-danger', | ||
21 | + 'data' => [ | ||
22 | + 'confirm' => Yii::t('app', '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 | + 'slider_id', | ||
32 | + 'speed', | ||
33 | + 'duration', | ||
34 | + 'title', | ||
35 | + 'status', | ||
36 | + ], | ||
37 | + ]) ?> | ||
38 | + | ||
39 | +</div> |
No preview for this file type
1 | +actor: Tester | ||
2 | +paths: | ||
3 | + tests: tests | ||
4 | + log: tests/_output | ||
5 | + data: tests/_data | ||
6 | + support: tests/_support | ||
7 | + envs: tests/_envs | ||
8 | +settings: | ||
9 | + bootstrap: _bootstrap.php | ||
10 | + colors: true | ||
11 | + memory_limit: 1024M | ||
12 | +extensions: | ||
13 | + enabled: | ||
14 | + - Codeception\Extension\RunFailed | ||
15 | +modules: | ||
16 | + config: | ||
17 | + Db: | ||
18 | + dsn: '' | ||
19 | + user: '' | ||
20 | + password: '' | ||
21 | + dump: tests/_data/dump.sql |
common/components/artboxtree/ArtboxTreeBehavior.php
100644 → 100755
common/components/artboxtree/ArtboxTreeHelper.php
100644 → 100755
common/components/artboxtree/ArtboxTreeQueryTrait.php
100644 → 100755
common/components/artboxtree/ArtboxTreeWidget.php
100644 → 100755
common/components/artboxtree/treegrid/TreeGridColumn.php
100644 → 100755
common/components/artboxtree/treegrid/TreeGridWidget.php
100644 → 100755
common/components/artboxtree/treelist/TreeListWidget.php
100644 → 100755
common/components/artboxtree/treemenu/TreeMenuWidget.php
100644 → 100755
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "banner". | ||
9 | + * | ||
10 | + * @property integer $banner_id | ||
11 | + * @property string $image | ||
12 | + * @property string $alt | ||
13 | + * @property string $title | ||
14 | + * @property string $url | ||
15 | + * @property integer $status | ||
16 | + * @property integer $width | ||
17 | + * @property integer $height | ||
18 | + */ | ||
19 | +class Banner extends \yii\db\ActiveRecord | ||
20 | +{ | ||
21 | + /** | ||
22 | + * @inheritdoc | ||
23 | + */ | ||
24 | + public static function tableName() | ||
25 | + { | ||
26 | + return 'banner'; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * @inheritdoc | ||
31 | + */ | ||
32 | + public function rules() | ||
33 | + { | ||
34 | + return [ | ||
35 | + [['status', 'width', 'height'], 'integer'], | ||
36 | + [['image', 'alt', 'title', 'url'], 'string', 'max' => 255], | ||
37 | + [['width', 'height'], 'required'], | ||
38 | + ['title', 'unique', 'targetClass' => '\common\models\Slider', 'message' => Yii::t('app','message',[ | ||
39 | + 'field' => 'Title' | ||
40 | + ])], | ||
41 | + ]; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * @inheritdoc | ||
46 | + */ | ||
47 | + public function attributeLabels() | ||
48 | + { | ||
49 | + return [ | ||
50 | + 'banner_id' => Yii::t('app', 'Banner ID'), | ||
51 | + 'image' => Yii::t('app', 'Image'), | ||
52 | + 'alt' => Yii::t('app', 'Alt'), | ||
53 | + 'title' => Yii::t('app', 'Title'), | ||
54 | + 'url' => Yii::t('app', 'Url'), | ||
55 | + 'status' => Yii::t('app', 'Status'), | ||
56 | + 'width' => Yii::t('app', 'Width'), | ||
57 | + 'height' => Yii::t('app', 'Height'), | ||
58 | + ]; | ||
59 | + } | ||
60 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | +use common\models\Banner; | ||
9 | + | ||
10 | +/** | ||
11 | + * BannerSearch represents the model behind the search form about `common\models\Banner`. | ||
12 | + */ | ||
13 | +class BannerSearch extends Banner | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['banner_id', 'status'], 'integer'], | ||
22 | + [['image', 'alt', 'title', 'url'], '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 = Banner::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 | + 'banner_id' => $this->banner_id, | ||
63 | + 'status' => $this->status, | ||
64 | + ]); | ||
65 | + | ||
66 | + $query->andFilterWhere(['like', 'image', $this->image]) | ||
67 | + ->andFilterWhere(['like', 'alt', $this->alt]) | ||
68 | + ->andFilterWhere(['like', 'title', $this->title]) | ||
69 | + ->andFilterWhere(['like', 'url', $this->url]); | ||
70 | + | ||
71 | + return $dataProvider; | ||
72 | + } | ||
73 | +} |