Commit 1ec3afef6710320492cbb9e9e37121576509ea85
1 parent
70eb26db
VItaliy 27.11.2015
Showing
24 changed files
with
172 additions
and
80 deletions
Show diff stats
.htaccess
backend/components/views/image_sizer.php
| ... | ... | @@ -90,8 +90,7 @@ $this->registerCssFile('@web/js/vendor/bower/jquery-file-upload/css/jquery.fileu |
| 90 | 90 | |
| 91 | 91 | <?= Html::activeHiddenInput( $model,$field,['id' => "{$field}_picture_link"]) ?> |
| 92 | 92 | |
| 93 | - <input type="hidden" name="ImageSizerForm[width]" value="<?=$width?>"/> | |
| 94 | - <input type="hidden" name="ImageSizerForm[height]" value="<?=$height?>"/> | |
| 93 | + | |
| 95 | 94 | <input type="hidden" name="ImageSizerForm[multi]" value="<?=$multi?>"/> |
| 96 | 95 | |
| 97 | 96 | <div id="<?= $field?>_img_block"> |
| ... | ... | @@ -107,6 +106,7 @@ $this->registerCssFile('@web/js/vendor/bower/jquery-file-upload/css/jquery.fileu |
| 107 | 106 | |
| 108 | 107 | $("#<?= $field?>").fileupload({ |
| 109 | 108 | dataType: 'json', |
| 109 | + formData: {width: <?=$width?>,height:<?=$height?>}, | |
| 110 | 110 | done: function (e, data) { |
| 111 | 111 | |
| 112 | 112 | var img = data.result.view; | ... | ... |
backend/controllers/EmailsController.php
backend/controllers/NewsController.php
| ... | ... | @@ -107,6 +107,16 @@ class NewsController extends BaseController |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
| 110 | + | |
| 111 | + if(isset($model['price_list']) && !empty($model['price_list'])){ | |
| 112 | + $price_list ='<div> | |
| 113 | + <img src="http://'.$_SERVER['SERVER_NAME'].'/images/ico_exel.png"> | |
| 114 | + <a href="'.'http://'.$_SERVER['SERVER_NAME'].$model['price_list'].'">Скачать список товаров</a> | |
| 115 | + </div>'; | |
| 116 | + }else { | |
| 117 | + $price_list = ''; | |
| 118 | + } | |
| 119 | + | |
| 110 | 120 | if (count($sEmails)>0) { |
| 111 | 121 | $fp = fopen('logs.txt', 'w'); |
| 112 | 122 | foreach ($sEmails as $mailing) { |
| ... | ... | @@ -116,7 +126,7 @@ class NewsController extends BaseController |
| 116 | 126 | $deny = $this->deny($deny_data); |
| 117 | 127 | unset($deny_data); |
| 118 | 128 | |
| 119 | - $data['data'] = $model['content']."<br><br>".$deny; | |
| 129 | + $data['data'] = $model['content']."<br>".$price_list."<br>".$deny; | |
| 120 | 130 | Emails::get('news',$data,$mailing); |
| 121 | 131 | fwrite($fp, $mailing); |
| 122 | 132 | ... | ... |
backend/controllers/PageController.php
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | namespace backend\controllers; |
| 4 | 4 | |
| 5 | +use backend\components\base\BaseController; | |
| 5 | 6 | use Yii; |
| 6 | 7 | use common\models\Page; |
| 7 | 8 | use common\models\PageSearch; |
| ... | ... | @@ -13,8 +14,12 @@ use yii\filters\AccessControl; |
| 13 | 14 | /** |
| 14 | 15 | * PageController implements the CRUD actions for Page model. |
| 15 | 16 | */ |
| 16 | -class PageController extends Controller | |
| 17 | +class PageController extends BaseController | |
| 17 | 18 | { |
| 19 | + | |
| 20 | + | |
| 21 | + public $layout = "/column"; | |
| 22 | + | |
| 18 | 23 | /** |
| 19 | 24 | * @inheritdoc |
| 20 | 25 | */ | ... | ... |
backend/controllers/PartnersController.php
backend/controllers/SliderController.php
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | namespace backend\controllers; |
| 4 | 4 | |
| 5 | +use backend\components\base\BaseController; | |
| 5 | 6 | use Yii; |
| 6 | 7 | use common\models\Slider; |
| 7 | 8 | use common\models\SliderSearch; |
| ... | ... | @@ -13,8 +14,10 @@ use yii\filters\AccessControl; |
| 13 | 14 | /** |
| 14 | 15 | * SliderController implements the CRUD actions for Slider model. |
| 15 | 16 | */ |
| 16 | -class SliderController extends Controller | |
| 17 | +class SliderController extends BaseController | |
| 17 | 18 | { |
| 19 | + | |
| 20 | + public $layout = "/column"; | |
| 18 | 21 | /** |
| 19 | 22 | * @inheritdoc |
| 20 | 23 | */ | ... | ... |
backend/views/layouts/column.php
| ... | ... | @@ -342,7 +342,6 @@ $this->beginContent('@app/views/layouts/main.php'); |
| 342 | 342 | ['label' => 'Текстовые страницы', 'url' => ['page/index']], |
| 343 | 343 | ['label' => 'Новости', 'url' => ['news/index']], |
| 344 | 344 | ['label' => 'Слайдер', 'url' => ['slider/index']], |
| 345 | - ['label' => 'Партнёры', 'url' => ['partners/index']], | |
| 346 | 345 | ], |
| 347 | 346 | ], |
| 348 | 347 | ['label' => 'Платежные системы', 'options'=>['class'=>'label_9'], 'url' => ['#'], 'items' => [ | ... | ... |
backend/views/news/index.php
| ... | ... | @@ -34,11 +34,29 @@ $this->params['breadcrumbs'][] = $this->title; |
| 34 | 34 | //'title', |
| 35 | 35 | //'kwords', |
| 36 | 36 | //'descr', |
| 37 | - | |
| 38 | - 'is_active', | |
| 37 | + [ | |
| 38 | + 'format' => 'raw', | |
| 39 | + 'filter' => [ | |
| 40 | + '1'=>'Отображаются', | |
| 41 | + '0'=>'Скрытые', | |
| 42 | + ], | |
| 43 | + 'value' => function($data){ | |
| 44 | + if($data->is_active){ | |
| 45 | + $status_img = '<i style="color: #008000" class="glyphicon glyphicon-ok"></i>'; | |
| 46 | + } else { | |
| 47 | + $status_img = '<i style="color: red" class="glyphicon glyphicon-remove"></i>'; | |
| 48 | + } | |
| 49 | + return $status_img; | |
| 50 | + }, | |
| 51 | + 'attribute'=>'is_active', | |
| 52 | + ], | |
| 39 | 53 | //'mail_send', |
| 40 | 54 | 'mails_count', |
| 41 | 55 | [ |
| 56 | + 'format' => 'image', | |
| 57 | + 'attribute'=>'img', | |
| 58 | + ], | |
| 59 | + [ | |
| 42 | 60 | 'label' =>'Дата', |
| 43 | 61 | 'value' =>function ($data) { |
| 44 | 62 | return date('Y-m-d', $data->dt); |
| ... | ... | @@ -56,7 +74,6 @@ $this->params['breadcrumbs'][] = $this->title; |
| 56 | 74 | 'attribute2' => 'date_to', |
| 57 | 75 | ]), |
| 58 | 76 | ], |
| 59 | - //'img', | |
| 60 | 77 | |
| 61 | 78 | ['class' => 'yii\grid\ActionColumn'], |
| 62 | 79 | ], | ... | ... |
backend/views/news/view.php
backend/views/page/_form.php
| ... | ... | @@ -2,7 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | use yii\helpers\Html; |
| 4 | 4 | use yii\widgets\ActiveForm; |
| 5 | - | |
| 5 | +use mihaildev\ckeditor\CKEditor; | |
| 6 | +use mihaildev\elfinder\ElFinder; | |
| 6 | 7 | /* @var $this yii\web\View */ |
| 7 | 8 | /* @var $model common\models\Page */ |
| 8 | 9 | /* @var $form yii\widgets\ActiveForm */ |
| ... | ... | @@ -16,7 +17,14 @@ use yii\widgets\ActiveForm; |
| 16 | 17 | |
| 17 | 18 | <?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?> |
| 18 | 19 | |
| 19 | - <?= $form->field($model, 'content')->textarea(['rows' => 6]) ?> | |
| 20 | + <?= $form->field($model, 'content')->widget(CKEditor::className(),[ | |
| 21 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | |
| 22 | + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать | |
| 23 | + 'inline' => false, //по умолчанию false]), | |
| 24 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('page/images-upload') | |
| 25 | + ] | |
| 26 | + ) | |
| 27 | + ]); ?> | |
| 20 | 28 | |
| 21 | 29 | <?= $form->field($model, 'sort')->textInput() ?> |
| 22 | 30 | |
| ... | ... | @@ -26,7 +34,7 @@ use yii\widgets\ActiveForm; |
| 26 | 34 | |
| 27 | 35 | <?= $form->field($model, 'descr')->textInput(['maxlength' => true]) ?> |
| 28 | 36 | |
| 29 | - <?= $form->field($model, 'is_active')->textInput() ?> | |
| 37 | + <?= $form->field($model, 'is_active')->checkbox() ?> | |
| 30 | 38 | |
| 31 | 39 | <div class="form-group"> |
| 32 | 40 | <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ... | ... |
backend/views/page/index.php
| ... | ... | @@ -25,15 +25,30 @@ $this->params['breadcrumbs'][] = $this->title; |
| 25 | 25 | 'columns' => [ |
| 26 | 26 | ['class' => 'yii\grid\SerialColumn'], |
| 27 | 27 | |
| 28 | - 'id', | |
| 28 | + //'id', | |
| 29 | 29 | 'name', |
| 30 | 30 | 'code', |
| 31 | - 'content:ntext', | |
| 31 | + //'content:ntext', | |
| 32 | 32 | 'sort', |
| 33 | 33 | // 'title', |
| 34 | 34 | // 'kwords', |
| 35 | 35 | // 'descr', |
| 36 | - // 'is_active', | |
| 36 | + [ | |
| 37 | + 'format' => 'raw', | |
| 38 | + 'filter' => [ | |
| 39 | + '1'=>'Отображаются', | |
| 40 | + '0'=>'Скрытые', | |
| 41 | + ], | |
| 42 | + 'value' => function($data){ | |
| 43 | + if($data->is_active){ | |
| 44 | + $status_img = '<i style="color: #008000" class="glyphicon glyphicon-ok"></i>'; | |
| 45 | + } else { | |
| 46 | + $status_img = '<i style="color: red" class="glyphicon glyphicon-remove"></i>'; | |
| 47 | + } | |
| 48 | + return $status_img; | |
| 49 | + }, | |
| 50 | + 'attribute'=>'is_active', | |
| 51 | + ], | |
| 37 | 52 | |
| 38 | 53 | ['class' => 'yii\grid\ActionColumn'], |
| 39 | 54 | ], | ... | ... |
backend/views/slider/_form.php
| ... | ... | @@ -14,11 +14,17 @@ use yii\widgets\ActiveForm; |
| 14 | 14 | |
| 15 | 15 | <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> |
| 16 | 16 | |
| 17 | - <?= $form->field($model, 'img')->textInput(['maxlength' => true]) ?> | |
| 17 | + <?= \backend\components\ImageUploader::widget([ | |
| 18 | + 'model'=> $model, | |
| 19 | + 'field'=>'img', | |
| 20 | + 'multi'=>false, | |
| 21 | + 'gallery' =>$model->img, | |
| 22 | + 'name' => 'Загрузить картинку' | |
| 23 | + ]); ?> | |
| 18 | 24 | |
| 19 | 25 | <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?> |
| 20 | 26 | |
| 21 | - <?= $form->field($model, 'is_active')->textInput() ?> | |
| 27 | + <?= $form->field($model, 'is_active')->checkbox() ?> | |
| 22 | 28 | |
| 23 | 29 | <?= $form->field($model, 'sort')->textInput() ?> |
| 24 | 30 | ... | ... |
backend/views/slider/index.php
| ... | ... | @@ -27,9 +27,32 @@ $this->params['breadcrumbs'][] = $this->title; |
| 27 | 27 | |
| 28 | 28 | 'id', |
| 29 | 29 | 'name', |
| 30 | - 'img', | |
| 31 | - 'url:url', | |
| 32 | - 'is_active', | |
| 30 | + [ | |
| 31 | + 'attribute'=>'img', | |
| 32 | + 'format' => 'raw', | |
| 33 | + 'value' => function($data){ | |
| 34 | + return Html::img(\yii\helpers\Url::to($data->img),[ | |
| 35 | + 'style' => 'width:200px;' | |
| 36 | + ]); | |
| 37 | + }, | |
| 38 | + ], | |
| 39 | + //'url:url', | |
| 40 | + [ | |
| 41 | + 'format' => 'raw', | |
| 42 | + 'filter' => [ | |
| 43 | + '1'=>'Отображаются', | |
| 44 | + '0'=>'Скрытые', | |
| 45 | + ], | |
| 46 | + 'value' => function($data){ | |
| 47 | + if($data->is_active){ | |
| 48 | + $status_img = '<i style="color: #008000" class="glyphicon glyphicon-ok"></i>'; | |
| 49 | + } else { | |
| 50 | + $status_img = '<i style="color: red" class="glyphicon glyphicon-remove"></i>'; | |
| 51 | + } | |
| 52 | + return $status_img; | |
| 53 | + }, | |
| 54 | + 'attribute'=>'is_active', | |
| 55 | + ], | |
| 33 | 56 | // 'sort', |
| 34 | 57 | |
| 35 | 58 | ['class' => 'yii\grid\ActionColumn'], | ... | ... |
backend/web/.htaccess deleted
common/models/Emails.php
| ... | ... | @@ -148,24 +148,25 @@ class Emails extends \yii\db\ActiveRecord |
| 148 | 148 | $letter = str_replace(array("../../../"),"http://".$_SERVER['SERVER_NAME']."/",$letter); |
| 149 | 149 | |
| 150 | 150 | $mail = new \PHPMailer(); |
| 151 | - | |
| 151 | + $mail->CharSet = "UTF-8"; | |
| 152 | 152 | $mail->From = $from; |
| 153 | - $mail->FromName = $from_name; | |
| 154 | - $mail->Subject = $subject; | |
| 153 | + $mail->FromName =$from_name; | |
| 154 | + $mail->Subject =$subject; | |
| 155 | 155 | $mail->MsgHTML($letter); |
| 156 | 156 | $fp = fopen("Emails_log.txt","w"); |
| 157 | 157 | fwrite($fp, $letter); |
| 158 | 158 | fclose($fp); |
| 159 | - $splitEmails = explode(",",$to); | |
| 160 | - if (count($splitEmails)>1){ | |
| 161 | - foreach ($splitEmails as $sEmail){ | |
| 162 | - $mail->AddAddress($sEmail); | |
| 163 | - | |
| 164 | - } | |
| 165 | - | |
| 166 | - } else { | |
| 167 | - $mail->AddAddress($to); | |
| 168 | - } | |
| 159 | + $mail->AddAddress($to); | |
| 160 | +// $splitEmails = explode(",",$to); | |
| 161 | +// if (count($splitEmails)>1){ | |
| 162 | +// foreach ($splitEmails as $sEmail){ | |
| 163 | +// $mail->AddAddress($sEmail); | |
| 164 | +// | |
| 165 | +// } | |
| 166 | +// | |
| 167 | +// } else { | |
| 168 | +// $mail->AddAddress($to); | |
| 169 | +// } | |
| 169 | 170 | |
| 170 | 171 | if ($captcha){ |
| 171 | 172 | if (md5($vars['code'])==$_SESSION['captcha_keystring']) { | ... | ... |
common/models/Page.php
| ... | ... | @@ -51,14 +51,14 @@ class Page extends \yii\db\ActiveRecord |
| 51 | 51 | { |
| 52 | 52 | return [ |
| 53 | 53 | 'id' => 'ID', |
| 54 | - 'name' => 'Name', | |
| 55 | - 'code' => 'Code', | |
| 56 | - 'content' => 'Content', | |
| 57 | - 'sort' => 'Sort', | |
| 58 | - 'title' => 'Title', | |
| 59 | - 'kwords' => 'Kwords', | |
| 60 | - 'descr' => 'Descr', | |
| 61 | - 'is_active' => 'Is Active', | |
| 54 | + 'name' => 'Название', | |
| 55 | + 'code' => 'Алиас', | |
| 56 | + 'content' => 'Содержание', | |
| 57 | + 'sort' => 'Сортировка', | |
| 58 | + 'title' => 'SEO: Title', | |
| 59 | + 'kwords' => 'SEO: Ключевые слова', | |
| 60 | + 'descr' => 'SEO: Описание', | |
| 61 | + 'is_active' => 'Выводить', | |
| 62 | 62 | ]; |
| 63 | 63 | } |
| 64 | 64 | } | ... | ... |
common/models/Slider.php
| ... | ... | @@ -44,11 +44,11 @@ class Slider extends \yii\db\ActiveRecord |
| 44 | 44 | { |
| 45 | 45 | return [ |
| 46 | 46 | 'id' => 'ID', |
| 47 | - 'name' => 'Name', | |
| 48 | - 'img' => 'Img', | |
| 49 | - 'url' => 'Url', | |
| 50 | - 'is_active' => 'Is Active', | |
| 51 | - 'sort' => 'Sort', | |
| 47 | + 'name' => 'Название', | |
| 48 | + 'img' => 'Изображение', | |
| 49 | + 'url' => 'Адрес перехода', | |
| 50 | + 'is_active' => 'Выводить', | |
| 51 | + 'sort' => 'Сортировка', | |
| 52 | 52 | ]; |
| 53 | 53 | } |
| 54 | 54 | } | ... | ... |
frontend/controllers/NewsController.php
| ... | ... | @@ -19,7 +19,7 @@ class NewsController extends Controller |
| 19 | 19 | public function actionIndex() |
| 20 | 20 | { |
| 21 | 21 | $dataProvider = new ActiveDataProvider([ |
| 22 | - 'query' => News::find(), | |
| 22 | + 'query' => News::find()->where(['is_active'=>1]), | |
| 23 | 23 | 'pagination' => [ |
| 24 | 24 | 'pageSize' => 16, |
| 25 | 25 | ], |
| ... | ... | @@ -32,8 +32,10 @@ class NewsController extends Controller |
| 32 | 32 | |
| 33 | 33 | public function actionView($translit) |
| 34 | 34 | { |
| 35 | + $news_list = News::find()->where(['is_active'=>1])->limit(3)->all(); | |
| 35 | 36 | return $this->render('view', [ |
| 36 | 37 | 'model' => $this->findModel($translit), |
| 38 | + 'news_list' => $news_list | |
| 37 | 39 | ]); |
| 38 | 40 | } |
| 39 | 41 | ... | ... |
frontend/controllers/SiteController.php
| ... | ... | @@ -3,6 +3,7 @@ namespace frontend\controllers; |
| 3 | 3 | |
| 4 | 4 | use common\models\Accounts; |
| 5 | 5 | use common\models\AccountsForm; |
| 6 | +use common\models\News; | |
| 6 | 7 | use common\models\Team; |
| 7 | 8 | use common\models\TeamGroup; |
| 8 | 9 | use Yii; |
| ... | ... | @@ -51,6 +52,8 @@ class SiteController extends Controller |
| 51 | 52 | { |
| 52 | 53 | $this->layout = '/outer'; |
| 53 | 54 | |
| 55 | + $news_list = News::find()->where(['is_active'=>1])->limit(3)->all(); | |
| 56 | + | |
| 54 | 57 | if (Yii::$app->request->post()) { |
| 55 | 58 | |
| 56 | 59 | $post = Yii::$app->request->post(); |
| ... | ... | @@ -64,7 +67,9 @@ class SiteController extends Controller |
| 64 | 67 | } |
| 65 | 68 | |
| 66 | 69 | } |
| 67 | - return $this->render('index'); | |
| 70 | + return $this->render('index',[ | |
| 71 | + 'news_list' => $news_list | |
| 72 | + ]); | |
| 68 | 73 | } |
| 69 | 74 | |
| 70 | 75 | public function actionNotFound() | ... | ... |
frontend/views/news/view.php
| 1 | 1 | <?php |
| 2 | - | |
| 2 | +use \yii\helpers\Html; | |
| 3 | 3 | $this->registerCssFile('/css/style/news_all.css'); |
| 4 | 4 | |
| 5 | 5 | $this->title = $model->name; |
| ... | ... | @@ -19,18 +19,12 @@ $this->params['breadcrumbs'][] = $this->title; |
| 19 | 19 | </div> |
| 20 | 20 | <div class='long_line'></div> |
| 21 | 21 | <div class="go_news"> |
| 22 | - <a href=""> | |
| 23 | - <div class="back_news"> | |
| 24 | - <p class='article'>Приход товара Mecarm</p> | |
| 25 | - <p class="short_news">На склад поступила очередная партия товара MecArm</p> | |
| 26 | - </div> | |
| 27 | - </a> | |
| 28 | - <a href=""> | |
| 29 | - <div class="next_news"> | |
| 30 | - <p class='article'>Приход товара Mecarm</p> | |
| 31 | - <p class="short_news">На склад поступила очередная партия товара MecArm</p> | |
| 32 | - </div> | |
| 33 | - </a> | |
| 22 | + <?php foreach ($news_list as $one_news):?> | |
| 23 | + <div class="back_news"> | |
| 24 | + <?= Html::a("<p class='article'>".$one_news->name."</p>",['news/view', 'translit' =>$one_news->code ]) ?> | |
| 25 | + <?= Html::a("<p class='short_news'>".$one_news->brief."</p>",['news/view', 'translit' =>$one_news->code ]) ?> | |
| 26 | + </div> | |
| 27 | + <?php endforeach; ?> | |
| 34 | 28 | </div> |
| 35 | 29 | </div> |
| 36 | 30 | <img src="/images/lonh_line.png" style="margin-top:-20px;opacity:0"> | ... | ... |
frontend/views/site/index.php
| ... | ... | @@ -581,6 +581,14 @@ use \yii\helpers\Html; |
| 581 | 581 | <span class="number_of">1/</span> |
| 582 | 582 | <span class="general_number">5</span> |
| 583 | 583 | <span><img src="/images/arrow_slider_go.png"></span> |
| 584 | + <?php foreach ($news_list as $one_news):?> | |
| 585 | + <div class="slider_tovars"> | |
| 586 | + <div class="tovar"> | |
| 587 | + <?= Html::img(\yii\helpers\Url::to($one_news->img)); ?> | |
| 588 | + <?= Html::a("<p class='article'>".$one_news->name."</p>",['news/view', 'translit' =>$one_news->code ]) ?> | |
| 589 | + </div> | |
| 590 | + </div> | |
| 591 | + <?php endforeach; ?> | |
| 584 | 592 | <div class="slider_tovars"> |
| 585 | 593 | <div class="tovar"> |
| 586 | 594 | <img src="/images/news.png"> | ... | ... |