Commit e608c5f77d195326adb51a8c361d268a849ce8fb

Authored by Yarik
1 parent a4d63ed9

Comment added

Showing 44 changed files with 3890 additions and 2391 deletions   Show diff stats
common/config/main.php
... ... @@ -2,7 +2,11 @@
2 2 return [
3 3 'language' => 'ru',
4 4 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
5   -
  5 + 'controllerMap' => [
  6 + 'artbox-comment' => [
  7 + 'class' => \common\modules\comment\Controller::className(),
  8 + ],
  9 + ],
6 10 'components' => [
7 11 'assetManager' => [
8 12 'bundles' => [
... ... @@ -349,46 +353,46 @@ return [
349 353 ]*/
350 354 ]
351 355 ],
352   -// 'comment' => [
353   -// 'class' => 'common\modules\comment\Module',
354   -// 'useRbac' => true,
355   -// 'rbac' => [
356   -// 'rules' => [
357   -// \common\modules\comment\rbac\ArtboxCommentCreateRule::className(),
358   -// \common\modules\comment\rbac\ArtboxCommentDeleteRule::className(),
359   -// \common\modules\comment\rbac\ArtboxCommentUpdateRule::className(),
360   -// \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule::className(),
361   -// \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule::className(),
362   -// ],
363   -// 'permissions' => [
364   -// [
365   -// 'name' => common\modules\comment\Permissions::CREATE,
366   -// 'description' => 'Can create comments',
367   -// 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentCreateRule())->name,
368   -// ],
369   -// [
370   -// 'name' => common\modules\comment\Permissions::UPDATE,
371   -// 'description' => 'Can update comments',
372   -// 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateRule())->name,
373   -// ],
374   -// [
375   -// 'name' => common\modules\comment\Permissions::DELETE,
376   -// 'description' => 'Can delete comments',
377   -// 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteRule())->name,
378   -// ],
379   -// [
380   -// 'name' => common\modules\comment\Permissions::UPDATE_OWN,
381   -// 'description' => 'Can update own comments',
382   -// 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule())->name,
383   -// ],
384   -// [
385   -// 'name' => common\modules\comment\Permissions::DELETE_OWN,
386   -// 'description' => 'Can delete own comments',
387   -// 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule())->name,
388   -// ],
389   -// ],
390   -// ],
391   -//
392   -// ],
  356 + 'comment' => [
  357 + 'class' => 'common\modules\comment\Module',
  358 + 'useRbac' => false,
  359 + 'rbac' => [
  360 + 'rules' => [
  361 + \common\modules\comment\rbac\ArtboxCommentCreateRule::className(),
  362 + \common\modules\comment\rbac\ArtboxCommentDeleteRule::className(),
  363 + \common\modules\comment\rbac\ArtboxCommentUpdateRule::className(),
  364 + \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule::className(),
  365 + \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule::className(),
  366 + ],
  367 + 'permissions' => [
  368 + [
  369 + 'name' => common\modules\comment\Permissions::CREATE,
  370 + 'description' => 'Can create comments',
  371 + 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentCreateRule())->name,
  372 + ],
  373 + [
  374 + 'name' => common\modules\comment\Permissions::UPDATE,
  375 + 'description' => 'Can update comments',
  376 + 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateRule())->name,
  377 + ],
  378 + [
  379 + 'name' => common\modules\comment\Permissions::DELETE,
  380 + 'description' => 'Can delete comments',
  381 + 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteRule())->name,
  382 + ],
  383 + [
  384 + 'name' => common\modules\comment\Permissions::UPDATE_OWN,
  385 + 'description' => 'Can update own comments',
  386 + 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule())->name,
  387 + ],
  388 + [
  389 + 'name' => common\modules\comment\Permissions::DELETE_OWN,
  390 + 'description' => 'Can delete own comments',
  391 + 'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule())->name,
  392 + ],
  393 + ],
  394 + ],
  395 +
  396 + ],
393 397 ],
394 398 ];
... ...
common/models/ProductToRating.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use common\modules\product\models\Product;
  6 +use Yii;
  7 +
  8 +/**
  9 + * This is the model class for table "product_to_rating".
  10 + *
  11 + * @property integer $product_to_rating_id
  12 + * @property integer $product_id
  13 + * @property double $value
  14 + *
  15 + * @property Product $product
  16 + */
  17 +class ProductToRating extends \yii\db\ActiveRecord
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public static function tableName()
  23 + {
  24 + return 'product_to_rating';
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function rules()
  31 + {
  32 + return [
  33 + [['product_id'], 'required'],
  34 + [['product_id'], 'integer'],
  35 + [['value'], 'number', 'min' => 0],
  36 + [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']],
  37 + ];
  38 + }
  39 +
  40 + /**
  41 + * @inheritdoc
  42 + */
  43 + public function attributeLabels()
  44 + {
  45 + return [
  46 + 'product_to_rating_id' => 'Product To Rating ID',
  47 + 'product_id' => 'Product ID',
  48 + 'value' => 'Value',
  49 + ];
  50 + }
  51 +
  52 + /**
  53 + * @return \yii\db\ActiveQuery
  54 + */
  55 + public function getProduct()
  56 + {
  57 + return $this->hasOne(Product::className(), ['product_id' => 'product_id']);
  58 + }
  59 +}
... ...
common/modules/comment/Controller.php
1   -<?php
2   - namespace common\modules\comment;
3   -
4   - class Controller extends \yii\web\Controller
5   - {
6   - public function behaviors()
7   - {
8   - return [
9   - 'verbs' => [
10   - 'class' => \yii\filters\VerbFilter::className(),
11   - 'actions' => [
12   - '*' => ['post'],
13   - ],
14   - ],
15   - ];
16   - }
17   -
18   - public function actionDelete()
19   - {
20   - \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
21   - $post = \Yii::$app->request->post('Comment');
22   - if(!empty($post['comment_id'])) {
23   - if($model = \common\modules\comment\models\Comment::findOne($post['comment_id'])) {
24   - /**
25   - * @var \common\modules\comment\models\Comment $model
26   - */
27   - $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
28   - if($model->deleteComment()) {
29   - \Yii::$app->response->data = ['text' => 'Comment marked as deleted and will be check by administrators'];
30   - } else {
31   - \Yii::$app->response->data = ['error' => $model->hasErrors('comment_id')?$model->getFirstError('comment_id'):'Cannot delete message'];
32   - }
33   - }else {
34   - \Yii::$app->response->data = ['error' => 'Comment not found'];
35   - };
36   - } else {
37   - \Yii::$app->response->data = ['error' => 'Missing comment_id'];
38   - }
39   - \Yii::$app->response->send();
40   - }
41   -
42   - public function actionUpdate()
43   - {
44   - \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
45   - $post = \Yii::$app->request->post();
46   - if(!empty($post['Comment']['comment_id'])) {
47   - if($model = \common\modules\comment\models\Comment::findOne($post['Comment']['comment_id'])) {
48   - /**
49   - * @var \common\modules\comment\models\Comment $model
50   - */
51   - $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
52   - $model->load($post);
53   - if(empty($post['Comment']['comment_pid'])) {
54   - $model->comment_pid = null;
55   - }
56   - if($model->updateComment()) {
57   - \Yii::$app->response->data = ['text' => 'Comment successfully updated'];
58   - } else {
59   - \Yii::$app->response->data = ['error' => $model->hasErrors()?$model->getFirstErrors():'Cannot update message'];
60   - }
61   - }else {
62   - \Yii::$app->response->data = ['error' => 'Comment not found'];
63   - };
64   - } else {
65   - \Yii::$app->response->data = ['error' => 'Missing comment_id'];
66   - }
67   - \Yii::$app->response->send();
68   - }
69   -
70   - public function actionForm()
71   - {
72   - $post = \Yii::$app->request->post('Comment');
73   - if(!empty($post['comment_id'])) {
74   - $model = \common\modules\comment\models\Comment::find()->where(['comment_id' => $post['comment_id']])->with('parent', 'author')->one();
75   - if($model) {
76   - /**
77   - * @var \common\modules\comment\models\Comment $model
78   - */
79   - $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
80   - if($model->checkUpdate()) {
81   - return $this->renderAjax('@common/modules/comment/views/comment_form', [
82   - 'model' => $model,
83   - ]);
84   - } else {
85   - \Yii::$app->response->data = ['error' => 'You are not able to update this comment'];
86   - }
87   - }else {
88   - \Yii::$app->response->data = ['error' => 'Comment not found'];
89   - };
90   - } else {
91   - \Yii::$app->response->data = ['error' => 'Missing comment_id'];
92   - }
93   - \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
94   - \Yii::$app->response->send();
95   - }
96   -
  1 +<?php
  2 + namespace common\modules\comment;
  3 +
  4 + class Controller extends \yii\web\Controller
  5 + {
  6 +
  7 + public $enableCsrfValidation = false;
  8 +
  9 + public function behaviors()
  10 + {
  11 + return [
  12 + 'verbs' => [
  13 + 'class' => \yii\filters\VerbFilter::className(),
  14 + 'actions' => [
  15 + '*' => [ 'post' ],
  16 + ],
  17 + ],
  18 + ];
  19 + }
  20 +
  21 + public function actionDelete()
  22 + {
  23 + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  24 + $post = \Yii::$app->request->post('Comment');
  25 + $get = \Yii::$app->request->get();
  26 + if(empty( $post[ 'comment_id' ] ) && !empty( $get[ 'comment_id' ] )) {
  27 + $post[ 'comment_id' ] = $get[ 'comment_id' ];
  28 + }
  29 + if(!empty( $post[ 'comment_id' ] )) {
  30 + if($model = \common\modules\comment\models\Comment::findOne($post[ 'comment_id' ])) {
  31 + /**
  32 + * @var \common\modules\comment\models\Comment $model
  33 + */
  34 + $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
  35 + if($model->deleteComment()) {
  36 + \Yii::$app->response->data = [ 'text' => 'Comment marked as deleted and will be check by administrators' ];
  37 + } else {
  38 + \Yii::$app->response->data = [ 'error' => $model->hasErrors('comment_id') ? $model->getFirstError('comment_id') : 'Cannot delete message' ];
  39 + }
  40 + } else {
  41 + \Yii::$app->response->data = [ 'error' => 'Comment not found' ];
  42 + };
  43 + } else {
  44 + \Yii::$app->response->data = [ 'error' => 'Missing comment_id' ];
  45 + }
  46 + \Yii::$app->response->send();
  47 + }
  48 +
  49 + public function actionUpdate()
  50 + {
  51 + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  52 + $post = \Yii::$app->request->post();
  53 + if(!empty( $post[ 'Comment' ][ 'comment_id' ] )) {
  54 + if($model = \common\modules\comment\models\Comment::findOne($post[ 'Comment' ][ 'comment_id' ])) {
  55 + /**
  56 + * @var \common\modules\comment\models\Comment $model
  57 + */
  58 + $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
  59 + $model->load($post);
  60 + if(empty( $post[ 'Comment' ][ 'comment_pid' ] )) {
  61 + $model->comment_pid = NULL;
  62 + }
  63 + if($model->updateComment()) {
  64 + $model->rating->load($post);
  65 + if($model->rating->save()) {
  66 + return [
  67 + 'result' => [
  68 + 'text' => 'Comment successfully updated',
  69 + 'html' => $this->renderAjax('@common/modules/comment/widgets/views/_review_comment_view', [ 'model' => $model ]),
  70 + ],
  71 + ];
  72 + } else {
  73 + return [
  74 + 'error' => $model->hasErrors() ? $model->getFirstErrors() : 'Cannot update message',
  75 + 'form' => $this->renderAjax('@common/modules/comment/widgets/views/form-comment-review', [
  76 + 'model' => $model,
  77 + ]),
  78 + ];
  79 + }
  80 + } else {
  81 + return [
  82 + 'error' => $model->hasErrors() ? $model->getFirstErrors() : 'Cannot update message',
  83 + 'form' => $this->renderAjax('@common/modules/comment/widgets/views/form-comment-review', [
  84 + 'model' => $model,
  85 + ]),
  86 + ];
  87 + }
  88 + } else {
  89 + return [ 'error' => 'Comment not found' ];
  90 + }
  91 + } else {
  92 + return [ 'error' => 'Missing comment_id' ];
  93 + }
  94 + }
  95 +
  96 + public function actionForm()
  97 + {
  98 + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  99 + $post = \Yii::$app->request->post('Comment');
  100 + if(!empty( $post[ 'comment_id' ] )) {
  101 + $model = \common\modules\comment\models\Comment::find()
  102 + ->where([ 'comment_id' => $post[ 'comment_id' ] ])
  103 + ->with('parent', 'user')
  104 + ->one();
  105 + if($model) {
  106 + /**
  107 + * @var \common\modules\comment\models\Comment $model
  108 + */
  109 + $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST;
  110 + if($model->checkUpdate()) {
  111 + return [
  112 + 'result' => [
  113 + 'form' => $this->renderAjax('@common/modules/comment/widgets/views/form-comment-review', [
  114 + 'model' => $model,
  115 + ]),
  116 + ],
  117 + ];
  118 + } else {
  119 + return [ 'error' => 'You are not able to update this comment' ];
  120 + }
  121 + } else {
  122 + return [ 'error' => 'Comment not found' ];
  123 + }
  124 + } else {
  125 + return [ 'error' => 'Missing comment_id' ];
  126 + }
  127 + }
  128 +
  129 + public function actionUpdateAnswer()
  130 + {
  131 + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  132 + $post = \Yii::$app->request->post();
  133 + if(!empty( $post[ 'CommentProjectAnswer' ][ 'comment_id' ] )) {
  134 + if($model = \common\modules\comment\models\CommentProjectAnswer::findOne($post[ 'CommentProjectAnswer' ][ 'comment_id' ])) {
  135 + /**
  136 + * @var \common\modules\comment\models\CommentProjectAnswer $model
  137 + */
  138 + $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\CommentProjectAnswer::SCENARIO_USER : \common\modules\comment\models\CommentProjectAnswer::SCENARIO_GUEST;
  139 + $model->load($post);
  140 + if(empty( $post[ 'CommentProjectAnswer' ][ 'comment_pid' ] )) {
  141 + $model->comment_pid = NULL;
  142 + }
  143 + if($model->updateComment()) {
  144 + $model->rating->load($post);
  145 + if($model->rating->save()) {
  146 + return [
  147 + 'result' => [
  148 + 'text' => 'Comment successfully updated',
  149 + 'html' => $this->renderAjax('@common/modules/comment/widgets/views/_question_comment_view', [ 'model' => $model ]),
  150 + ],
  151 + ];
  152 + } else {
  153 + return [
  154 + 'error' => $model->hasErrors() ? $model->getFirstErrors() : 'Cannot update message',
  155 + 'form' => $this->renderAjax('@common/modules/comment/widgets/views/form-comment-answer', [
  156 + 'model' => $model,
  157 + ]),
  158 + ];
  159 + }
  160 + } else {
  161 + return [
  162 + 'error' => $model->hasErrors() ? $model->getFirstErrors() : 'Cannot update message',
  163 + 'form' => $this->renderAjax('@common/modules/comment/widgets/views/form-comment-answer', [
  164 + 'model' => $model,
  165 + ]),
  166 + ];
  167 + }
  168 + } else {
  169 + return [ 'error' => 'Comment not found' ];
  170 + }
  171 + } else {
  172 + return [ 'error' => 'Missing comment_id' ];
  173 + }
  174 + }
  175 +
  176 + public function actionFormAnswer()
  177 + {
  178 + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  179 + $post = \Yii::$app->request->post('CommentProjectAnswer');
  180 + if(!empty( $post[ 'comment_id' ] )) {
  181 + $model = \common\modules\comment\models\CommentProjectAnswer::find()
  182 + ->where([ 'comment_id' => $post[ 'comment_id' ] ])
  183 + ->with('parent', 'user')
  184 + ->one();
  185 + if($model) {
  186 + /**
  187 + * @var \common\modules\comment\models\CommentProjectAnswer $model
  188 + */
  189 + $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\CommentProjectAnswer::SCENARIO_USER : \common\modules\comment\models\CommentProjectAnswer::SCENARIO_GUEST;
  190 + if($model->checkUpdate()) {
  191 + return [
  192 + 'result' => [
  193 + 'form' => $this->renderAjax('@common/modules/comment/widgets/views/form-comment-answer', [
  194 + 'model' => $model,
  195 + ]),
  196 + ],
  197 + ];
  198 + } else {
  199 + return [ 'error' => 'You are not able to update this comment' ];
  200 + }
  201 + } else {
  202 + return [ 'error' => 'Comment not found' ];
  203 + }
  204 + } else {
  205 + return [ 'error' => 'Missing comment_id' ];
  206 + }
  207 + }
  208 +
  209 + public function actionDeleteAnswer()
  210 + {
  211 + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
  212 + $post = \Yii::$app->request->post('CommentProjectAnswer');
  213 + $get = \Yii::$app->request->get();
  214 + if(empty( $post[ 'comment_id' ] ) && !empty( $get[ 'comment_id' ] )) {
  215 + $post[ 'comment_id' ] = $get[ 'comment_id' ];
  216 + }
  217 + if(!empty( $post[ 'comment_id' ] )) {
  218 + if($model = \common\modules\comment\models\CommentProjectAnswer::findOne($post[ 'comment_id' ])) {
  219 + /**
  220 + * @var \common\modules\comment\models\Comment $model
  221 + */
  222 + $model->scenario = is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\CommentProjectAnswer::SCENARIO_USER : \common\modules\comment\models\CommentProjectAnswer::SCENARIO_GUEST;
  223 + if($model->deleteComment()) {
  224 + \Yii::$app->response->data = [ 'text' => 'Comment marked as deleted and will be check by administrators' ];
  225 + } else {
  226 + \Yii::$app->response->data = [ 'error' => $model->hasErrors('comment_id') ? $model->getFirstError('comment_id') : 'Cannot delete message' ];
  227 + }
  228 + } else {
  229 + \Yii::$app->response->data = [ 'error' => 'Comment not found' ];
  230 + };
  231 + } else {
  232 + \Yii::$app->response->data = [ 'error' => 'Missing comment_id' ];
  233 + }
  234 + \Yii::$app->response->send();
  235 + }
  236 +
97 237 }
98 238 \ No newline at end of file
... ...
common/modules/comment/Module.php
1   -<?php
2   - namespace common\modules\comment;
3   -
4   - /**
5   - * Class Module
6   - * @package common\modules\comment
7   - */
8   - class Module extends \yii\base\Module
9   - {
10   -
11   - /**
12   - * @var string Module name
13   - */
14   - public static $moduleName = 'artbox_comment';
15   -
16   - /**
17   - * @var bool Wheather to use Rbac system
18   - * @link http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#rbac
19   - * @see \yii\rbac\ManagerInterface
20   - */
21   - public $useRbac = false;
22   -
23   - /**
24   - * Array of RBAC rules and permissions that can be used by install command.
25   - *
26   - * Currently supports associative array, of such view:
27   - *
28   - * <code>
29   - * [
30   - * 'rules' => [
31   - * \full\namapaced\ClassName,
32   - * \another\one\ClassName,
33   - * ],
34   - * 'permissions' => [
35   - * [
36   - * 'name' => stringName,
37   - * 'description' => descriptionText,
38   - * 'ruleName' => (new \full\namespaced\ClassName())->name (optional)
39   - * ],
40   - * [
41   - * 'name' => stringName2,
42   - * 'description' => descriptionText2,
43   - * 'ruleName' => (new \another\one\ClassName())->name (optional)
44   - * ],
45   - * ]
46   - * ]
47   - * </code>
48   - *
49   - * @var array
50   - * @see \common\modules\comment\commands\RbacController
51   - */
52   - public $rbac = [];
53   -
54   - /**
55   - * @var \yii\db\Connection Connection to the db
56   - */
57   - public $db = null;
58   -
59   - /**
60   - * @inheritdoc
61   - */
62   - public function init()
63   - {
64   - parent::init();
65   - if(\Yii::$app instanceof \yii\console\Application) {
66   - $this->controllerNamespace = 'common\modules\comment\commands';
67   - }
68   - if($this->db === null) {
69   - $this->db = \Yii::$app->db;
70   - } elseif(!$this->db instanceof \yii\db\Connection) {
71   - throw new \yii\base\InvalidConfigException('ะšะพะฝั„ะธะณ db ะพะฑัะทะฐะฝ ะฝะฐัะปะตะดะพะฒะฐั‚ัŒัั ะพั‚'.\yii\db\Connection::className());
72   - }
73   - }
  1 +<?php
  2 + namespace common\modules\comment;
  3 +
  4 + /**
  5 + * Class Module
  6 + * @package common\modules\comment
  7 + */
  8 + class Module extends \yii\base\Module
  9 + {
  10 +
  11 + /**
  12 + * @var string Module name
  13 + */
  14 + public static $moduleName = 'artbox_comment';
  15 +
  16 + /**
  17 + * @var bool Wheather to use Rbac system
  18 + * @link http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#rbac
  19 + * @see \yii\rbac\ManagerInterface
  20 + */
  21 + public $useRbac = false;
  22 +
  23 + /**
  24 + * Array of RBAC rules and permissions that can be used by install command.
  25 + *
  26 + * Currently supports associative array, of such view:
  27 + *
  28 + * <code>
  29 + * [
  30 + * 'rules' => [
  31 + * \full\namapaced\ClassName,
  32 + * \another\one\ClassName,
  33 + * ],
  34 + * 'permissions' => [
  35 + * [
  36 + * 'name' => stringName,
  37 + * 'description' => descriptionText,
  38 + * 'ruleName' => (new \full\namespaced\ClassName())->name (optional)
  39 + * ],
  40 + * [
  41 + * 'name' => stringName2,
  42 + * 'description' => descriptionText2,
  43 + * 'ruleName' => (new \another\one\ClassName())->name (optional)
  44 + * ],
  45 + * ]
  46 + * ]
  47 + * </code>
  48 + *
  49 + * @var array
  50 + * @see \common\modules\comment\commands\RbacController
  51 + */
  52 + public $rbac = [];
  53 +
  54 + /**
  55 + * @var \yii\db\Connection Connection to the db
  56 + */
  57 + public $db = null;
  58 +
  59 + /**
  60 + * @inheritdoc
  61 + */
  62 + public function init()
  63 + {
  64 + parent::init();
  65 + if(\Yii::$app instanceof \yii\console\Application) {
  66 + $this->controllerNamespace = 'common\modules\comment\commands';
  67 + }
  68 + if($this->db === null) {
  69 + $this->db = \Yii::$app->db;
  70 + } elseif(!$this->db instanceof \yii\db\Connection) {
  71 + throw new \yii\base\InvalidConfigException('ะšะพะฝั„ะธะณ db ะพะฑัะทะฐะฝ ะฝะฐัะปะตะดะพะฒะฐั‚ัŒัั ะพั‚'.\yii\db\Connection::className());
  72 + }
  73 + }
74 74 }
75 75 \ No newline at end of file
... ...
common/modules/comment/Permissions.php
1   -<?php
2   - namespace common\modules\comment;
3   -
4   - class Permissions
5   - {
6   -
7   - const CREATE = 'artbox_comment.create';
8   - const UPDATE = 'artbox_comment.update';
9   - const DELETE = 'artbox_comment.delete';
10   - const UPDATE_OWN = 'artbox_comment.update_own';
11   - const DELETE_OWN = 'artbox_comment.delete_own';
  1 +<?php
  2 + namespace common\modules\comment;
  3 +
  4 + class Permissions
  5 + {
  6 +
  7 + const CREATE = 'artbox_comment.create';
  8 + const UPDATE = 'artbox_comment.update';
  9 + const DELETE = 'artbox_comment.delete';
  10 + const UPDATE_OWN = 'artbox_comment.update_own';
  11 + const DELETE_OWN = 'artbox_comment.delete_own';
12 12 }
13 13 \ No newline at end of file
... ...
common/modules/comment/assets/CommentAsset.php
1   -<?php
2   - namespace common\modules\comment\assets;
3   -
4   - class CommentAsset extends \yii\web\AssetBundle
5   - {
6   -
7   - public $sourcePath = '@common/modules/comment/resources';
8   -
9   - public $css = [
10   - 'comment.css',
11   - ];
12   -
13   - public $js = [
14   - 'comment.js',
15   - ];
16   -
17   - public $depends = [
18   - '\yii\web\YiiAsset',
19   - '\yii\web\JqueryAsset',
20   - ];
21   -
22   - public $jsOptions = [
23   - 'position' => \yii\web\View::POS_READY,
24   - ];
25   -
  1 +<?php
  2 + namespace common\modules\comment\assets;
  3 +
  4 + class CommentAsset extends \yii\web\AssetBundle
  5 + {
  6 +
  7 + public $sourcePath = '@common/modules/comment/resources';
  8 +
  9 + public $css = [
  10 + 'comment.css',
  11 + ];
  12 +
  13 + public $js = [
  14 + 'comment.js',
  15 + ];
  16 +
  17 + public $depends = [
  18 + '\yii\web\YiiAsset',
  19 + '\yii\web\JqueryAsset',
  20 + ];
  21 +
  22 + public $jsOptions = [
  23 + 'position' => \yii\web\View::POS_HEAD,
  24 + ];
  25 +
26 26 }
27 27 \ No newline at end of file
... ...
common/modules/comment/commands/RbacController.php
1   -<?php
2   - namespace common\modules\comment\commands;
3   -
4   - class RbacController extends \yii\console\Controller
5   - {
6   -
7   - public function actionInstall()
8   - {
9   - /**
10   - * @var \common\modules\comment\Module $module
11   - */
12   - $module = \Yii::$app->controller->module;
13   - if(!$module->useRbac) {
14   - throw new \yii\base\InvalidConfigException('Please set useRbac config to TRUE in your module configs');
15   - }
16   - $auth = \Yii::$app->getAuthManager();
17   - if(!$auth instanceof \yii\rbac\ManagerInterface) {
18   - throw new \yii\base\InvalidConfigException('ManagerInterface is not configured');
19   - }
20   - if(!empty($module->rbac['rules'])) {
21   - foreach($module->rbac['rules'] as $rule) {
22   - $rule_model = new $rule();
23   - echo "Creating rule: ".$rule_model->name."\n";
24   - if($auth->add($rule_model)) {
25   - echo "Successful\n";
26   - } else {
27   - echo "Failed\n";
28   - }
29   - unset($rule_model);
30   - }
31   - }
32   - if(!empty($module->rbac['permissions'])) {
33   - foreach($module->rbac['permissions'] as $permission) {
34   - echo "Creating permission: ".$permission['name']."\n";
35   - if($auth->add(new \yii\rbac\Permission($permission))) {
36   - echo "Successful\n";
37   - } else {
38   - echo "Failed\n";
39   - }
40   - }
41   - }
42   - }
43   -
44   - public function actionUninstall()
45   - {
46   - /**
47   - * @var \common\modules\comment\Module $module
48   - */
49   - $module = \Yii::$app->controller->module;
50   - if(!$module->useRbac) {
51   - throw new \yii\base\InvalidConfigException('Please set useRbac config to TRUE in your module configs');
52   - }
53   - $auth = \Yii::$app->getAuthManager();
54   - if(!$auth instanceof \yii\rbac\ManagerInterface) {
55   - throw new \yii\base\InvalidConfigException('ManagerInterface is not configured');
56   - }
57   - if(!empty($module->rbac['rules'])) {
58   - foreach($module->rbac['rules'] as $rule) {
59   - $rule_model = new $rule();
60   - echo "Removing rule: ".$rule_model->name."\n";
61   - if($auth->remove($rule_model)) {
62   - echo "Successful\n";
63   - } else {
64   - echo "Failed\n";
65   - }
66   - unset($rule_model);
67   - }
68   - }
69   - if(!empty($module->rbac['permissions'])) {
70   - foreach($module->rbac['permissions'] as $permission) {
71   - echo "Removing permission: ".$permission['name']."\n";
72   - if($auth->remove(new \yii\rbac\Permission($permission))) {
73   - echo "Successful\n";
74   - } else {
75   - echo "Failed\n";
76   - }
77   - }
78   - }
79   - }
80   -
  1 +<?php
  2 + namespace common\modules\comment\commands;
  3 +
  4 + class RbacController extends \yii\console\Controller
  5 + {
  6 +
  7 + public function actionInstall()
  8 + {
  9 + /**
  10 + * @var \common\modules\comment\Module $module
  11 + */
  12 + $module = \Yii::$app->controller->module;
  13 + if(!$module->useRbac) {
  14 + throw new \yii\base\InvalidConfigException('Please set useRbac config to TRUE in your module configs');
  15 + }
  16 + $auth = \Yii::$app->getAuthManager();
  17 + if(!$auth instanceof \yii\rbac\ManagerInterface) {
  18 + throw new \yii\base\InvalidConfigException('ManagerInterface is not configured');
  19 + }
  20 + if(!empty($module->rbac['rules'])) {
  21 + foreach($module->rbac['rules'] as $rule) {
  22 + $rule_model = new $rule();
  23 + echo "Creating rule: ".$rule_model->name."\n";
  24 + if($auth->add($rule_model)) {
  25 + echo "Successful\n";
  26 + } else {
  27 + echo "Failed\n";
  28 + }
  29 + unset($rule_model);
  30 + }
  31 + }
  32 + if(!empty($module->rbac['permissions'])) {
  33 + foreach($module->rbac['permissions'] as $permission) {
  34 + echo "Creating permission: ".$permission['name']."\n";
  35 + if($auth->add(new \yii\rbac\Permission($permission))) {
  36 + echo "Successful\n";
  37 + } else {
  38 + echo "Failed\n";
  39 + }
  40 + }
  41 + }
  42 + }
  43 +
  44 + public function actionUninstall()
  45 + {
  46 + /**
  47 + * @var \common\modules\comment\Module $module
  48 + */
  49 + $module = \Yii::$app->controller->module;
  50 + if(!$module->useRbac) {
  51 + throw new \yii\base\InvalidConfigException('Please set useRbac config to TRUE in your module configs');
  52 + }
  53 + $auth = \Yii::$app->getAuthManager();
  54 + if(!$auth instanceof \yii\rbac\ManagerInterface) {
  55 + throw new \yii\base\InvalidConfigException('ManagerInterface is not configured');
  56 + }
  57 + if(!empty($module->rbac['rules'])) {
  58 + foreach($module->rbac['rules'] as $rule) {
  59 + $rule_model = new $rule();
  60 + echo "Removing rule: ".$rule_model->name."\n";
  61 + if($auth->remove($rule_model)) {
  62 + echo "Successful\n";
  63 + } else {
  64 + echo "Failed\n";
  65 + }
  66 + unset($rule_model);
  67 + }
  68 + }
  69 + if(!empty($module->rbac['permissions'])) {
  70 + foreach($module->rbac['permissions'] as $permission) {
  71 + echo "Removing permission: ".$permission['name']."\n";
  72 + if($auth->remove(new \yii\rbac\Permission($permission))) {
  73 + echo "Successful\n";
  74 + } else {
  75 + echo "Failed\n";
  76 + }
  77 + }
  78 + }
  79 + }
  80 +
81 81 }
82 82 \ No newline at end of file
... ...
common/modules/comment/interfaces/CommentInterface.php
1   -<?php
2   - namespace common\modules\comment\interfaces;
3   -
4   - interface CommentInterface {
5   - public function load($data, $formName = null);
6   - public function formName();
7   - public function getComments($model, $model_id);
8   - public function postComment();
9   - public function deleteComment();
10   - public function updateComment();
11   - }
  1 +<?php
  2 + namespace common\modules\comment\interfaces;
  3 +
  4 + interface CommentInterface {
  5 + public function load($data, $formName = null);
  6 + public function formName();
  7 + public static function getComments($model, $model_id);
  8 + public function postComment();
  9 + public function deleteComment();
  10 + public function updateComment();
  11 + }
... ...
common/modules/comment/models/Comment.php
1   -<?php
2   - namespace common\modules\comment\models;
3   -
4   - use common\models\User;
5   - use yii\db\ActiveQuery;
6   -
7   - /**
8   - * Class Comment
9   - * @property bool $guestComment
10   - * @property integer $comment_id
11   - * @property string $text
12   - * @property int $user_id
13   - * @property string $user_name
14   - * @property string $user_email
15   - * @property int $comment_pid
16   - * @property int $status
17   - * @property string $date_add
18   - * @property string $date_update
19   - * @property string $date_delete
20   - * @property string $model
21   - * @property int $model_id
22   - * @property Rating $rating
23   - * @property User $user
24   - * @package common\modules\comment\models
25   - */
26   - class Comment extends \yii\db\ActiveRecord
27   - implements \common\modules\comment\interfaces\CommentInterface
28   - {
29   -
30   - const STATUS_HIDDEN = 0;
31   - const STATUS_DELETED = 2;
32   - const STATUS_ACTIVE = 1;
33   - const STATUS_PERSONAL = 3;
34   -
35   - const SCENARIO_USER = 'user';
36   - const SCENARIO_GUEST = 'guest';
37   -
38   - /**
39   - * @var bool
40   - */
41   - public $guestComment = true;
42   -
43   - public function rules()
44   - {
45   - return [
46   - [
47   - [
48   - 'text',
49   - 'user_name',
50   - 'user_email',
51   - ],
52   - 'required',
53   - ],
54   - [
55   - [
56   - 'rating',
57   - ],
58   - 'safe',
59   - ],
60   - [
61   - [ 'user_email' ],
62   - 'email',
63   - ],
64   - [
65   - [ 'user_name' ],
66   - 'string',
67   - ],
68   - [
69   - [
70   - 'comment_id',
71   - 'comment_pid',
72   - ],
73   - 'integer',
74   - ],
75   - [
76   - [ 'status' ],
77   - 'default',
78   - 'value' => 1,
79   - ],
80   - [
81   - [ 'comment_pid' ],
82   - 'exist',
83   - 'targetAttribute' => 'comment_id',
84   - 'filter' => [
85   - 'model' => $this->model,
86   - 'model_id' => $this->model_id,
87   - ],
88   - ],
89   - ];
90   - }
91   -
92   - public function scenarios()
93   - {
94   - return [
95   - self::SCENARIO_GUEST => [
96   - 'user_name',
97   - 'user_email',
98   - 'text',
99   - 'comment_pid',
100   - ],
101   - self::SCENARIO_USER => [
102   - 'text',
103   - 'comment_pid',
104   - ],
105   - ];
106   - }
107   -
108   - /**
109   - * @inheritdoc
110   - */
111   - public function behaviors()
112   - {
113   - return [
114   - [
115   - 'class' => \yii\behaviors\TimestampBehavior::className(),
116   - 'createdAtAttribute' => 'date_add',
117   - 'updatedAtAttribute' => 'date_update',
118   - 'value' => new \yii\db\Expression('NOW()'),
119   - ],
120   - ];
121   - }
122   -
123   - public function afterSave($insert, $changedAttributes)
124   - {
125   - if($this->model == User::className()) {
126   - if($user = User::findOne($this->model_id)) {
127   - /**
128   - * @var User $user
129   - */
130   - $user->updateRating();
131   - }
132   - }
133   - parent::afterSave($insert, $changedAttributes);
134   - }
135   -
136   - /**
137   - * @inheritdoc
138   - */
139   - public static function tableName()
140   - {
141   - return '{{%comment}}';
142   - }
143   -
144   - /**
145   - * @inheritdoc
146   - */
147   - public function attributeLabels()
148   - {
149   - return [
150   - 'text' => \Yii::t('app', 'ะšะพะผะผะตะฝั‚ะฐั€ะธะน'),
151   - 'user_name' => \Yii::t('app', 'ะ˜ะผั'),
152   - 'user_email' => \Yii::t('app', 'Email'),
153   - ];
154   - }
155   -
156   - public function getGuestComment()
157   - {
158   - return $this->guestComment;
159   - }
160   -
161   - public function setGuestComment($value)
162   - {
163   - $this->guestComment = $value;
164   - }
165   -
166   - /**
167   - * @param string $model
168   - * @param integer $model_id
169   - *
170   - * @return ActiveQuery
171   - */
172   - public function getComments($model, $model_id)
173   - {
174   - return $this->find()
175   - ->where([
176   - 'comment.model' => $model,
177   - 'comment.model_id' => $model_id,
178   - 'comment.status' => 1,
179   - ])->with('rating');
180   - }
181   -
182   - public function postComment()
183   - {
184   - if($this->checkCreate()) {
185   - if($this->insert()) {
186   - $this->clearSafe();
187   - return true;
188   - } else {
189   - return false;
190   - }
191   - } else {
192   - $this->addError('comment_id', 'You can`t post comment here');
193   - return false;
194   - }
195   - }
196   -
197   - public function updateComment()
198   - {
199   - if($this->checkUpdate()) {
200   - if(empty( $this->comment_id )) {
201   - $this->addError('comment_id', 'Comment ID not found');
202   - return false;
203   - } else {
204   - if($this->update()) {
205   - $this->clearSafe();
206   - return true;
207   - } else {
208   - return false;
209   - }
210   - }
211   - } else {
212   - $this->addError('comment_id', 'You can`t update this post');
213   - return false;
214   - }
215   - }
216   -
217   - public function deleteComment()
218   - {
219   - if($this->checkDelete()) {
220   - if(empty( $this->comment_id )) {
221   - $this->addError('comment_id', 'Comment ID not found');
222   - return false;
223   - } else {
224   - if($this->status == self::STATUS_DELETED) {
225   - return false;
226   - }
227   - $this->status = self::STATUS_DELETED;
228   - if($this->update()) {
229   - $this->clearSafe();
230   - return true;
231   - } else {
232   - return false;
233   - }
234   - }
235   - } else {
236   - $this->addError('comment_id', 'You can`t delete this post');
237   - return false;
238   - }
239   - }
240   -
241   - public function checkCreate()
242   - {
243   - if($this->getGuestComment()) {
244   - return true;
245   - } else {
246   - return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [
247   - 'model' => $this->model,
248   - 'model_id' => $this->model_id,
249   - ]);
250   - }
251   - }
252   -
253   - public function checkUpdate()
254   - {
255   - if($this->scenario == self::SCENARIO_GUEST) {
256   - return false;
257   - } else {
258   - return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [
259   - 'model' => $this->model,
260   - 'model_id' => $this->model_id,
261   - ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [
262   - 'model' => $this->model,
263   - 'model_id' => $this->model_id,
264   - ]);
265   - }
266   - }
267   -
268   - public function checkDelete()
269   - {
270   - if($this->scenario == self::SCENARIO_GUEST) {
271   - return false;
272   - } else {
273   - return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [
274   - 'model' => $this->model,
275   - 'model_id' => $this->model_id,
276   - ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [
277   - 'model' => $this->model,
278   - 'model_id' => $this->model_id,
279   - ]);
280   - }
281   - }
282   -
283   - protected function clearSafe($setNew = true)
284   - {
285   - $safe = $this->safeAttributes();
286   - $count = count($safe);
287   - $values = array_fill(0, $count, NULL);
288   - $result = array_combine($safe, $values);
289   - $this->setAttributes($result);
290   - $this->setIsNewRecord($setNew);
291   - }
292   -
293   - public function getParent()
294   - {
295   - return $this->hasOne(self::className(), [ 'comment_id' => 'comment_pid' ]);
296   - }
297   -
298   - public function getAuthor()
299   - {
300   - // if($this->user_id != NULL) {
301   - return $this->hasOne(\common\models\User::className(), [ 'id' => 'user_id' ]);
302   - // } else {
303   - // return ['firstname' => $this->user_name, 'email' => $this->user_email];
304   - // }
305   - }
306   -
307   - public function checkRating()
308   - {
309   - $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [
310   - 'model_id' => 'comment_id',
311   - ])
312   - ->andWhere([
313   - 'model' => $this->className(),
314   - ])
315   - ->one();
316   - if(!$rating instanceof \common\modules\comment\models\Rating && !empty($this->primaryKey)) {
317   - $rating = new \common\modules\comment\models\Rating([
318   - 'model' => $this->className(),
319   - 'model_id' => $this->comment_id,
320   - 'user_id' => $this->user_id,
321   - ]);
322   - $rating->save();
323   - }
324   - }
325   -
326   - public function getRating()
327   - {
328   - $this->checkRating();
329   - return $this->hasOne(\common\modules\comment\models\Rating::className(), [
330   - 'model_id' => 'comment_id',
331   - ])
332   - ->andWhere([ 'model' => $this->className() ]);
333   - }
334   -
335   - public function hasRating($return = true)
336   - {
337   - $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [
338   - 'model_id' => 'comment_id',
339   - ])
340   - ->andWhere([ 'model' => $this->className() ])
341   - ->andWhere([
342   - 'not',
343   - [ 'value' => NULL ],
344   - ])
345   - ->one();
346   - if($return) {
347   - return $rating;
348   - } else {
349   - return $rating ? true : false;
350   - }
351   - }
352   -
353   - public function getUser()
354   - {
355   - return $this->hasOne(User::className(), [ 'id' => 'user_id' ]);
356   - }
357   -
358   - }
  1 +<?php
  2 + namespace common\modules\comment\models;
  3 +
  4 + use common\models\User;
  5 + use common\modules\product\models\Product;
  6 + use yii\db\ActiveQuery;
  7 + use yii\helpers\Url;
  8 +
  9 + /**
  10 + * Class Comment
  11 + * @property bool $guestComment
  12 + * @property integer $comment_id
  13 + * @property string $text
  14 + * @property int $user_id
  15 + * @property string $user_name
  16 + * @property string $user_email
  17 + * @property int $comment_pid
  18 + * @property int $status
  19 + * @property string $date_add
  20 + * @property string $date_update
  21 + * @property string $date_delete
  22 + * @property string $model
  23 + * @property int $model_id
  24 + * @property Rating $rating
  25 + * @property User $user
  26 + * @property User $author
  27 + * @package common\modules\comment\models
  28 + */
  29 + class Comment extends \yii\db\ActiveRecord
  30 + implements \common\modules\comment\interfaces\CommentInterface
  31 + {
  32 +
  33 + const STATUS_HIDDEN = 0;
  34 + const STATUS_DELETED = 2;
  35 + const STATUS_ACTIVE = 1;
  36 + const STATUS_PERSONAL = 3;
  37 +
  38 + const SCENARIO_USER = 'user';
  39 + const SCENARIO_GUEST = 'guest';
  40 +
  41 + /**
  42 + * @var bool
  43 + */
  44 + public $guestComment = true;
  45 +
  46 + public $buttons = [ ];
  47 +
  48 + public function rules()
  49 + {
  50 + return [
  51 + [
  52 + [
  53 + 'text',
  54 + 'user_name',
  55 + 'user_email',
  56 + ],
  57 + 'required',
  58 + ],
  59 + [
  60 + [
  61 + 'rating',
  62 + ],
  63 + 'safe',
  64 + ],
  65 + [
  66 + [ 'user_email' ],
  67 + 'email',
  68 + ],
  69 + [
  70 + [ 'user_name' ],
  71 + 'string',
  72 + ],
  73 + [
  74 + [
  75 + 'comment_id',
  76 + 'comment_pid',
  77 + ],
  78 + 'integer',
  79 + ],
  80 + [
  81 + [ 'status' ],
  82 + 'default',
  83 + 'value' => 1,
  84 + ],
  85 + [
  86 + [ 'comment_pid' ],
  87 + 'exist',
  88 + 'targetAttribute' => 'comment_id',
  89 + 'filter' => [
  90 + 'model' => $this->model,
  91 + 'model_id' => $this->model_id,
  92 + ],
  93 + ],
  94 + ];
  95 + }
  96 +
  97 + public function scenarios()
  98 + {
  99 + return [
  100 + self::SCENARIO_GUEST => [
  101 + 'user_name',
  102 + 'user_email',
  103 + 'text',
  104 + 'comment_pid',
  105 + ],
  106 + self::SCENARIO_USER => [
  107 + 'text',
  108 + 'comment_pid',
  109 + ],
  110 + ];
  111 + }
  112 +
  113 + /**
  114 + * @inheritdoc
  115 + */
  116 + public function behaviors()
  117 + {
  118 + return [
  119 + [
  120 + 'class' => \yii\behaviors\TimestampBehavior::className(),
  121 + 'createdAtAttribute' => 'date_add',
  122 + 'updatedAtAttribute' => 'date_update',
  123 + 'value' => new \yii\db\Expression('NOW()'),
  124 + ],
  125 + ];
  126 + }
  127 +
  128 + public function afterSave($insert, $changedAttributes)
  129 + {
  130 + if($this->model == User::className()) {
  131 + if($user = User::findOne($this->model_id)) {
  132 + /**
  133 + * @var User $user
  134 + */
  135 + $user->updateRating();
  136 + }
  137 + }
  138 + if($this->model == Product::className()) {
  139 + if($product = Product::findOne($this->model_id)) {
  140 + $product->recalculateRating();
  141 + }
  142 + }
  143 + parent::afterSave($insert, $changedAttributes);
  144 + }
  145 +
  146 + /**
  147 + * @inheritdoc
  148 + */
  149 + public static function tableName()
  150 + {
  151 + return '{{%comment}}';
  152 + }
  153 +
  154 + /**
  155 + * @inheritdoc
  156 + */
  157 + public function attributeLabels()
  158 + {
  159 + return [
  160 + 'text' => \Yii::t('app', 'ะšะพะผะผะตะฝั‚ะฐั€ะธะน'),
  161 + 'user_name' => \Yii::t('app', 'ะ˜ะผั'),
  162 + 'user_email' => \Yii::t('app', 'Email'),
  163 + ];
  164 + }
  165 +
  166 + public function getGuestComment()
  167 + {
  168 + return $this->guestComment;
  169 + }
  170 +
  171 + public function setGuestComment($value)
  172 + {
  173 + $this->guestComment = $value;
  174 + }
  175 +
  176 + /**
  177 + * @param string $model
  178 + * @param integer $model_id
  179 + *
  180 + * @return ActiveQuery
  181 + */
  182 + public static function getComments($model, $model_id)
  183 + {
  184 + return self::find()
  185 + ->where([
  186 + 'comment.model' => $model,
  187 + 'comment.model_id' => $model_id,
  188 + 'comment.status' => 1,
  189 + ])
  190 + ->with('rating');
  191 + }
  192 +
  193 + public function postComment()
  194 + {
  195 + if($this->checkCreate()) {
  196 + if(!empty($this->comment_pid) && !$this->checkReply()) {
  197 + $this->addError('comment_id', 'You can`t reply to this message');
  198 + return false;
  199 + }
  200 + if($this->insert()) {
  201 + $this->clearSafe();
  202 + return true;
  203 + } else {
  204 + return false;
  205 + }
  206 + }
  207 + $this->addError('comment_id', 'You can`t post comment here');
  208 + return false;
  209 + }
  210 +
  211 + public function updateComment()
  212 + {
  213 + if($this->checkUpdate()) {
  214 + if(empty( $this->comment_id )) {
  215 + $this->addError('comment_id', 'Comment ID not found');
  216 + return false;
  217 + } else {
  218 + if($this->update()) {
  219 + // $this->clearSafe(); Clears safe attributes after AJAX update
  220 + return true;
  221 + } else {
  222 + return false;
  223 + }
  224 + }
  225 + } else {
  226 + $this->addError('comment_id', 'You can`t update this post');
  227 + return false;
  228 + }
  229 + }
  230 +
  231 + public function deleteComment()
  232 + {
  233 + if($this->checkDelete()) {
  234 + if(empty( $this->comment_id )) {
  235 + $this->addError('comment_id', 'Comment ID not found');
  236 + return false;
  237 + } else {
  238 + if($this->user_id == \Yii::$app->user->id) {
  239 + if($this->delete()) {
  240 + return true;
  241 + } else {
  242 + $this->addError('comment_id', 'Can\'t delete post.');
  243 + return false;
  244 + }
  245 + } else {
  246 + if($this->status == self::STATUS_DELETED) {
  247 + return false;
  248 + }
  249 + $this->status = self::STATUS_DELETED;
  250 + if($this->update()) {
  251 + $this->clearSafe();
  252 + return true;
  253 + } else {
  254 + return false;
  255 + }
  256 + }
  257 + }
  258 + } else {
  259 + $this->addError('comment_id', 'You can`t delete this post');
  260 + return false;
  261 + }
  262 + }
  263 +
  264 + public function checkCreate()
  265 + {
  266 + if($this->getGuestComment()) {
  267 + return true;
  268 + } else {
  269 + return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [
  270 + 'model' => $this->model,
  271 + 'model_id' => $this->model_id,
  272 + 'comment_model' => $this,
  273 + ]);
  274 + }
  275 + }
  276 +
  277 + public function checkUpdate()
  278 + {
  279 + if($this->scenario == self::SCENARIO_GUEST) {
  280 + return false;
  281 + } else {
  282 + return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [
  283 + 'model' => $this->model,
  284 + 'model_id' => $this->model_id,
  285 + 'comment' => $this,
  286 + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [
  287 + 'model' => $this->model,
  288 + 'model_id' => $this->model_id,
  289 + 'comment' => $this,
  290 + ]);
  291 + }
  292 + }
  293 +
  294 + public function checkDelete()
  295 + {
  296 + if($this->scenario == self::SCENARIO_GUEST) {
  297 + return false;
  298 + } else {
  299 + return ( \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [
  300 + 'model' => $this->model,
  301 + 'model_id' => $this->model_id,
  302 + 'comment' => $this,
  303 + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [
  304 + 'model' => $this->model,
  305 + 'model_id' => $this->model_id,
  306 + 'comment' => $this,
  307 + ]) );
  308 + }
  309 + }
  310 +
  311 + public function checkReply()
  312 + {
  313 + if($this->scenario == self::SCENARIO_GUEST) {
  314 + return false;
  315 + } else {
  316 + return $this->allowReply;
  317 + }
  318 + }
  319 +
  320 + protected function clearSafe($setNew = true)
  321 + {
  322 + $safe = $this->safeAttributes();
  323 + $count = count($safe);
  324 + $values = array_fill(0, $count, NULL);
  325 + $result = array_combine($safe, $values);
  326 + $this->setAttributes($result);
  327 + $this->setIsNewRecord($setNew);
  328 + }
  329 +
  330 + public function getParent()
  331 + {
  332 + return $this->hasOne(self::className(), [ 'comment_id' => 'comment_pid' ]);
  333 + }
  334 +
  335 + public function getAuthorName()
  336 + {
  337 + if(!empty( $this->author )) {
  338 + return $this->author->username;
  339 + } else {
  340 + return $this->user_name;
  341 + }
  342 + }
  343 +
  344 + public function getAuthor($guestMark = '')
  345 + {
  346 + if(!empty( $this->user )) {
  347 + return $this->user->username;
  348 + } else {
  349 + $name = $this->user_name;
  350 + if(!empty( $guestMark )) {
  351 + $name .= $guestMark;
  352 + }
  353 + return $name;
  354 + }
  355 + }
  356 +
  357 + public function checkRating()
  358 + {
  359 + $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [
  360 + 'model_id' => 'comment_id',
  361 + ])
  362 + ->andWhere([
  363 + 'model' => $this->className(),
  364 + ])
  365 + ->one();
  366 + if(!$rating instanceof \common\modules\comment\models\Rating && !empty( $this->primaryKey )) {
  367 + $rating = new \common\modules\comment\models\Rating([
  368 + 'model' => $this->className(),
  369 + 'model_id' => $this->comment_id,
  370 + 'user_id' => $this->user_id,
  371 + ]);
  372 + $rating->save();
  373 + }
  374 + }
  375 +
  376 + public function getRating()
  377 + {
  378 + $this->checkRating();
  379 + return $this->hasOne(\common\modules\comment\models\Rating::className(), [
  380 + 'model_id' => 'comment_id',
  381 + ])
  382 + ->andWhere([ 'rating.model' => $this->className() ]);
  383 + }
  384 +
  385 + public function hasRating($return = true)
  386 + {
  387 + $rating = $this->hasOne(\common\modules\comment\models\Rating::className(), [
  388 + 'model_id' => 'comment_id',
  389 + ])
  390 + ->andWhere([ 'model' => $this->className() ])
  391 + ->andWhere([
  392 + 'not',
  393 + [ 'value' => NULL ],
  394 + ])
  395 + ->one();
  396 + if($return) {
  397 + return $rating;
  398 + } else {
  399 + return $rating ? true : false;
  400 + }
  401 + }
  402 +
  403 + public function getUser()
  404 + {
  405 + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]);
  406 + }
  407 +
  408 + public function buildButtons(
  409 + $buttons = [
  410 + 'delete',
  411 + 'update',
  412 + 'reply',
  413 + ]
  414 + ) {
  415 + if(in_array('delete', $buttons)) {
  416 + if($this->checkDelete()) {
  417 + $this->buttons[ 'delete' ] = Url::to([
  418 + 'artbox-comment/delete',
  419 + 'comment_id' => $this->comment_id,
  420 + ]);
  421 + }
  422 + }
  423 + if(in_array('update', $buttons)) {
  424 + if($this->checkUpdate()) {
  425 + $this->buttons[ 'update' ] = Url::to([
  426 + 'artbox-comment/update',
  427 + 'comment_id' => $this->comment_id,
  428 + ]);
  429 + }
  430 + }
  431 + if(in_array('reply', $buttons)) {
  432 + if($this->checkReply()) {
  433 + $this->buttons[ 'reply' ] = Url::to([
  434 + 'artbox-comment/reply',
  435 + 'comment_id' => $this->comment_id,
  436 + ]);
  437 + }
  438 + }
  439 + }
  440 +
  441 + public function getAllowReply()
  442 + {
  443 + return $this->hasAttribute('comment_pid');
  444 + }
  445 +
  446 + }
... ...
common/modules/comment/models/CommentProject.php
1   -<?php
2   - namespace common\modules\comment\models;
3   -
4   - use common\models\Currency;
5   - use common\models\File;
6   - use common\models\Project;
7   - use common\models\User;
8   - use yii\db\ActiveQuery;
9   - use yii\db\ActiveRecord;
10   - use yii\web\UploadedFile;
11   -
12   - /**
13   - * Class Comment
14   - * @property bool $guestComment
15   - * @property integer $comment_id
16   - * @property string $text
17   - * @property int $user_id
18   - * @property int $status
19   - * @property string $date_add
20   - * @property string $date_update
21   - * @property string $date_delete
22   - * @property string $model
23   - * @property int $model_id
24   - * @property string $files
25   - * @property float $budget_from
26   - * @property float $budget_to
27   - * @property int $term_from
28   - * @property int $term_to
29   - * @property int $state
30   - * @property Currency $currency
31   - * @property Project $project
32   - * @package common\modules\comment\models
33   - */
34   - class CommentProject extends \yii\db\ActiveRecord
35   - implements \common\modules\comment\interfaces\CommentInterface
36   - {
37   -
38   - const STATUS_HIDDEN = 0;
39   - const STATUS_DELETED = 2;
40   - const STATUS_ACTIVE = 1;
41   - const STATUS_PERSONAL = 3;
42   - const STATUS_ANONYMOUS = 4;
43   -
44   - const STATE_NEW = 1;
45   - const STATE_CANDIDATE = 2;
46   - const STATE_PERFORMER = 3;
47   - const STATE_DENY = 4;
48   - const STATE_TRASH = 5;
49   -
50   - const SCENARIO_USER = 'user';
51   - const SCENARIO_GUEST = 'guest';
52   - const SCENARIO_STATE = 'state';
53   - const SCENARIO_OWNER = 'owner';
54   -
55   - /**
56   - * @var bool
57   - */
58   - public $guestComment = false;
59   -
60   - public $file;
61   -
62   - public function rules()
63   - {
64   - return [
65   - [
66   - [
67   - 'text',
68   - 'budget_from',
69   - 'budget_to',
70   - 'term_from',
71   - 'term_to',
72   - 'budget_currency',
73   - ],
74   - 'required',
75   - ],
76   - [
77   - [
78   - 'budget_currency',
79   - ],
80   - 'integer',
81   - ],
82   - [
83   - [
84   - 'budget_from',
85   - 'budget_to',
86   - 'term_from',
87   - 'term_to',
88   - ],
89   - 'integer',
90   - 'min' => 0,
91   - ],
92   - [
93   - [
94   - 'budget_currency',
95   - ],
96   - 'default',
97   - 'value' => 3,
98   - ],
99   - [
100   - [ 'budget_currency' ],
101   - 'exist',
102   - 'targetClass' => Currency::className(),
103   - 'targetAttribute' => 'currency_id',
104   - ],
105   - [
106   - [
107   - 'files',
108   - ],
109   - 'string',
110   - ],
111   - [
112   - [
113   - 'file',
114   - ],
115   - 'safe',
116   - ],
117   - [
118   - [ 'status' ],
119   - 'default',
120   - 'value' => 1,
121   - ],
122   - [
123   - [ 'state' ],
124   - 'integer',
125   - 'max' => 4,
126   - 'min' => 1,
127   - 'on' => self::SCENARIO_STATE,
128   - ],
129   - [
130   - [ 'state' ],
131   - 'required',
132   - 'on' => self::SCENARIO_STATE,
133   - ],
134   - [
135   - [ 'state' ],
136   - 'required',
137   - 'on' => self::SCENARIO_OWNER,
138   - ],
139   - [
140   - [ 'state' ],
141   - 'in',
142   - 'range' => [
143   - 1,
144   - 5,
145   - ],
146   - 'on' => self::SCENARIO_OWNER,
147   - ],
148   - ];
149   - }
150   -
151   - public function scenarios()
152   - {
153   - return [
154   - self::SCENARIO_USER => [
155   - 'text',
156   - 'budget_from',
157   - 'budget_to',
158   - 'term_from',
159   - 'term_to',
160   - 'file',
161   - ],
162   - self::SCENARIO_GUEST => [
163   -
164   - ],
165   - self::SCENARIO_STATE => [
166   - 'state',
167   - ],
168   - self::SCENARIO_OWNER => [
169   - 'state',
170   - ],
171   - ];
172   - }
173   -
174   - /**
175   - * @inheritdoc
176   - */
177   - public function behaviors()
178   - {
179   - return [
180   - [
181   - 'class' => \yii\behaviors\TimestampBehavior::className(),
182   - 'createdAtAttribute' => 'date_add',
183   - 'updatedAtAttribute' => 'date_update',
184   - 'value' => new \yii\db\Expression('NOW()'),
185   - ],
186   - ];
187   - }
188   -
189   - public static function tableName()
190   - {
191   - return '{{%comment_project}}';
192   - }
193   -
194   - /**
195   - * @inheritdoc
196   - */
197   - public function attributeLabels()
198   - {
199   - return [
200   - 'text' => \Yii::t('app', 'ะขะตะบัั‚ ะพั‚ะฒะตั‚ะฐ'),
201   - 'budget_from' => \Yii::t('app', 'ะพั‚'),
202   - 'budget_to' => \Yii::t('app', 'ะดะพ'),
203   - 'term_from' => \Yii::t('app', 'ะพั‚'),
204   - 'term_to' => \Yii::t('app', 'ะดะพ'),
205   - ];
206   - }
207   -
208   - public function getGuestComment()
209   - {
210   - return $this->guestComment;
211   - }
212   -
213   - // public function setGuestComment($value)
214   - // {
215   - // $this->guestComment = $value;
216   - // }
217   -
218   - /**
219   - * @param string $model
220   - * @param integer $model_id
221   - *
222   - * @return ActiveQuery
223   - */
224   - public function getComments($model, $model_id)
225   - {
226   - return $this->find()
227   - ->where([
228   - 'comment_project.model' => $model,
229   - 'comment_project.model_id' => $model_id,
230   - 'comment_project.status' => 1,
231   - ])
232   - ->with('currency', 'user', 'user.userInfo', 'user.companyInfo', 'user.comments');
233   - }
234   -
235   - public function postComment()
236   - {
237   - if($this->checkCreate()) {
238   - if(!empty( \Yii::$app->request->post($this->formName())[ 'anonymous' ] )) {
239   - $this->status = self::STATUS_ANONYMOUS;
240   - }
241   - $this->file = UploadedFile::getInstances($this, 'file');
242   - if(!empty( $this->file )) {
243   - $file_id = [ ];
244   - if(is_array($this->file)) {
245   - foreach($this->file as $file) {
246   - if($file instanceof UploadedFile) {
247   - $file_model = new File();
248   - $file_id[] = $file_model->saveFile($file);
249   - }
250   - }
251   - } else {
252   - if($this->file instanceof UploadedFile) {
253   - $file_model = new File();
254   - $file_id[] = $file_model->saveFile($this->file);
255   - }
256   - }
257   - $this->files = json_encode($file_id);
258   - }
259   - if($this->insert()) {
260   - $this->clearSafe();
261   - return true;
262   - } else {
263   - return false;
264   - }
265   - } else {
266   - $this->addError('comment_id', 'You can`t post comment here');
267   - return false;
268   - }
269   - }
270   -
271   - public function updateComment()
272   - {
273   - if($this->checkUpdate()) {
274   - if(empty( $this->comment_id )) {
275   - $this->addError('comment_id', 'Comment ID not found');
276   - return false;
277   - } else {
278   - if($this->update()) {
279   - $this->clearSafe();
280   - return true;
281   - } else {
282   - return false;
283   - }
284   - }
285   - } else {
286   - $this->addError('comment_id', 'You can`t update this post');
287   - return false;
288   - }
289   - }
290   -
291   - public function deleteComment()
292   - {
293   - if($this->checkDelete()) {
294   - if(empty( $this->comment_id )) {
295   - $this->addError('comment_id', 'Comment ID not found');
296   - return false;
297   - } else {
298   - if($this->status == self::STATUS_DELETED) {
299   - return false;
300   - }
301   - $this->status = self::STATUS_DELETED;
302   - if($this->update()) {
303   - $this->clearSafe();
304   - return true;
305   - } else {
306   - return false;
307   - }
308   - }
309   - } else {
310   - $this->addError('comment_id', 'You can`t delete this post');
311   - return false;
312   - }
313   - }
314   -
315   - public function checkCreate()
316   - {
317   - if($this->getGuestComment()) {
318   - return true;
319   - } else {
320   - return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [
321   - 'model' => $this->model,
322   - 'model_id' => $this->model_id,
323   - ]);
324   - }
325   - }
326   -
327   - public function checkUpdate()
328   - {
329   - if($this->scenario == self::SCENARIO_GUEST) {
330   - return false;
331   - } else {
332   - return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [
333   - 'model' => $this->model,
334   - 'model_id' => $this->model_id,
335   - ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [
336   - 'model' => $this->model,
337   - 'model_id' => $this->model_id,
338   - ]);
339   - }
340   - }
341   -
342   - public function checkDelete()
343   - {
344   - if($this->scenario == self::SCENARIO_GUEST) {
345   - return false;
346   - } else {
347   - return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [
348   - 'model' => $this->model,
349   - 'model_id' => $this->model_id,
350   - ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [
351   - 'model' => $this->model,
352   - 'model_id' => $this->model_id,
353   - ]);
354   - }
355   - }
356   -
357   - protected function clearSafe($setNew = true)
358   - {
359   - $safe = $this->safeAttributes();
360   - $count = count($safe);
361   - $values = array_fill(0, $count, NULL);
362   - $result = array_combine($safe, $values);
363   - $this->setAttributes($result);
364   - $this->setIsNewRecord($setNew);
365   - }
366   -
367   - public function getAuthor()
368   - {
369   - // if($this->user_id != NULL) {
370   - return $this->hasOne(\common\models\User::className(), [ 'id' => 'user_id' ]);
371   - // } else {
372   - // return ['firstname' => $this->user_name, 'email' => $this->user_email];
373   - // }
374   - }
375   -
376   - /**
377   - * @return ActiveQuery
378   - */
379   - public function getCurrency()
380   - {
381   - return $this->hasOne(Currency::className(), [ 'currency_id' => 'budget_currency' ]);
382   - }
383   -
384   - /**
385   - * @return File[]
386   - */
387   - public function getFilesList()
388   - {
389   - $files = json_decode($this->files);
390   - if(!empty( $files )) {
391   - return File::findAll($files);
392   - } else {
393   - return [ ];
394   - }
395   - }
396   -
397   - /**
398   - * @return ActiveRecord
399   - * @throws \TypeError
400   - */
401   - public function getOwner()
402   - {
403   - $model = new $this->model();
404   - if($model instanceof ActiveRecord) {
405   - return $model->findOne($this->model_id);
406   - } else {
407   - throw new \TypeError('Model must extends Active Record Class');
408   - }
409   - }
410   -
411   - public function getProject()
412   - {
413   - return $this->hasOne(Project::className(), [ 'project_id' => 'model_id' ]);
414   - }
415   -
416   - /**
417   - * @return User
418   - */
419   - public function getUser()
420   - {
421   - return $this->hasOne(User::className(), [ 'id' => 'user_id' ]);
422   - }
423   -
424   - public function changeState()
425   - {
426   - if($this->isAttributeChanged('state')) {
427   - if($this->save()) {
428   - return true;
429   - } else {
430   - return false;
431   - }
432   - } else {
433   - return true;
434   - }
435   - }
436   -
437   - }
  1 +<?php
  2 + namespace common\modules\comment\models;
  3 +
  4 + use common\models\Currency;
  5 + use common\models\File;
  6 + use common\models\Project;
  7 + use common\models\User;
  8 + use yii\db\ActiveQuery;
  9 + use yii\db\ActiveRecord;
  10 + use yii\web\UploadedFile;
  11 +
  12 + /**
  13 + * Class Comment
  14 + * @property bool $guestComment
  15 + * @property integer $comment_id
  16 + * @property string $text
  17 + * @property int $user_id
  18 + * @property int $status
  19 + * @property string $date_add
  20 + * @property string $date_update
  21 + * @property string $date_delete
  22 + * @property string $model
  23 + * @property int $model_id
  24 + * @property string $files
  25 + * @property float $budget_from
  26 + * @property float $budget_to
  27 + * @property int $term_from
  28 + * @property int $term_to
  29 + * @property int $state
  30 + * @property Currency $currency
  31 + * @property Project $project
  32 + * @package common\modules\comment\models
  33 + */
  34 + class CommentProject extends \yii\db\ActiveRecord
  35 + implements \common\modules\comment\interfaces\CommentInterface
  36 + {
  37 +
  38 + const STATUS_HIDDEN = 0;
  39 + const STATUS_DELETED = 2;
  40 + const STATUS_ACTIVE = 1;
  41 + const STATUS_PERSONAL = 3;
  42 + const STATUS_ANONYMOUS = 4;
  43 +
  44 + const STATE_NEW = 1;
  45 + const STATE_CANDIDATE = 2;
  46 + const STATE_PERFORMER = 3;
  47 + const STATE_DENY = 4;
  48 + const STATE_TRASH = 5;
  49 +
  50 + const SCENARIO_USER = 'user';
  51 + const SCENARIO_GUEST = 'guest';
  52 + const SCENARIO_STATE = 'state';
  53 + const SCENARIO_OWNER = 'owner';
  54 +
  55 + /**
  56 + * @var bool
  57 + */
  58 + public $guestComment = false;
  59 +
  60 + public $file;
  61 +
  62 + public function rules()
  63 + {
  64 + return [
  65 + [
  66 + [
  67 + 'text',
  68 + 'budget_from',
  69 + 'budget_to',
  70 + 'term_from',
  71 + 'term_to',
  72 + 'budget_currency',
  73 + ],
  74 + 'required',
  75 + ],
  76 + [
  77 + [
  78 + 'budget_currency',
  79 + ],
  80 + 'integer',
  81 + ],
  82 + [
  83 + [
  84 + 'budget_from',
  85 + 'budget_to',
  86 + 'term_from',
  87 + 'term_to',
  88 + ],
  89 + 'integer',
  90 + 'min' => 0,
  91 + ],
  92 + [
  93 + [
  94 + 'budget_currency',
  95 + ],
  96 + 'default',
  97 + 'value' => 3,
  98 + ],
  99 + [
  100 + [ 'budget_currency' ],
  101 + 'exist',
  102 + 'targetClass' => Currency::className(),
  103 + 'targetAttribute' => 'currency_id',
  104 + ],
  105 + [
  106 + [
  107 + 'files',
  108 + ],
  109 + 'string',
  110 + ],
  111 + [
  112 + [
  113 + 'file',
  114 + ],
  115 + 'safe',
  116 + ],
  117 + [
  118 + [ 'status' ],
  119 + 'default',
  120 + 'value' => 1,
  121 + ],
  122 + [
  123 + [ 'state' ],
  124 + 'integer',
  125 + 'max' => 4,
  126 + 'min' => 1,
  127 + 'on' => self::SCENARIO_STATE,
  128 + ],
  129 + [
  130 + [ 'state' ],
  131 + 'required',
  132 + 'on' => self::SCENARIO_STATE,
  133 + ],
  134 + [
  135 + [ 'state' ],
  136 + 'required',
  137 + 'on' => self::SCENARIO_OWNER,
  138 + ],
  139 + [
  140 + [ 'state' ],
  141 + 'in',
  142 + 'range' => [
  143 + 1,
  144 + 5,
  145 + ],
  146 + 'on' => self::SCENARIO_OWNER,
  147 + ],
  148 + ];
  149 + }
  150 +
  151 + public function scenarios()
  152 + {
  153 + return [
  154 + self::SCENARIO_USER => [
  155 + 'text',
  156 + 'budget_from',
  157 + 'budget_to',
  158 + 'budget_currency',
  159 + 'term_from',
  160 + 'term_to',
  161 + 'file',
  162 + ],
  163 + self::SCENARIO_GUEST => [
  164 +
  165 + ],
  166 + self::SCENARIO_STATE => [
  167 + 'state',
  168 + ],
  169 + self::SCENARIO_OWNER => [
  170 + 'state',
  171 + ],
  172 + ];
  173 + }
  174 +
  175 + /**
  176 + * @inheritdoc
  177 + */
  178 + public function behaviors()
  179 + {
  180 + return [
  181 + [
  182 + 'class' => \yii\behaviors\TimestampBehavior::className(),
  183 + 'createdAtAttribute' => 'date_add',
  184 + 'updatedAtAttribute' => 'date_update',
  185 + 'value' => new \yii\db\Expression('NOW()'),
  186 + ],
  187 + ];
  188 + }
  189 +
  190 + public static function tableName()
  191 + {
  192 + return '{{%comment_project}}';
  193 + }
  194 +
  195 + /**
  196 + * @inheritdoc
  197 + */
  198 + public function attributeLabels()
  199 + {
  200 + return [
  201 + 'text' => \Yii::t('app', 'ะขะตะบัั‚ ะพั‚ะฒะตั‚ะฐ'),
  202 + 'budget_from' => \Yii::t('app', 'ะพั‚'),
  203 + 'budget_to' => \Yii::t('app', 'ะดะพ'),
  204 + 'term_from' => \Yii::t('app', 'ะพั‚'),
  205 + 'term_to' => \Yii::t('app', 'ะดะพ'),
  206 + ];
  207 + }
  208 +
  209 + public function getGuestComment()
  210 + {
  211 + return $this->guestComment;
  212 + }
  213 +
  214 + // public function setGuestComment($value)
  215 + // {
  216 + // $this->guestComment = $value;
  217 + // }
  218 +
  219 + /**
  220 + * @param string $model
  221 + * @param integer $model_id
  222 + *
  223 + * @return ActiveQuery
  224 + */
  225 + public static function getComments($model, $model_id)
  226 + {
  227 + /**
  228 + * @var User $user
  229 + */
  230 + $user = \Yii::$app->user->identity;
  231 + if(!empty($user)) {
  232 + $project = Project::findOne($model_id);
  233 + if(!empty($project) && $user->id == $project->user_id) {
  234 + return self::find()
  235 + ->where([
  236 + 'comment_project.model' => $model,
  237 + 'comment_project.model_id' => $model_id,
  238 + 'comment_project.status' => [self::STATUS_ANONYMOUS, self::STATUS_ACTIVE, self::STATUS_PERSONAL],
  239 + ])
  240 + ->with('currency', 'user', 'user.userInfo', 'user.companyInfo', 'user.comments');
  241 + }
  242 + }
  243 + $query = self::find()
  244 + ->where([
  245 + 'comment_project.model' => $model,
  246 + 'comment_project.model_id' => $model_id,
  247 + ])
  248 + ->with('currency', 'user', 'user.userInfo', 'user.companyInfo', 'user.comments');
  249 + if(!empty($user)) {
  250 + $query->andWhere(['or', ['comment_project.status' => self::STATUS_ACTIVE], ['comment_project.status' => self::STATUS_ANONYMOUS, 'comment_project.user_id' => $user->id]]);
  251 + } else {
  252 + $query->andWhere(['comment_project.status' => 1]);
  253 + }
  254 + return $query;
  255 + }
  256 +
  257 + public function postComment()
  258 + {
  259 + if($this->checkCreate()) {
  260 + if(!empty( \Yii::$app->request->post($this->formName())[ 'anonymous' ] )) {
  261 + $this->status = self::STATUS_ANONYMOUS;
  262 + }
  263 + $this->file = UploadedFile::getInstances($this, 'file');
  264 + if(!empty( $this->file )) {
  265 + $file_id = [ ];
  266 + if(is_array($this->file)) {
  267 + foreach($this->file as $file) {
  268 + if($file instanceof UploadedFile) {
  269 + $file_model = new File();
  270 + $file_id[] = $file_model->saveFile($file);
  271 + }
  272 + }
  273 + } else {
  274 + if($this->file instanceof UploadedFile) {
  275 + $file_model = new File();
  276 + $file_id[] = $file_model->saveFile($this->file);
  277 + }
  278 + }
  279 + $this->files = json_encode($file_id);
  280 + }
  281 + if($this->insert()) {
  282 + $this->clearSafe();
  283 + return true;
  284 + } else {
  285 + return false;
  286 + }
  287 + } else {
  288 + $this->addError('comment_id', 'You can`t post comment here');
  289 + return false;
  290 + }
  291 + }
  292 +
  293 + public function updateComment()
  294 + {
  295 + if($this->checkUpdate()) {
  296 + if(empty( $this->comment_id )) {
  297 + $this->addError('comment_id', 'Comment ID not found');
  298 + return false;
  299 + } else {
  300 + if($this->update()) {
  301 + $this->clearSafe();
  302 + return true;
  303 + } else {
  304 + return false;
  305 + }
  306 + }
  307 + } else {
  308 + $this->addError('comment_id', 'You can`t update this post');
  309 + return false;
  310 + }
  311 + }
  312 +
  313 + public function deleteComment()
  314 + {
  315 + if($this->checkDelete()) {
  316 + if(empty( $this->comment_id )) {
  317 + $this->addError('comment_id', 'Comment ID not found');
  318 + return false;
  319 + } else {
  320 + if($this->status == self::STATUS_DELETED) {
  321 + return false;
  322 + }
  323 + $this->status = self::STATUS_DELETED;
  324 + if($this->update()) {
  325 + $this->clearSafe();
  326 + return true;
  327 + } else {
  328 + return false;
  329 + }
  330 + }
  331 + } else {
  332 + $this->addError('comment_id', 'You can`t delete this post');
  333 + return false;
  334 + }
  335 + }
  336 +
  337 + public function checkCreate()
  338 + {
  339 + if($this->getGuestComment()) {
  340 + return true;
  341 + } else {
  342 + return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [
  343 + 'model' => $this->model,
  344 + 'model_id' => $this->model_id,
  345 + 'comment_model' => $this->className(),
  346 + ]);
  347 + }
  348 + }
  349 +
  350 + public function checkUpdate()
  351 + {
  352 + if($this->scenario == self::SCENARIO_GUEST) {
  353 + return false;
  354 + } else {
  355 + return \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE, [
  356 + 'model' => $this->model,
  357 + 'model_id' => $this->model_id,
  358 + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::UPDATE_OWN, [
  359 + 'model' => $this->model,
  360 + 'model_id' => $this->model_id,
  361 + ]);
  362 + }
  363 + }
  364 +
  365 + public function checkDelete()
  366 + {
  367 + if($this->scenario == self::SCENARIO_GUEST) {
  368 + return false;
  369 + } else {
  370 + return \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [
  371 + 'model' => $this->model,
  372 + 'model_id' => $this->model_id,
  373 + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [
  374 + 'model' => $this->model,
  375 + 'model_id' => $this->model_id,
  376 + ]);
  377 + }
  378 + }
  379 +
  380 + protected function clearSafe($setNew = true)
  381 + {
  382 + $safe = $this->safeAttributes();
  383 + $count = count($safe);
  384 + $values = array_fill(0, $count, NULL);
  385 + $result = array_combine($safe, $values);
  386 + $this->setAttributes($result);
  387 + $this->setIsNewRecord($setNew);
  388 + }
  389 +
  390 + public function getAuthor()
  391 + {
  392 + // if($this->user_id != NULL) {
  393 + return $this->hasOne(\common\models\User::className(), [ 'id' => 'user_id' ]);
  394 + // } else {
  395 + // return ['firstname' => $this->user_name, 'email' => $this->user_email];
  396 + // }
  397 + }
  398 +
  399 + /**
  400 + * @return ActiveQuery
  401 + */
  402 + public function getCurrency()
  403 + {
  404 + return $this->hasOne(Currency::className(), [ 'currency_id' => 'budget_currency' ]);
  405 + }
  406 +
  407 + /**
  408 + * @return File[]
  409 + */
  410 + public function getFilesList()
  411 + {
  412 + $files = json_decode($this->files);
  413 + if(!empty( $files )) {
  414 + return File::findAll($files);
  415 + } else {
  416 + return [ ];
  417 + }
  418 + }
  419 +
  420 + /**
  421 + * @return ActiveRecord
  422 + * @throws \TypeError
  423 + */
  424 + public function getOwner()
  425 + {
  426 + $model = new $this->model();
  427 + if($model instanceof ActiveRecord) {
  428 + return $model->findOne($this->model_id);
  429 + } else {
  430 + throw new \TypeError('Model must extends Active Record Class');
  431 + }
  432 + }
  433 +
  434 + public function getProject()
  435 + {
  436 + return $this->hasOne(Project::className(), [ 'project_id' => 'model_id' ]);
  437 + }
  438 +
  439 + /**
  440 + * @return User
  441 + */
  442 + public function getUser()
  443 + {
  444 + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]);
  445 + }
  446 +
  447 + public function changeState()
  448 + {
  449 + if($this->isAttributeChanged('state')) {
  450 + if($this->save()) {
  451 + return true;
  452 + } else {
  453 + return false;
  454 + }
  455 + } else {
  456 + return true;
  457 + }
  458 + }
  459 +
  460 + }
... ...
common/modules/comment/models/CommentProjectAnswer.php 0 โ†’ 100755
  1 +<?php
  2 + namespace common\modules\comment\models;
  3 +
  4 + use common\models\Project;
  5 + use common\models\User;
  6 + use yii\db\ActiveQuery;
  7 + use yii\helpers\Url;
  8 +
  9 + /**
  10 + * Class Comment
  11 + * @property bool $guestComment
  12 + * @property integer $comment_id
  13 + * @property string $text
  14 + * @property int $user_id
  15 + * @property string $user_name
  16 + * @property string $user_email
  17 + * @property int $comment_pid
  18 + * @property int $status
  19 + * @property string $date_add
  20 + * @property string $date_update
  21 + * @property string $date_delete
  22 + * @property string $model
  23 + * @property int $model_id
  24 + * @property Rating $rating
  25 + * @property User $user
  26 + * @property User $author
  27 + * @package common\modules\comment\models
  28 + */
  29 + class CommentProjectAnswer extends Comment
  30 + {
  31 +
  32 + public function rules()
  33 + {
  34 + return [
  35 + [
  36 + [
  37 + 'text',
  38 + 'user_name',
  39 + 'user_email',
  40 + ],
  41 + 'required',
  42 + ],
  43 + [
  44 + [
  45 + 'rating',
  46 + ],
  47 + 'safe',
  48 + ],
  49 + [
  50 + [ 'user_email' ],
  51 + 'email',
  52 + ],
  53 + [
  54 + [ 'user_name' ],
  55 + 'string',
  56 + ],
  57 + [
  58 + [
  59 + 'comment_id',
  60 + 'comment_pid',
  61 + ],
  62 + 'integer',
  63 + ],
  64 + [
  65 + [ 'status' ],
  66 + 'default',
  67 + 'value' => 1,
  68 + ],
  69 + [
  70 + [ 'comment_pid' ],
  71 + 'exist',
  72 + 'targetAttribute' => 'comment_id',
  73 + 'filter' => [
  74 + 'model' => $this->model,
  75 + 'model_id' => $this->model_id,
  76 + ],
  77 + ],
  78 + [
  79 + ['comment_pid'],
  80 + 'required',
  81 + 'when' => function($model, $attribute) {
  82 + /**
  83 + * @var CommentProjectAnswer $model
  84 + * @var string $attribute
  85 + */
  86 + if(!empty(\Yii::$app->user->id) && $model->isNewRecord && !empty($model->model) && !empty($model->model_id)) {
  87 + $project = Project::findOne($model->model_id);
  88 + if(!empty($project) && $project->user_id == \Yii::$app->user->id) {
  89 + return true;
  90 + }
  91 + }
  92 + return false;
  93 + }
  94 + ],
  95 + ];
  96 + }
  97 +
  98 + /**
  99 + * @param string $model
  100 + * @param integer $model_id
  101 + *
  102 + * @return ActiveQuery
  103 + */
  104 + public static function getComments($model, $model_id)
  105 + {
  106 + $query = self::find()
  107 + ->where([
  108 + 'comment.model' => $model,
  109 + 'comment.model_id' => $model_id,
  110 + 'comment.status' => 1,
  111 + 'comment.comment_pid' => NULL,
  112 + ])
  113 + ->with('parent');
  114 + $project = Project::findOne($model_id);
  115 + $user = \Yii::$app->user;
  116 + if(empty( $user ) || $project->user_id != $user->id) {
  117 + $query->innerJoin([ 'child' => 'comment' ], 'comment.comment_id = child.comment_pid')
  118 + ->andWhere([
  119 + 'not',
  120 + [ 'child.comment_id' => NULL ],
  121 + ]);
  122 + }
  123 + return $query;
  124 + }
  125 +
  126 + public function beforeDelete()
  127 + {
  128 + if(!empty($this->child)) {
  129 + $this->child->delete();
  130 + }
  131 + return parent::beforeDelete(); // TODO: Change the autogenerated stub
  132 + }
  133 +
  134 + public function checkCreate()
  135 + {
  136 + if($this->getGuestComment()) {
  137 + return true;
  138 + } else {
  139 + return \Yii::$app->user->can(\common\modules\comment\Permissions::CREATE, [
  140 + 'model' => $this->model,
  141 + 'model_id' => $this->model_id,
  142 + 'comment_model' => $this,
  143 + ]);
  144 + }
  145 + }
  146 +
  147 + public function checkUpdate()
  148 + {
  149 + if($this->scenario == self::SCENARIO_GUEST) {
  150 + return false;
  151 + } else {
  152 + if(!empty($this->comment_pid) && $this->user_id == \Yii::$app->user->id) {
  153 + return true;
  154 + }
  155 + }
  156 + return false;
  157 + }
  158 +
  159 + public function checkDelete()
  160 + {
  161 + if($this->scenario == self::SCENARIO_GUEST) {
  162 + return false;
  163 + } else {
  164 + return ( \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE, [
  165 + 'model' => $this->model,
  166 + 'model_id' => $this->model_id,
  167 + 'comment' => $this,
  168 + ]) || \Yii::$app->user->can(\common\modules\comment\Permissions::DELETE_OWN, [
  169 + 'model' => $this->model,
  170 + 'model_id' => $this->model_id,
  171 + 'comment' => $this,
  172 + ]) );
  173 + }
  174 + }
  175 +
  176 + public function checkReply()
  177 + {
  178 + if($this->scenario != self::SCENARIO_GUEST) {
  179 + if(!$this->isNewRecord && empty( $this->comment_pid )) {
  180 + $project = Project::findOne($this->model_id);
  181 + if($project->user_id == \Yii::$app->user->id && empty($this->child)) {
  182 + return true;
  183 + }
  184 + } elseif($this->isNewRecord && !empty($this->comment_pid)) {
  185 + $parent = self::findOne($this->comment_pid);
  186 + if(!empty($parent) && $parent->checkReply()) {
  187 + return true;
  188 + }
  189 + }
  190 + }
  191 + return false;
  192 + }
  193 +
  194 + public function getChild()
  195 + {
  196 + return $this->hasOne($this->className(), [ 'comment_pid' => 'comment_id' ]);
  197 + }
  198 +
  199 + }
... ...
common/modules/comment/models/CommentProjectSearch.php
1   -<?php
2   - namespace common\modules\comment\models;
3   -
4   - use common\models\Currency;
5   - use common\models\File;
6   - use common\models\User;
7   - use yii\data\ActiveDataProvider;
8   - use yii\db\ActiveQuery;
9   - use yii\db\ActiveRecord;
10   - use yii\web\UploadedFile;
11   -
12   - /**
13   - * Class Comment
14   - * @property bool $guestComment
15   - * @property integer $comment_id
16   - * @property string $text
17   - * @property int $user_id
18   - * @property int $status
19   - * @property string $date_add
20   - * @property string $date_update
21   - * @property string $date_delete
22   - * @property string $model
23   - * @property int $model_id
24   - * @property string $files
25   - * @property float $budget_from
26   - * @property float $budget_to
27   - * @property int $term_from
28   - * @property int $term_to
29   - * @property int $state
30   - * @property Currency $currency
31   - * @package common\modules\comment\models
32   - */
33   - class CommentProjectSearch extends CommentProject
34   - {
35   -
36   - const SCENARIO_SEARCH = 'search';
37   -
38   - public function rules()
39   - {
40   - return [
41   - [
42   - [
43   - 'state',
44   - ],
45   - 'integer',
46   - 'max' => 5,
47   - 'min' => 1,
48   - ],
49   - [
50   - [
51   - 'state',
52   - ],
53   - 'default',
54   - 'value' => self::STATE_NEW,
55   - ],
56   - ];
57   - }
58   -
59   - public function scenarios()
60   - {
61   - return array_merge(parent::scenarios(), [
62   - self::SCENARIO_SEARCH => [
63   - 'state',
64   - ],
65   - ]);
66   - }
67   -
68   - public function search($params)
69   - {
70   - $query = CommentProject::find()
71   - ->with('project')
72   - ->with('project.budgetCurrency')
73   - ->with('project.comments')
74   - ->where([ 'user_id' => \Yii::$app->user->getId() ]);
75   -
76   - $dataProvider = new ActiveDataProvider([
77   - 'query' => $query,
78   - ]);
79   -
80   - $this->load($params);
81   -
82   - if(!$this->validate()) {
83   - $query->andWhere('0=1');
84   - return $dataProvider;
85   - }
86   -
87   - $query->andWhere([ 'state' => $this->state ]);
88   -
89   - return $dataProvider;
90   - }
91   -
92   - }
  1 +<?php
  2 + namespace common\modules\comment\models;
  3 +
  4 + use common\models\Currency;
  5 + use common\models\File;
  6 + use common\models\User;
  7 + use yii\data\ActiveDataProvider;
  8 + use yii\db\ActiveQuery;
  9 + use yii\db\ActiveRecord;
  10 + use yii\web\UploadedFile;
  11 +
  12 + /**
  13 + * Class Comment
  14 + * @property bool $guestComment
  15 + * @property integer $comment_id
  16 + * @property string $text
  17 + * @property int $user_id
  18 + * @property int $status
  19 + * @property string $date_add
  20 + * @property string $date_update
  21 + * @property string $date_delete
  22 + * @property string $model
  23 + * @property int $model_id
  24 + * @property string $files
  25 + * @property float $budget_from
  26 + * @property float $budget_to
  27 + * @property int $term_from
  28 + * @property int $term_to
  29 + * @property int $state
  30 + * @property Currency $currency
  31 + * @package common\modules\comment\models
  32 + */
  33 + class CommentProjectSearch extends CommentProject
  34 + {
  35 +
  36 + const SCENARIO_SEARCH = 'search';
  37 +
  38 + public function rules()
  39 + {
  40 + return [
  41 + [
  42 + [
  43 + 'state',
  44 + ],
  45 + 'integer',
  46 + 'max' => 5,
  47 + 'min' => 1,
  48 + ],
  49 + [
  50 + [
  51 + 'state',
  52 + ],
  53 + 'default',
  54 + 'value' => self::STATE_NEW,
  55 + ],
  56 + ];
  57 + }
  58 +
  59 + public function scenarios()
  60 + {
  61 + return array_merge(parent::scenarios(), [
  62 + self::SCENARIO_SEARCH => [
  63 + 'state',
  64 + ],
  65 + ]);
  66 + }
  67 +
  68 + public function search($params)
  69 + {
  70 + $query = CommentProject::find()
  71 + ->with('project')
  72 + ->with('project.budgetCurrency')
  73 + ->with('project.comments')
  74 + ->where([ 'user_id' => \Yii::$app->user->getId() ]);
  75 +
  76 + $dataProvider = new ActiveDataProvider([
  77 + 'query' => $query,
  78 + ]);
  79 +
  80 + $this->load($params);
  81 +
  82 + if(!$this->validate()) {
  83 + $query->andWhere('0=1');
  84 + return $dataProvider;
  85 + }
  86 +
  87 + $query->andWhere([ 'state' => $this->state ]);
  88 +
  89 + return $dataProvider;
  90 + }
  91 +
  92 + }
... ...
common/modules/comment/models/Rating.php
1   -<?php
2   -
3   -namespace common\modules\comment\models;
4   -
5   -use Yii;
6   -
7   -/**
8   - * This is the model class for table "rating".
9   - *
10   - * @property integer $rating_id
11   - * @property string $date_add
12   - * @property string $date_update
13   - * @property integer $user_id
14   - * @property integer $value
15   - * @property string $model
16   - * @property integer $model_id
17   - *
18   - * @property \common\models\User $user
19   - */
20   -class Rating extends \yii\db\ActiveRecord
21   -{
22   -
23   - public $rating;
24   - /**
25   - * @inheritdoc
26   - */
27   - public static function tableName()
28   - {
29   - return 'rating';
30   - }
31   -
32   - /**
33   - * @inheritdoc
34   - */
35   - public function rules()
36   - {
37   - return [
38   - [['value'], 'integer'],
39   - ];
40   - }
41   -
42   - /**
43   - * @inheritdoc
44   - */
45   - public function attributeLabels()
46   - {
47   - return [
48   - 'rating_id' => Yii::t('app', 'Rating ID'),
49   - 'date_add' => Yii::t('app', 'Date Add'),
50   - 'date_update' => Yii::t('app', 'Date Update'),
51   - 'user_id' => Yii::t('app', 'User ID'),
52   - 'entity' => Yii::t('app', 'Entity'),
53   - 'value' => Yii::t('app', 'Value'),
54   - ];
55   - }
56   -
57   - /**
58   - * @return \yii\db\ActiveQuery
59   - */
60   - public function getUser()
61   - {
62   - return $this->hasOne(\common\models\User::className(), ['id' => 'user_id']);
63   - }
64   -}
  1 +<?php
  2 +
  3 +namespace common\modules\comment\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "rating".
  9 + *
  10 + * @property integer $rating_id
  11 + * @property string $date_add
  12 + * @property string $date_update
  13 + * @property integer $user_id
  14 + * @property integer $value
  15 + * @property string $model
  16 + * @property integer $model_id
  17 + *
  18 + * @property \common\models\User $user
  19 + */
  20 +class Rating extends \yii\db\ActiveRecord
  21 +{
  22 +
  23 + public $rating;
  24 + /**
  25 + * @inheritdoc
  26 + */
  27 + public static function tableName()
  28 + {
  29 + return 'rating';
  30 + }
  31 +
  32 + /**
  33 + * @inheritdoc
  34 + */
  35 + public function rules()
  36 + {
  37 + return [
  38 + [['value'], 'integer'],
  39 + ];
  40 + }
  41 +
  42 + /**
  43 + * @inheritdoc
  44 + */
  45 + public function attributeLabels()
  46 + {
  47 + return [
  48 + 'rating_id' => Yii::t('app', 'Rating ID'),
  49 + 'date_add' => Yii::t('app', 'Date Add'),
  50 + 'date_update' => Yii::t('app', 'Date Update'),
  51 + 'user_id' => Yii::t('app', 'User ID'),
  52 + 'entity' => Yii::t('app', 'Entity'),
  53 + 'value' => Yii::t('app', 'Value'),
  54 + ];
  55 + }
  56 +
  57 + /**
  58 + * @return \yii\db\ActiveQuery
  59 + */
  60 + public function getUser()
  61 + {
  62 + return $this->hasOne(\common\models\User::className(), ['id' => 'user_id']);
  63 + }
  64 +}
... ...
common/modules/comment/rbac/ArtboxCommentCreateRule.php
1   -<?php
2   -
3   - namespace common\modules\comment\rbac;
4   -
5   - use yii\rbac\Rule;
6   -
7   - class ArtboxCommentCreateRule extends Rule
8   - {
9   -
10   - public $name = 'canCommentCreateArtbox';
11   -
12   - public function execute($user, $item, $params)
13   - {
14   - if($params[ 'model' ] == \common\models\Project::className()) {
15   - return $this->checkProject($user, $item, $params);
16   - }
17   - return true;
18   - }
19   -
20   - public function checkProject($user, $item, $params)
21   - {
22   - $project = \common\models\Project::findOne($params['model_id']);
23   - if($project->user_id == $user) {
24   - return false;
25   - }
26   - $comment = \common\modules\comment\models\CommentProject::find()
27   - ->where([ 'model' => $params[ 'model' ],
28   - 'model_id' => $params[ 'model_id' ],
29   - 'user_id' => $user,
30   - ])->one();
31   - if(empty($comment)) {
32   - return true;
33   - } else {
34   - return false;
35   - }
36   - }
37   -
  1 +<?php
  2 +
  3 + namespace common\modules\comment\rbac;
  4 +
  5 + use common\modules\comment\models\CommentProject;
  6 + use yii\rbac\Rule;
  7 +
  8 + class ArtboxCommentCreateRule extends Rule
  9 + {
  10 +
  11 + public $name = 'canCommentCreateArtbox';
  12 +
  13 + public function execute($user, $item, $params)
  14 + {
  15 + if($params[ 'model' ] == \common\models\Project::className() && !empty($params['comment_model']) && $params['comment_model'] == CommentProject::className()) {
  16 + return $this->checkProject($user, $item, $params);
  17 + }
  18 + return true;
  19 + }
  20 +
  21 + public function checkProject($user, $item, $params)
  22 + {
  23 + $project = \common\models\Project::findOne($params['model_id']);
  24 + if($project->user_id == $user) {
  25 + return false;
  26 + }
  27 + $comment = \common\modules\comment\models\CommentProject::find()
  28 + ->where([ 'model' => $params[ 'model' ],
  29 + 'model_id' => $params[ 'model_id' ],
  30 + 'user_id' => $user,
  31 + ])->one();
  32 + if(empty($comment)) {
  33 + return true;
  34 + } else {
  35 + return false;
  36 + }
  37 + }
  38 +
38 39 }
39 40 \ No newline at end of file
... ...
common/modules/comment/rbac/ArtboxCommentDeleteOwnRule.php
1   -<?php
2   -
3   - namespace common\modules\comment\rbac;
4   -
5   - use yii\rbac\Rule;
6   -
7   - class ArtboxCommentDeleteOwnRule extends Rule
8   - {
9   -
10   - public $name = 'canCommentDeleteOwnArtbox';
11   -
12   - public function execute($user, $item, $params)
13   - {
14   - return true;
15   - }
16   -
  1 +<?php
  2 +
  3 + namespace common\modules\comment\rbac;
  4 +
  5 + use yii\rbac\Rule;
  6 +
  7 + class ArtboxCommentDeleteOwnRule extends Rule
  8 + {
  9 +
  10 + public $name = 'canCommentDeleteOwnArtbox';
  11 +
  12 + public function execute($user, $item, $params)
  13 + {
  14 + if(!empty($params['comment'])) {
  15 + if($params['comment']->user_id == \Yii::$app->user->id) {
  16 + return true;
  17 + }
  18 + }
  19 + return false;
  20 + }
  21 +
17 22 }
18 23 \ No newline at end of file
... ...
common/modules/comment/rbac/ArtboxCommentDeleteRule.php
1   -<?php
2   -
3   - namespace common\modules\comment\rbac;
4   -
5   - use yii\rbac\Rule;
6   -
7   - class ArtboxCommentDeleteRule extends Rule
8   - {
9   -
10   - public $name = 'canCommentDeleteArtbox';
11   -
12   - public function execute($user, $item, $params)
13   - {
14   - return true;
15   - }
16   -
  1 +<?php
  2 +
  3 + namespace common\modules\comment\rbac;
  4 +
  5 + use common\models\User;
  6 + use yii\db\ActiveRecord;
  7 + use yii\rbac\Rule;
  8 +
  9 + class ArtboxCommentDeleteRule extends Rule
  10 + {
  11 +
  12 + public $name = 'canCommentDeleteArtbox';
  13 +
  14 + public function execute($user, $item, $params)
  15 + {
  16 + /**
  17 + * @var ActiveRecord $model
  18 + */
  19 + if(!empty($params['model']) && !empty($params['model_id'])) {
  20 + $model = new $params['model'];
  21 + if($model instanceof ActiveRecord) {
  22 + $model = $model::findOne($params['model_id']);
  23 + if($model->hasAttribute('user_id') && $model->user_id == \Yii::$app->user->id) {
  24 + return true;
  25 + } elseif($model instanceof User && $model->id == \Yii::$app->user->id) {
  26 + return true;
  27 + }
  28 + }
  29 + }
  30 + return false;
  31 + }
  32 +
17 33 }
18 34 \ No newline at end of file
... ...
common/modules/comment/rbac/ArtboxCommentUpdateOwnRule.php
1   -<?php
2   -
3   - namespace common\modules\comment\rbac;
4   -
5   - use yii\rbac\Rule;
6   -
7   - class ArtboxCommentUpdateOwnRule extends Rule
8   - {
9   -
10   - public $name = 'canCommentUpdateOwnArtbox';
11   -
12   - public function execute($user, $item, $params)
13   - {
14   - return false;
15   - }
16   -
  1 +<?php
  2 +
  3 + namespace common\modules\comment\rbac;
  4 +
  5 + use yii\rbac\Rule;
  6 +
  7 + class ArtboxCommentUpdateOwnRule extends Rule
  8 + {
  9 +
  10 + public $name = 'canCommentUpdateOwnArtbox';
  11 +
  12 + public function execute($user, $item, $params)
  13 + {
  14 + if($params['comment']->user_id == \Yii::$app->user->id) {
  15 + return true;
  16 + }
  17 + return false;
  18 + }
  19 +
17 20 }
18 21 \ No newline at end of file
... ...
common/modules/comment/rbac/ArtboxCommentUpdateRule.php
1   -<?php
2   -
3   - namespace common\modules\comment\rbac;
4   -
5   - use yii\rbac\Rule;
6   -
7   - class ArtboxCommentUpdateRule extends Rule
8   - {
9   -
10   - public $name = 'canCommentUpdateArtbox';
11   -
12   - public function execute($user, $item, $params)
13   - {
14   - return true;
15   - }
16   -
  1 +<?php
  2 +
  3 + namespace common\modules\comment\rbac;
  4 +
  5 + use yii\rbac\Rule;
  6 +
  7 + class ArtboxCommentUpdateRule extends Rule
  8 + {
  9 +
  10 + public $name = 'canCommentUpdateArtbox';
  11 +
  12 + public function execute($user, $item, $params)
  13 + {
  14 + return false;
  15 + }
  16 +
17 17 }
18 18 \ No newline at end of file
... ...
common/modules/comment/resources/comment.css
1   -.artbox_comment_reply_author, .artbox_comment_update_reply {
2   - position: relative;
3   - width: 25%;
4   -}
5   -.artbox_comment_update_reply {
6   - width: 25%;
7   - float: none;
8   -}
9   -.artbox_comment_reply_author:after, .artbox_comment_update_reply:after {
10   - content: '';
11   - background-image: url('delete-ico.png');
12   - display: block;
13   - position: absolute;
14   - right: -13px;
15   - width: 13px;
16   - height: 13px;
17   - top: 0;
18   - cursor: pointer;
19   -}
20 1 \ No newline at end of file
  2 +.artbox_comment_reply_author, .artbox_comment_update_reply {
  3 + position: relative;
  4 + width: 25%;
  5 +}
  6 +.artbox_comment_update_reply {
  7 + width: 25%;
  8 + float: none;
  9 +}
  10 +.artbox_comment_reply_author:after, .artbox_comment_update_reply:after {
  11 + content: '';
  12 + background-image: url('delete-ico.png');
  13 + display: block;
  14 + position: absolute;
  15 + right: -13px;
  16 + width: 13px;
  17 + height: 13px;
  18 + top: 0;
  19 + cursor: pointer;
  20 +}
  21 +.removeable {
  22 + color: #a94442;
  23 + background-color: #f2dede;
  24 + border-color: #ebccd1;
  25 + border-radius: 4px;
  26 + padding: 15px;
  27 + padding-right: 35px;
  28 + position: relative;
  29 +}
  30 +.removeable::after {
  31 + content: ' ';
  32 + display: block;
  33 + position: absolute;
  34 + right: 5px;
  35 + top: 5px;
  36 + width: 15px;
  37 + height: 15px;
  38 + background: url('delete-ico.png');
  39 + background-size: cover;
  40 + cursor: pointer;
  41 +}
  42 +
  43 +/* For default styling */
  44 +.new-portf-comments-wr {
  45 + margin-top: 28px
  46 +}
  47 +
  48 +.new-portf-comm-count {
  49 + font-size: 18px
  50 +}
  51 +
  52 +.input-blocks-comm {
  53 + width: 230px;
  54 + float: left;
  55 + margin-left: 34px;
  56 + position: relative;
  57 +}
  58 +
  59 +.input-blocks-comm:first-child {
  60 + margin-left: 0
  61 +}
  62 +
  63 +.new-portf-add-comm {
  64 + padding: 24px 20px 30px 20px;
  65 + box-sizing: border-box;
  66 + margin-top: 10px;
  67 + background: #f1f1f1;
  68 +}
  69 +
  70 +.input-blocks-comm.area-comm {
  71 + width: 680px;
  72 + margin-left: 0;
  73 + margin-top: 10px;
  74 + position: relative;
  75 +}
  76 +
  77 +.tender_questions_ .input-blocks-comm.area-comm {
  78 + margin-top: 15px;
  79 +}
  80 +
  81 +.custom-input-4 {
  82 + width: 230px;
  83 + height: 32px;
  84 + border: 0;
  85 + box-sizing: border-box;
  86 + outline: none;
  87 + color: #333;
  88 + font-size: 13px;
  89 + line-height: 29px;
  90 + padding-left: 8px;
  91 + margin-top: 5px;
  92 +}
  93 +
  94 +.custom-area-4 {
  95 + min-height: 142px;
  96 + max-height: 142px;
  97 + resize: none;
  98 + width: 100%;
  99 + max-width: 100%;
  100 + border: 0;
  101 + box-sizing: border-box;
  102 + outline: none;
  103 + color: #636363;
  104 + font-size: 13px;
  105 + padding-left: 8px;
  106 + padding-top: 8px;
  107 + margin-top: 5px;
  108 +}
  109 +
  110 +.input-blocks-comm label {
  111 + font-size: 13px;
  112 + color: #454545;
  113 + font-weight: 700;
  114 +}
  115 +
  116 +.custom-area-4:focus, .custom-input-4:focus {
  117 + box-shadow: 1px 2px 2px 0px rgba(215, 215, 215, 0.75) inset;
  118 + transition: 0.1s;
  119 + outline: none
  120 +}
  121 +
  122 +.input-blocks-comm-button {
  123 + text-align: right;
  124 + margin-top: 16px
  125 +}
  126 +
  127 +.input-blocks-comm-button button {
  128 + background: #0072bc;
  129 + color: #fff;
  130 + font-size: 13px;
  131 + height: 27px;
  132 + outline: none;
  133 + cursor: pointer;
  134 + border-radius: 4px;
  135 + padding: 0 17px;
  136 + border: 1px solid #0072bc;
  137 +}
  138 +
  139 +.input-blocks-comm-button button:hover {
  140 + background: none;
  141 + color: #0072bc;
  142 + transition: 0.2s;
  143 +}
  144 +
  145 +.input-blocks-comm-button button:focus, .input-blocks-comm-button button:active {
  146 + background: #035b94;
  147 + color: #fff
  148 +}
  149 +
  150 +.new-portf-comm-read-wr {
  151 + margin-top: 29px
  152 +}
  153 +
  154 +.new-portf-comm-read {
  155 + width: 100%;
  156 + float: left;
  157 + padding-bottom: 13px;
  158 + border-bottom: 1px solid #dcdcdc;
  159 + margin-top: 30px;
  160 +}
  161 +
  162 +.new-portf-comm-read:first-child {
  163 + /*margin-top: 0*/
  164 +}
  165 +
  166 +.new-prof-wrapper-read {
  167 + float: left;
  168 + margin-left: 13px;
  169 +}
  170 +
  171 +.new-portf-comm-read-title a {
  172 + font-size: 13px;
  173 + text-decoration: none;
  174 + color: #0072bc;
  175 +}
  176 +
  177 +.new-portf-comm-read-title a:hover {
  178 + text-decoration: underline
  179 +}
  180 +
  181 +.new-portf-comm-read-title {
  182 + margin-top: -5px;
  183 +}
  184 +
  185 +.new-portf-comm-read-rating {
  186 + height: 30px;
  187 + box-sizing: border-box;
  188 + padding-top: 1px
  189 +}
  190 +
  191 +.new-portf-comm-read-rating .rating {
  192 + margin-top: 8px
  193 +}
  194 +
  195 +.new-portf-comm-read-rating .vote-stars, .new-portf-comm-read-rating .vote-active, .new-portfolio-rating .vote-stars, .new-portfolio-rating .vote-active {
  196 + cursor: pointer !important;
  197 +}
  198 +
  199 +.new-portf-answer {
  200 + width: 100%;
  201 + float: left;
  202 + font-size: 13px;
  203 + line-height: 20px;
  204 + margin-top: 10px;
  205 +}
  206 +
  207 +.new-portf-answer p {
  208 + width: 100%;
  209 + float: left;
  210 + font-size: 13px;
  211 + line-height: 20px;
  212 +}
  213 +
  214 +.new-portf-answer p:first-child {
  215 + margin-top: 0
  216 +}
  217 +.style {
  218 + width: 100%;
  219 + float: left;
  220 +}
  221 +
  222 +/***proektant_comments***/
  223 +ul.proektant-comments {
  224 + margin-top: 15px
  225 +}
  226 +
  227 +.proektant-comments li {
  228 + width: 100%;
  229 + float: left;
  230 + list-style: none;
  231 + border-bottom: 1px solid #dcdcdc;
  232 + padding-bottom: 20px;
  233 + margin-top: 27px;
  234 +}
  235 +
  236 +.proektant-comments li:first-child {
  237 + margin-top: 0
  238 +}
  239 +
  240 +.proektant-comments li > div {
  241 + float: left;
  242 + width: 100%;
  243 + font-size: 13px
  244 +}
  245 +
  246 +.comments-name {
  247 + font-weight: 700
  248 +}
  249 +
  250 +.comments-project-link a {
  251 + color: #0073bc;
  252 + text-decoration: underline;
  253 +
  254 +}
  255 +
  256 +.comments-status span {
  257 + color: #0072bc;
  258 + border-bottom: 1px dashed #0072bc;
  259 +}
  260 +
  261 +.comments-status, .comments-date, .proektant-comments .rating {
  262 + margin-top: 3px
  263 +}
  264 +
  265 +.comments-content {
  266 + line-height: 18px;
  267 + margin-top: 11px
  268 +}
  269 +
  270 +.comments-project-link {
  271 + margin-top: 19px
  272 +}
... ...
common/modules/comment/resources/comment.js
1   -$(function() {
2   -
3   - $(document).on('click', '.artbox_comment_delete', function() {
4   - var container = $(this).parents('.artbox_comment_container');
5   - var comment_id = $(container).data('comment_id');
6   - var form_name = $(container).data('form_name');
7   - if(confirm("ะฃะฒะตั€ะตะฝั‹, ั‡ั‚ะพ ั…ะพั‚ะธั‚ะต ัƒะดะฐะปะธั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะน?")) {
8   - $.post(
9   - '/artbox-comment/delete',
10   - {
11   - Comment: {
12   - comment_id: comment_id
13   - }
14   - },
15   - function(data, textStatus, jqXHR) {
16   - if(!data.error) {
17   - $(container).after('<p class="removeable">'+data.text+'</p>');
18   - $(container).remove();
19   - } else {
20   - $(container).prepend('<p class="removeable error_message">'+data.error+'</p>')
21   - }
22   - }
23   - );
24   - }
25   - });
26   -
27   - $(document).on('click', '.artbox_comment_reply', function() {
28   - var container = $(this).parents('.artbox_comment_container').first();
29   - var comment_id = $(container).data('comment_id');
30   - var form_name = $(container).data('form_name');
31   - var author = $(container).find('.artbox_comment_author').first().text();
32   - var comment_form = $('.artbox_comment_form').first();
33   - var offset = $(comment_form).offset();
34   - var reply_block = $(comment_form).find('.artbox_comment_reply_block').first();
35   - $(reply_block).empty();
36   - $(reply_block).append('<input type="hidden" name="'+form_name+'[comment_pid]" value="'+comment_id+'">');
37   - $(reply_block).append('<p class="artbox_comment_reply_author">'+author+'</p>');
38   - $('html, body').animate({
39   - scrollTop: offset.top - 50,
40   - });
41   - });
42   -
43   - $(document).on('click', '.artbox_comment_reply_author', function() {
44   - $(this).parents('.artbox_comment_reply_block').first().empty();
45   - });
46   -
47   - $(document).on('click', '.artbox_comment_update', function() {
48   - $(this).removeClass('artbox_comment_update');
49   - $(this).text('ะกะพั…ั€ะฐะฝะธั‚ัŒ');
50   - $(this).addClass('artbox_comment_update_submit');
51   - var container = $(this).parents('.artbox_comment_container').first();
52   - var comment_id = $(container).data('comment_id');
53   - var form_name = $(container).data('form_name');
54   - var text = $(container).find('.artbox_comment_text');
55   - var object = {};
56   - object[form_name] = {comment_id: comment_id};
57   - $.post(
58   - '/artbox-comment/form',
59   - object,
60   - function(data, textStatus, jqXHR) {
61   - $(text).hide();
62   - $(text).after(
63   - '<div class="artbox_comment_text_edit new-portf-answer">'
64   - + data
65   - + '</div>'
66   - );
67   - }
68   - );
69   - });
70   -
71   - $(document).on('click', '.artbox_comment_update_reply', function() {
72   - $(this).remove();
73   - });
74   -
75   - $(document).on('click', '.artbox_comment_update_submit', function(e) {
76   - e.preventDefault();
77   - var container = $(this).parents('.artbox_comment_container').first();
78   - var edit = $(container).find('.artbox_comment_text_edit').first();
79   - $.post(
80   - '/artbox-comment/update',
81   - $(edit).find('form').serialize(),
82   - function(data) {
83   - if(!data.error) {
84   - location.reload(true);
85   - }
86   - }
87   - )
88   - });
89   -});
90 1 \ No newline at end of file
  2 +$(function() {
  3 +
  4 + function addRemoveBlocks(data)
  5 + {
  6 + $('#overlay, .succses_comm').remove();
  7 + $('body').append('<div id="overlay" style="top:0; left:0;"></div>').append('<div class="succses_comm"><div class="closed-form"></div><div class="succses_comm-txt">'+data.text+'</div></div>');
  8 + $('#overlay').fadeIn(
  9 + 400, function()
  10 + {
  11 + $('.succses_comm').css({display : 'block'}).animate({opacity : 1, top : '50%'}, 200);
  12 + }
  13 + );
  14 + function closeSuccsescomm() {
  15 + $('.succses_comm')
  16 + .animate(
  17 + {opacity : 0, top : '30%'}, 200, function()
  18 + {
  19 + $(this).css('display', 'none')
  20 + $('#overlay').fadeOut(
  21 + 400, function()
  22 + {
  23 + $('#overlay, .succses_comm').remove()
  24 + }
  25 + )
  26 + }
  27 + )
  28 + }
  29 + $('body').on('click', '.closed-form, #overlay', function() {
  30 + closeSuccsescomm()
  31 + }
  32 + );
  33 +
  34 + setTimeout(closeSuccsescomm, 4000)
  35 + }
  36 +
  37 + $(document).on('click', '.artbox_comment_container .removeable', function(e) {
  38 + e.preventDefault();
  39 + $(this).parent().remove();
  40 +// var container = $(this).parents('.artbox_comment_container');
  41 +// $(container).remove();
  42 + });
  43 +
  44 + $(document).on(
  45 + 'click', '.artbox_comment_delete', function(e)
  46 + {
  47 + e.preventDefault();
  48 + var container = $(this).parents('.artbox_comment_container');
  49 + var comment_id = $(container).data('key');
  50 + var form_name = $(container).data('form');
  51 + if(confirm("ะฃะฒะตั€ะตะฝั‹, ั‡ั‚ะพ ั…ะพั‚ะธั‚ะต ัƒะดะฐะปะธั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะน?"))
  52 + {
  53 + $.post(
  54 + '/artbox-comment/delete', {
  55 + Comment : {
  56 + comment_id : comment_id
  57 + }
  58 + }, function(data, textStatus, jqXHR)
  59 + {
  60 + if(!data.error)
  61 + {
  62 + {
  63 + $(container).remove();
  64 + addRemoveBlocks(data)
  65 + // $(container).append('<p class="removeable">' + data.text + '</p>');
  66 + }
  67 + } else
  68 + {
  69 + $(container).prepend('<p class="removeable error_message">' + data.error + '</p>')
  70 + }
  71 + }
  72 + );
  73 + }
  74 + }
  75 + );
  76 +
  77 + $(document).on(
  78 + 'click', '.artbox_comment_reply', function(e)
  79 + {
  80 + e.preventDefault();
  81 + var container = $(this).parents('.artbox_comment_container').first();
  82 + var comment_id = $(container).data('key');
  83 + var form_name = $(container).data('form');
  84 + var author = $(container).find('.artbox_comment_author').first().text();
  85 + var comment_form = $(container).parents('.artbox_comment_widget').find('.artbox_comment_form').first();
  86 + var offset = $(comment_form).offset();
  87 + var reply_block = $(comment_form).find('.artbox_comment_reply_block').first();
  88 + $(reply_block).empty();
  89 + $(reply_block).append('<input type="hidden" name="' + form_name + '[comment_pid]" value="' + comment_id + '">');
  90 + $(reply_block).append('<p class="artbox_comment_reply_author">' + author + '</p>');
  91 + $('html, body').animate(
  92 + {
  93 + scrollTop : offset.top - 50,
  94 + }
  95 + );
  96 + }
  97 + );
  98 +
  99 + $(document).on(
  100 + 'click', '.artbox_comment_reply_author', function()
  101 + {
  102 + $(this).parents('.artbox_comment_reply_block').first().empty();
  103 + }
  104 + );
  105 +
  106 + $(document).on(
  107 + 'click', '.artbox_comment_update', function(e)
  108 + {
  109 + e.preventDefault();
  110 + var container = $(this).parents('.artbox_comment_container').first();
  111 + var comment_id = $(container).data('key');
  112 + var form_name = $(container).data('form');
  113 + var object = {};
  114 + object[form_name] = {comment_id : comment_id};
  115 + $.post(
  116 + '/artbox-comment/form', object, function(data, textStatus, jqXHR)
  117 + {
  118 + $(container).empty();
  119 + $(container).append(data.result.form);
  120 + }
  121 + );
  122 + }
  123 + );
  124 +
  125 + // @TODO What is this
  126 + $(document).on(
  127 + 'click', '.artbox_comment_update_reply', function()
  128 + {
  129 + $(this).remove();
  130 + }
  131 + );
  132 +
  133 + $(document).on(
  134 + 'click', '.artbox_comment_update_submit', function(e)
  135 + {
  136 + e.preventDefault();
  137 + var container = $(this).parents('.artbox_comment_container').first();
  138 + $.post(
  139 + '/artbox-comment/update', $(container).find('form').serialize(), function(data)
  140 + {
  141 + $(container).empty();
  142 + if(!data.error)
  143 + {
  144 + $(container).append('<p>'+data.result.text+'</p>');
  145 + $(container).append(data.result.html);
  146 + } else {
  147 + $(container).append(data.form);
  148 + }
  149 + }
  150 + )
  151 + }
  152 + );
  153 +
  154 + $(document).on(
  155 + 'click', '.artbox_comment_update_answer', function(e)
  156 + {
  157 + e.preventDefault();
  158 + var container = $(this).parents('.artbox_comment_container').first();
  159 + var comment_id = $(container).data('key');
  160 + var form_name = $(container).data('form');
  161 + var object = {};
  162 + object[form_name] = {comment_id : comment_id};
  163 + $.post(
  164 + '/artbox-comment/form-answer', object, function(data, textStatus, jqXHR)
  165 + {
  166 + $(container).empty();
  167 + $(container).append(data.result.form);
  168 + }
  169 + );
  170 + }
  171 + );
  172 +
  173 + $(document).on(
  174 + 'click', '.artbox_comment_update_answer_submit', function(e)
  175 + {
  176 + e.preventDefault();
  177 + var container = $(this).parents('.artbox_comment_container').first();
  178 + $.post(
  179 + '/artbox-comment/update-answer', $(container).find('form').serialize(), function(data)
  180 + {
  181 + $(container).empty();
  182 + if(!data.error)
  183 + {
  184 + $(container).append('<p>'+data.result.text+'</p>');
  185 + $(container).append(data.result.html);
  186 + } else {
  187 + $(container).append(data.form);
  188 + }
  189 + }
  190 + )
  191 + }
  192 + );
  193 +
  194 + $(document).on(
  195 + 'click', '.artbox_comment_delete_answer', function(e)
  196 + {
  197 + e.preventDefault();
  198 + var container = $(this).parents('.artbox_comment_container');
  199 + var comment_id = $(container).data('key');
  200 + var form_name = $(container).data('form');
  201 + if(confirm("ะฃะฒะตั€ะตะฝั‹, ั‡ั‚ะพ ั…ะพั‚ะธั‚ะต ัƒะดะฐะปะธั‚ัŒ ะฒะพะฟั€ะพั?"))
  202 + {
  203 + $.post(
  204 + '/artbox-comment/delete-answer', {
  205 + CommentProjectAnswer : {
  206 + comment_id : comment_id
  207 + }
  208 + }, function(data, textStatus, jqXHR)
  209 + {
  210 + if(!data.error)
  211 + {
  212 + $(container).remove();
  213 + addRemoveBlocks(data)
  214 + } else
  215 + {
  216 + $(container).prepend('<p class="removeable error_message">' + data.error + '</p>')
  217 + }
  218 + }
  219 + );
  220 + }
  221 + }
  222 + );
  223 +
  224 + $(document).on('click', '.artbox_comment_reply_answer', function(e) {
  225 + e.preventDefault();
  226 + var widget = $(this).parents('.artbox_comment_widget');
  227 + var form = $(widget).find('.artbox_comment_form');
  228 + $(form).removeClass('hidden');
  229 + $(widget).find('.artbox_comment_answer_label').text('ะžั‚ะฒะตั‚');
  230 + });
  231 +
  232 + $(document).on('click', '.artbox_comment_reply_answer_block', function(e) {
  233 + var form = $(this).parents('.artbox_comment_form');
  234 + $(form).addClass('hidden');
  235 + $(form).find('.artbox_comment_answer_label').text('ะ’ะพะฟั€ะพั');
  236 + });
  237 +
  238 +});
... ...
common/modules/comment/views/comment_form.php
1   -<?php
2   - /**
3   - * @var \common\modules\comment\models\Comment $model
4   - */
5   - use yii\widgets\ActiveForm;
6   -
7   - $form = ActiveForm::begin();
8   -
9   -?>
10   -<?php
11   - echo $form->field($model, 'comment_id')
12   - ->label(false)
13   - ->hiddenInput();
14   - if(!empty( $model->parent )) {
15   - ?>
16   - <div class="artbox_comment_update_reply">
17   - <?php
18   - echo "<span>";
19   - if(!empty( $model->parent->author )) {
20   - echo $model->parent->author->firstname . ' ' . $model->parent->author->lastname;
21   - } else {
22   - echo $model->parent->user_name;
23   - }
24   - echo "</span>";
25   - echo $form->field($model, 'comment_pid')
26   - ->label(false)
27   - ->hiddenInput();
28   - ?>
29   - </div>
30   - <?php
31   - }
32   - echo $form->field($model, 'text')
33   - ->label(false)
34   - ->textarea();
35   -?>
36   -<?php
37   - $form->end();
  1 +<?php
  2 + /**
  3 + * @var \common\modules\comment\models\Comment $model
  4 + */
  5 + use yii\widgets\ActiveForm;
  6 +
  7 + $form = ActiveForm::begin();
  8 +
  9 +?>
  10 +<?php
  11 + echo $form->field($model, 'comment_id')
  12 + ->label(false)
  13 + ->hiddenInput();
  14 + if(!empty( $model->parent )) {
  15 + ?>
  16 + <div class="artbox_comment_update_reply">
  17 + <?php
  18 + echo "<span>";
  19 + if(!empty( $model->parent->author )) {
  20 + echo $model->parent->author->firstname . ' ' . $model->parent->author->lastname;
  21 + } else {
  22 + echo $model->parent->user_name;
  23 + }
  24 + echo "</span>";
  25 + echo $form->field($model, 'comment_pid')
  26 + ->label(false)
  27 + ->hiddenInput();
  28 + ?>
  29 + </div>
  30 + <?php
  31 + }
  32 + echo $form->field($model, 'text')
  33 + ->label(false)
  34 + ->textarea();
  35 +?>
  36 +<?php
  37 + $form->end();
38 38 ?>
39 39 \ No newline at end of file
... ...
common/modules/comment/widgets/CommentWidget.php
1   -<?php
2   - namespace common\modules\comment\widgets;
3   -
4   - use \yii\helpers\ArrayHelper;
5   - use \yii\helpers\Html;
6   -
7   - class CommentWidget extends \yii\base\Widget
8   - {
9   -
10   - /**
11   - * @var null|\yii\web\View
12   - */
13   - public $context = NULL;
14   -
15   - /**
16   - * @var array Parts of widgets that can be rendered
17   - */
18   - public $parts = [ ];
19   -
20   - public $rating_class = NULL;
21   -
22   - public $rating_options = [ ];
23   -
24   - /**
25   - * @var string|\common\modules\comment\models\Comment
26   - */
27   - public $comment_class;
28   -
29   - /**
30   - * @var array
31   - */
32   - public $class_options = [ ];
33   -
34   - /**
35   - * @var bool Wheather to display comment list
36   - */
37   - public $display_comment_list = true;
38   -
39   - /**
40   - * @var bool Whether to display comment form
41   - */
42   - public $display_comment_form = true;
43   -
44   - /**
45   - * @var bool Whether to display success text
46   - */
47   - public $display_comment_success = true;
48   -
49   - /**
50   - * @var bool Whether to allow one user post multiple comments
51   - */
52   - public $allow_multiple = true;
53   -
54   - /**
55   - * @var array Options sent to list part
56   - */
57   - public $list_options = [
58   - 'tag' => 'div',
59   - 'view' => 'list-comment',
60   - 'class' => 'test-class',
61   - ];
62   -
63   - /**
64   - * @var array Options sent to success part
65   - */
66   - public $success_options = [
67   - 'tag' => 'div',
68   - 'content' => NULL,
69   - 'class' => 'test-class-success',
70   - ];
71   -
72   - /**
73   - * @var array Options sent to form part
74   - */
75   - public $form_options = [
76   - 'tag' => 'div',
77   - 'view' => 'form-comment',
78   - 'class' => 'test-class-form',
79   - ];
80   -
81   - /**
82   - * @var bool Indicates whether any successful action happened
83   - */
84   - protected $isSuccess = false;
85   -
86   - public $success_text = 'Comment successfully added';
87   -
88   - /**
89   - * @var string $model Model, to which comments attached
90   - */
91   - public $model;
92   -
93   - /**
94   - * @var integer $model_id Model id, to which comments attached
95   - */
96   - public $model_id;
97   -
98   - /**
99   - * @var string Template of the widget. You may use <code>{success}, {form}, {list}</code>
100   - * to render particular parts. You are also able to use common HTML here.
101   - */
102   - public $template = "{success}\n{form}\n{list}";
103   -
104   - /**
105   - * @var array Widget options
106   - */
107   - public $options = [ ];
108   -
109   - /**
110   - * @var \yii\data\DataProviderInterface Data provider of comments
111   - */
112   - public $dataProvider;
113   -
114   - /**
115   - * @inheritdoc
116   - */
117   - public function init()
118   - {
119   - parent::init();
120   - \common\modules\comment\assets\CommentAsset::register($this->view);
121   - if(is_string($this->comment_class)) {
122   - $this->comment_class = new $this->comment_class($this->class_options);
123   - } else {
124   - throw new \yii\base\InvalidConfigException(__CLASS__ . '->comment_class must be defined as object full class name string.');
125   - }
126   - if(!empty( $this->rating_class ) && is_string($this->rating_class)) {
127   - $this->rating_class = new $this->rating_class($this->rating_options);
128   - } elseif(!empty( $this->rating_class )) {
129   - throw new \yii\base\InvalidConfigException(__CLASS__ . '->rating_class must be defined as object full class name string.');
130   - }
131   - $this->comment_class->model = $this->model;
132   - $this->comment_class->model_id = $this->model_id;
133   - $this->createDataProvider();
134   - $this->process();
135   - ob_start();
136   - }
137   -
138   - /**
139   - * @inheritdoc
140   - * @return string
141   - */
142   - public function run()
143   - {
144   - $content = ob_get_clean();
145   - $this->createParts();
146   - return $this->renderWidget();
147   - }
148   -
149   - public function createParts()
150   - {
151   - if($this->display_comment_success && $this->isSuccess) {
152   - $tag = ArrayHelper::remove($this->success_options, 'tag', 'div');
153   - if(is_callable($this->success_options[ 'content' ])) {
154   - $result = call_user_func(ArrayHelper::remove($this->success_options, 'content'), $this->success_text);
155   - } elseif($this->success_options[ 'content' ] != NULL) {
156   - $result = Html::encode(ArrayHelper::remove($this->success_options, 'content', $this->success_text));
157   - } else {
158   - $result = Html::encode($this->success_text);
159   - }
160   - $this->parts[ 'success' ] = Html::tag($tag, $result, $this->success_options);
161   - unset( $tag, $result );
162   - }
163   -
164   - if($this->display_comment_list) {
165   - $tag = ArrayHelper::remove($this->list_options, 'tag', 'div');
166   - $view = ArrayHelper::remove($this->list_options, 'view');
167   - $this->parts[ 'list' ] = Html::tag($tag, $this->renderItems($view), $this->list_options);
168   - }
169   -
170   - if($this->display_comment_form && $this->comment_class->checkCreate()) {
171   - $tag = ArrayHelper::remove($this->form_options, 'tag', 'div');
172   - $view = ArrayHelper::remove($this->form_options, 'view');
173   - $this->parts[ 'form' ] = Html::tag($tag, $this->renderForm($view), $this->form_options);
174   - }
175   - }
176   -
177   - public function createDataProvider()
178   - {
179   - $this->dataProvider = new \yii\data\ActiveDataProvider([
180   - 'query' => $this->comment_class->getComments($this->model, $this->model_id),
181   - 'pagination' => [
182   - 'pageSize' => 10,
183   - ],
184   - ]);
185   - }
186   -
187   - public function renderItems($view)
188   - {
189   - if(empty( $view )) {
190   - throw new \yii\base\InvalidConfigException("list_options[view] must be set");
191   - }
192   - return $this->render($view, [ 'dataProvider' => $this->dataProvider ]);
193   - }
194   -
195   - public function renderForm($view)
196   - {
197   - if(empty( $view )) {
198   - throw new \yii\base\InvalidConfigException("form_options[view] must be set");
199   - }
200   - if($this->comment_class->guestComment || !empty(\Yii::$app->user->identity)) {
201   - return $this->render($view, [
202   - 'model' => $this->comment_class,
203   - 'rating' => $this->rating_class,
204   - 'user' => \Yii::$app->user->identity,
205   - 'dataProvider' => $this->dataProvider,
206   - ]);
207   - } else {
208   - return '';
209   - }
210   - }
211   -
212   - public function renderWidget()
213   - {
214   - $template = $this->template;
215   - $parts = $this->parts;
216   - $options = $this->options;
217   - $template = preg_replace('/{success}/', ArrayHelper::remove($parts, 'success', ''), $template);
218   - $template = preg_replace('/{list}/', ArrayHelper::remove($parts, 'list', ''), $template);
219   - $template = preg_replace('/{form}/', ArrayHelper::remove($parts, 'form', ''), $template);
220   - $tag = ArrayHelper::remove($options, 'tag', 'div');
221   - return Html::tag($tag, $template, $options);
222   - }
223   -
224   - public function process()
225   - {
226   - $data = \Yii::$app->request->post();
227   - if($this->comment_class->load($data) && $this->comment_class->postComment()) {
228   - if(is_object($this->rating_class)) {
229   - $this->comment_class->checkRating();
230   - if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) {
231   - $this->isSuccess = true;
232   - }
233   - }
234   - }
235   - }
  1 +<?php
  2 + namespace common\modules\comment\widgets;
  3 +
  4 + use yii\data\Sort;
  5 + use \yii\helpers\ArrayHelper;
  6 + use \yii\helpers\Html;
  7 +
  8 + class CommentWidget extends \yii\base\Widget
  9 + {
  10 +
  11 + /**
  12 + * 'comment_container' - apply to container of one comment. Must have data-key and data-form
  13 + * 'comment_delete' - apply to comment delete link
  14 + * 'comment_reply' - apply to comment reply link
  15 + * 'comment_author' - apply to comment author text wrapper
  16 + * 'widget_container' - apply to comment widget
  17 + * 'form_container' - apply to comment form wrapper
  18 + * 'reply_block' - apply to reply block of comment form
  19 + * 'reply_author' - apply to reply author text block inside of reply block of comment form
  20 + * 'comment_update' - apply to comment update link
  21 + * 'comment_update_submit' - apply to submit button of comment update form
  22 + */
  23 + static $baseClass = [
  24 + 'comment_container' => 'artbox_comment_container',
  25 + 'comment_delete' => 'artbox_comment_delete',
  26 + 'comment_reply' => 'artbox_comment_reply',
  27 + 'comment_author' => 'artbox_comment_author',
  28 + 'widget_container' => 'artbox_comment_widget',
  29 + 'form_container' => 'artbox_comment_form',
  30 + 'reply_block' => 'artbox_comment_reply_block',
  31 + 'reply_author' => 'artbox_comment_reply_author',
  32 + 'comment_update' => 'artbox_comment_update',
  33 + 'comment_update_submit' => 'artbox_comment_update_submit',
  34 + ];
  35 +
  36 + /**
  37 + * @var null|\yii\web\View
  38 + */
  39 + public $context = NULL;
  40 +
  41 + /**
  42 + * @var array Parts of widgets that can be rendered
  43 + */
  44 + public $parts = [ ];
  45 +
  46 + public $rating_class = NULL;
  47 +
  48 + public $rating_options = [ ];
  49 +
  50 + /**
  51 + * @var string|\common\modules\comment\models\Comment
  52 + */
  53 + public $comment_class;
  54 +
  55 + /**
  56 + * @var array
  57 + */
  58 + public $class_options = [ ];
  59 +
  60 + public $provider_options = [ ];
  61 +
  62 + /**
  63 + * @var bool Wheather to display comment list
  64 + */
  65 + public $display_comment_list = true;
  66 +
  67 + /**
  68 + * @var bool Whether to display comment form
  69 + */
  70 + public $display_comment_form = true;
  71 +
  72 + /**
  73 + * @var bool Whether to display success text
  74 + */
  75 + public $display_comment_success = true;
  76 +
  77 + /**
  78 + * @var bool Whether to allow one user post multiple comments
  79 + */
  80 + public $allow_multiple = true;
  81 +
  82 + public $allow_reply = true;
  83 +
  84 + /**
  85 + * @var array Options sent to list part
  86 + */
  87 + public $list_options = [
  88 + 'tag' => 'div',
  89 + 'view' => 'list-comment',
  90 + 'class' => 'test-class',
  91 + ];
  92 +
  93 + /**
  94 + * @var array Options sent to success part
  95 + */
  96 + public $success_options = [
  97 + 'tag' => 'div',
  98 + 'content' => NULL,
  99 + 'class' => 'test-class-success',
  100 + ];
  101 +
  102 + /**
  103 + * @var array Options sent to form part
  104 + */
  105 + public $form_options = [
  106 + 'tag' => 'div',
  107 + 'view' => 'form-comment',
  108 + 'class' => 'test-class-form',
  109 + ];
  110 +
  111 + /**
  112 + * @var bool Indicates whether any successful action happened
  113 + */
  114 + protected $isSuccess = false;
  115 +
  116 + public $success_text = 'Comment successfully added';
  117 +
  118 + /**
  119 + * @var string $model Model, to which comments attached
  120 + */
  121 + public $model;
  122 +
  123 + /**
  124 + * @var integer $model_id Model id, to which comments attached
  125 + */
  126 + public $model_id;
  127 +
  128 + /**
  129 + * @var string Template of the widget. You may use <code>{success}, {form}, {list}</code>
  130 + * to render particular parts. You are also able to use common HTML here.
  131 + */
  132 + public $template = "{success}\n{form}\n{list}";
  133 +
  134 + /**
  135 + * @var array Widget options
  136 + */
  137 + public $options = [ ];
  138 +
  139 + /**
  140 + * @var \yii\data\DataProviderInterface Data provider of comments
  141 + */
  142 + public $dataProvider;
  143 +
  144 + /**
  145 + * @inheritdoc
  146 + */
  147 + public function init()
  148 + {
  149 + parent::init();
  150 + \common\modules\comment\assets\CommentAsset::register($this->view);
  151 + if(is_string($this->comment_class)) {
  152 + $this->comment_class = new $this->comment_class($this->class_options);
  153 + } else {
  154 + throw new \yii\base\InvalidConfigException(__CLASS__ . '->comment_class must be defined as object full class name string.');
  155 + }
  156 + if(!empty( $this->rating_class ) && is_string($this->rating_class)) {
  157 + $this->rating_class = new $this->rating_class($this->rating_options);
  158 + } elseif(!empty( $this->rating_class )) {
  159 + throw new \yii\base\InvalidConfigException(__CLASS__ . '->rating_class must be defined as object full class name string.');
  160 + }
  161 + $this->comment_class->model = $this->model;
  162 + $this->comment_class->model_id = $this->model_id;
  163 + $this->createDataProvider();
  164 + $this->process();
  165 + ob_start();
  166 + }
  167 +
  168 + /**
  169 + * @inheritdoc
  170 + * @return string
  171 + */
  172 + public function run()
  173 + {
  174 + $content = ob_get_clean();
  175 + $this->createParts();
  176 + return $this->renderWidget();
  177 + }
  178 +
  179 + public function createParts()
  180 + {
  181 + if($this->display_comment_success && $this->isSuccess) {
  182 + $tag = ArrayHelper::remove($this->success_options, 'tag', 'div');
  183 + if(is_callable($this->success_options[ 'content' ])) {
  184 + $result = call_user_func(ArrayHelper::remove($this->success_options, 'content'), $this->success_text);
  185 + } elseif($this->success_options[ 'content' ] != NULL) {
  186 + $result = Html::encode(ArrayHelper::remove($this->success_options, 'content', $this->success_text));
  187 + } else {
  188 + $result = Html::encode($this->success_text);
  189 + }
  190 + $this->parts[ 'success' ] = Html::tag($tag, $result, $this->success_options);
  191 + unset( $tag, $result );
  192 + }
  193 +
  194 + if($this->display_comment_list) {
  195 + $tag = ArrayHelper::remove($this->list_options, 'tag', 'div');
  196 + $view = ArrayHelper::remove($this->list_options, 'view');
  197 + $this->parts[ 'list' ] = Html::tag($tag, $this->renderItems($view), $this->list_options);
  198 + }
  199 +
  200 + if($this->display_comment_form && $this->comment_class->checkCreate()) {
  201 + $tag = ArrayHelper::remove($this->form_options, 'tag', 'div');
  202 + $view = ArrayHelper::remove($this->form_options, 'view');
  203 + if(!empty( $this->form_options[ 'class' ] )) {
  204 + $this->form_options[ 'class' ] .= ' ' . self::$baseClass[ 'form_container' ];
  205 + } else {
  206 + $this->form_options[ 'class' ] = self::$baseClass[ 'form_container' ];
  207 + }
  208 + $this->parts[ 'form' ] = Html::tag($tag, $this->renderForm($view), $this->form_options);
  209 + }
  210 + }
  211 +
  212 + public function createDataProvider()
  213 + {
  214 + $this->dataProvider = new \yii\data\ActiveDataProvider([
  215 + 'query' => ArrayHelper::remove($this->provider_options, 'query', $this->comment_class->getComments($this->model, $this->model_id)),
  216 + 'sort' => ArrayHelper::remove($this->provider_options, 'sort', new Sort([
  217 + 'defaultOrder' => [
  218 + 'date_add' => SORT_DESC,
  219 + ],
  220 + ])),
  221 + 'pagination' => ArrayHelper::remove($this->provider_options, 'pagination', [
  222 + 'pageSize' => 10,
  223 + ]),
  224 + ]);
  225 + }
  226 +
  227 + public function renderItems($view)
  228 + {
  229 + if(empty( $view )) {
  230 + throw new \yii\base\InvalidConfigException("list_options[view] must be set");
  231 + }
  232 + return $this->render($view, [
  233 + 'dataProvider' => $this->dataProvider,
  234 + 'commentClass' => $this->comment_class,
  235 + ]);
  236 + }
  237 +
  238 + public function renderForm($view)
  239 + {
  240 + if(empty( $view )) {
  241 + throw new \yii\base\InvalidConfigException("form_options[view] must be set");
  242 + }
  243 + if($this->comment_class->guestComment || !empty( \Yii::$app->user->identity )) {
  244 + return $this->render($view, [
  245 + 'model' => $this->comment_class,
  246 + 'rating' => $this->rating_class,
  247 + 'user' => \Yii::$app->user->identity,
  248 + 'dataProvider' => $this->dataProvider,
  249 + ]);
  250 + } else {
  251 + return '';
  252 + }
  253 + }
  254 +
  255 + public function renderWidget()
  256 + {
  257 + $template = $this->template;
  258 + $parts = $this->parts;
  259 + $options = $this->options;
  260 + $template = preg_replace('/{success}/', ArrayHelper::remove($parts, 'success', ''), $template);
  261 + $template = preg_replace('/{list}/', ArrayHelper::remove($parts, 'list', ''), $template);
  262 + $template = preg_replace('/{form}/', ArrayHelper::remove($parts, 'form', ''), $template);
  263 + $tag = ArrayHelper::remove($options, 'tag', 'div');
  264 + if(!empty( $options[ 'class' ] )) {
  265 + $options[ 'class' ] .= ' ' . self::$baseClass[ 'widget_container' ];
  266 + } else {
  267 + $options[ 'class' ] = self::$baseClass[ 'widget_container' ];
  268 + }
  269 + return Html::tag($tag, $template, $options);
  270 + }
  271 +
  272 + public function process()
  273 + {
  274 + $data = \Yii::$app->request->post();
  275 + if($this->comment_class->load($data) && $this->comment_class->postComment()) {
  276 + if(is_object($this->rating_class)) {
  277 + $this->comment_class->checkRating();
  278 + if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) {
  279 + $this->isSuccess = true;
  280 + \Yii::$app->response->redirect('');
  281 + }
  282 + } else {
  283 + $this->isSuccess = true;
  284 + }
  285 + }
  286 + }
  287 +
236 288 }
237 289 \ No newline at end of file
... ...
common/modules/comment/widgets/views/_project_comment_view.php
1   -<?php
2   - use common\models\User;
3   - use yii\helpers\Html;
4   -
5   - /**
6   - * @var \common\modules\comment\models\CommentProject $model Current comment model
7   - * @var integer $key ID of current comment
8   - * @var integer $index index of current element according
9   - * to current page, starting from 0
10   - * @var \yii\widgets\ListView $widget current ListView instance
11   - * @var User $user
12   - */
13   - $user = $model->user;
14   -?>
15   -<div class="performer-vacancy-sidebar-left-wr">
16   - <div class="performer-vacancy-sidebar-left">
17   - <div class="performer-vacancy-sidebar-img style">
18   - <?= Html::img($user->userInfo->image) ?>
19   - </div>
20   - <div class="performer-vacancy-sidebar-all style">
21   - <div class="performer-vacancy-sidebar-soc style">
22   - <ul>
23   - <?php
24   - if(!empty( $user->userInfo->social_fb )) {
25   - echo '<li>' . Html::a(Html::img('/images/ico-fb.png'), $user->userInfo->social_fb, [ 'target' => '_blank' ]) . '</li>';
26   - }
27   - ?>
28   - <?php
29   - if(!empty( $user->userInfo->social_t )) {
30   - echo '<li>' . Html::a(Html::img('/images/ico-tw.png'), $user->userInfo->social_t, [ 'target' => '_blank' ]) . '</li>';
31   - }
32   - ?>
33   - <?php
34   - if(!empty( $user->userInfo->social_in )) {
35   - echo '<li>' . Html::a(Html::img('/images/ico-in.png'), $user->userInfo->social_in, [ 'target' => '_blank' ]) . '</li>';
36   - }
37   - ?>
38   - <?php
39   - if(!empty( $user->userInfo->social_vk )) {
40   - echo '<li>' . Html::a(Html::img('/images/ico-vk.png'), $user->userInfo->social_vk, [ 'target' => '_blank' ]) . '</li>';
41   - }
42   - ?>
43   - </ul>
44   - </div>
45   - <div class="performer-vacancy-sidebar-views style">
46   - <ul class="style">
47   - <li><img src="/images/sidebar-ico/ico-1.png" alt="">
48   - <div class="sidebarvievstxt"><?= $user->userInfo->view_count ?></div>
49   - </li>
50   - <li><img src="/images/sidebar-ico/ico-9.png" alt="">
51   - <div class="sidebarvievstxt">
52   - <span class="sidebar-views-txt">ะกั‚ะฐั‚ัƒั: </span><?= ( empty( $user->userInfo->busy ) ? 'ะกะฒะพะฑะพะดะตะฝ' : 'ะ—ะฐะฝัั‚' ) ?>
53   - </div>
54   - </li>
55   - <li><img src="/images/sidebar-ico/ico-2.png" alt="">
56   - <div class="sidebarvievstxt">
57   - <span class="sidebar-views-txt">ะะฐ ัะฐะนั‚ะต: </span><?= $user->liveTime ?>
58   - </div>
59   - </li>
60   - <li><img src="/images/sidebar-ico/ico-3.png" alt="">
61   - <div class="sidebarvievstxt"><span class="sidebar-views-txt">ะŸะพัะปะตะดะฝะธะน ะฒะธะทะธั‚:<br></span><?= $user->lastVisit ?>
62   - </div>
63   - </li>
64   - </ul>
65   - <?= Html::a('ะŸะพัะผะพั‚ั€ะตั‚ัŒ ะฟั€ะพั„ะธะปัŒ', $user->link, [ 'class' => 'tender-see-profile style' ]) ?>
66   - </div>
67   - </div>
68   - </div>
69   -</div>
70   -<div class="tender-offer-proj-block-right-wr">
71   - <div class="tender-offer-proj-block-right">
72   - <div class="tender-offer-proj-min-blocks">
73   - <span><?= $model->budget_from . '-' . $model->budget_to . ' ' . $model->currency->label ?></span>
74   - </div>
75   - <div class="tender-offer-proj-min-blocks">
76   - <span><?= $model->term_from . '-' . $model->term_to ?> ะ”ะะฏ</span></div>
77   - </div>
78   - <div class="tender-offer-proj-block-left">
79   - <div class="search-worker-blocks-title-wr">
80   - <div class="search-worker-blocks-title-title"><?= $user->name ?></div>
81   - <div class="rating-new">
82   - <!--ะพั†ะตะฝะบะฐ-->
83   - <input type="hidden" class="val" value="<?= $user->userInfo->rating ?>"/>
84   - </div>
85   - <?= Html::a(count($user->comments) . ' ะพั‚ะทั‹ะฒะพะฒ', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?>
86   - </div>
87   - <div class="tender-offer-proj-txt">
88   - <?= $model->text ?>
89   - </div>
90   - <ul class="download-list-files">
91   - <?php
92   - foreach($model->getFilesList() as $file) {
93   - ?>
94   - <li>
95   - <span></span>
96   - <?= Html::a($file->name, $file->dir, [ 'class' => 'download-link-file' ]) ?>
97   - <?= Html::a('ะกะบะฐั‡ะฐั‚ัŒ', $file->dir, [
98   - 'class' => 'download-link',
99   - 'download' => 'download',
100   - ]) ?>
101   - </li>
102   - <?php
103   - }
104   - ?>
105   - </ul>
106   - </div>
107   - <div class="tender-more-buttons-wr">
108   - <?= Html::a('ะŸะพั€ั‚ั„ะพะปะธะพ', $user->getLink('portfolio'), [ 'class' => 'get-project-new' ]) ?>
109   - <?= Html::a('ะšะพะฝั‚ะฐะบั‚ั‹', $user->link, [ 'class' => 'get-list-new' ]) ?>
110   - </div>
111   - <?php
112   - if(\Yii::$app->user->getId() == $model->owner->user_id) {
113   - ?>
114   - <div class="project_owner_control" style="clear:both">
115   - <span>ะžั‚ะผะตั‚ะธั‚ัŒ ะบะฐะบ: </span>
116   - <?php
117   - echo Html::a('ะฝะพะฒั‹ะน', [ '#' ], [
118   - 'data-project-id' => $model->owner->project_id,
119   - 'data-comment-id' => $model->comment_id,
120   - 'class' => 'artbox_project_make_new',
121   - ]);
122   - echo Html::a('ะบะฐะฝะดะธะดะฐั‚', [ '#' ], [
123   - 'data-project-id' => $model->owner->project_id,
124   - 'data-comment-id' => $model->comment_id,
125   - 'class' => 'artbox_project_make_candidate',
126   - ]);
127   - echo Html::a('ะธัะฟะพะปะฝะธั‚ะตะปัŒ', [ '#' ], [
128   - 'data-project-id' => $model->owner->project_id,
129   - 'data-comment-id' => $model->comment_id,
130   - 'class' => 'artbox_project_make_performer',
131   - ]);
132   - echo Html::a('ะพั‚ะบะฐะทะฐั‚ัŒ', [ '#' ], [
133   - 'data-project-id' => $model->owner->project_id,
134   - 'data-comment-id' => $model->comment_id,
135   - 'class' => 'artbox_project_make_deny',
136   - ]);
137   - ?>
138   - </div>
139   - <?php
140   - }
141   - ?>
142   -
143   -</div>
  1 +<?php
  2 + use common\models\User;
  3 + use kartik\rating\StarRating;
  4 + use yii\helpers\Html;
  5 +
  6 + /**
  7 + * @var \common\modules\comment\models\CommentProject $model Current comment model
  8 + * @var integer $key ID of current comment
  9 + * @var integer $index index of current element according
  10 + * to current page, starting from 0
  11 + * @var \yii\widgets\ListView $widget current ListView instance
  12 + * @var User $user
  13 + */
  14 + $user = $model->user;
  15 +?>
  16 +<div class="performer-vacancy-sidebar-left-wr">
  17 + <div class="performer-vacancy-sidebar-left">
  18 + <div class="performer-vacancy-sidebar-img style">
  19 + <?php
  20 + if(!empty( $user->userInfo->image )) {
  21 + echo Html::img($user->userInfo->image);
  22 + } else {
  23 + echo Html::img('/images/avatar-bg.png');
  24 + }
  25 + ?>
  26 + </div>
  27 + <div class="performer-vacancy-sidebar-all style">
  28 + <div class="performer-vacancy-sidebar-soc style">
  29 + <ul>
  30 + <?php
  31 + if(!empty( $user->userInfo->social_fb )) {
  32 + echo '<li>' . Html::a(Html::img('/images/ico-fb.png'), $user->userInfo->social_fb, [ 'target' => '_blank' ]) . '</li>';
  33 + }
  34 + ?>
  35 + <?php
  36 + if(!empty( $user->userInfo->social_t )) {
  37 + echo '<li>' . Html::a(Html::img('/images/ico-tw.png'), $user->userInfo->social_t, [ 'target' => '_blank' ]) . '</li>';
  38 + }
  39 + ?>
  40 + <?php
  41 + if(!empty( $user->userInfo->social_in )) {
  42 + echo '<li>' . Html::a(Html::img('/images/ico-in.png'), $user->userInfo->social_in, [ 'target' => '_blank' ]) . '</li>';
  43 + }
  44 + ?>
  45 + <?php
  46 + if(!empty( $user->userInfo->social_vk )) {
  47 + echo '<li>' . Html::a(Html::img('/images/ico-vk.png'), $user->userInfo->social_vk, [ 'target' => '_blank' ]) . '</li>';
  48 + }
  49 + ?>
  50 + </ul>
  51 + </div>
  52 + <div class="performer-vacancy-sidebar-views style">
  53 + <ul class="style">
  54 + <li><img src="/images/sidebar-ico/ico-1.png" alt="">
  55 + <div class="sidebarvievstxt"><?= $user->userInfo->view_count ?></div>
  56 + </li>
  57 + <li><img src="/images/sidebar-ico/ico-9.png" alt="">
  58 + <div class="sidebarvievstxt">
  59 + <span class="sidebar-views-txt">ะกั‚ะฐั‚ัƒั: </span><?= ( empty( $user->userInfo->busy ) ? 'ะกะฒะพะฑะพะดะตะฝ' : 'ะ—ะฐะฝัั‚' ) ?>
  60 + </div>
  61 + </li>
  62 + <li><img src="/images/sidebar-ico/ico-2.png" alt="">
  63 + <div class="sidebarvievstxt">
  64 + <span class="sidebar-views-txt">ะะฐ ัะฐะนั‚ะต: </span><?= $user->liveTime ?>
  65 + </div>
  66 + </li>
  67 + <li><img src="/images/sidebar-ico/ico-3.png" alt="">
  68 + <div class="sidebarvievstxt"><span class="sidebar-views-txt">ะŸะพัะปะตะดะฝะธะน ะฒะธะทะธั‚:<br></span><?= $user->lastVisit ?>
  69 + </div>
  70 + </li>
  71 + </ul>
  72 + <?= Html::a('ะŸะพัะผะพั‚ั€ะตั‚ัŒ ะฟั€ะพั„ะธะปัŒ', $user->link, [ 'class' => 'tender-see-profile style',
  73 + 'target' => '_blank',
  74 + ]) ?>
  75 + </div>
  76 + </div>
  77 + </div>
  78 +</div>
  79 +<div class="tender-offer-proj-block-right-wr">
  80 + <div class="tender-offer-proj-block-right">
  81 + <div class="tender-offer-proj-min-blocks">
  82 + <span><?= $model->budget_from . '-' . $model->budget_to . ' ' . $model->currency->label ?></span>
  83 + </div>
  84 + <div class="tender-offer-proj-min-blocks">
  85 + <span><?= $model->term_from . '-' . $model->term_to ?> ะ”ะะฏ</span></div>
  86 + </div>
  87 + <div class="tender-offer-proj-block-left">
  88 + <div class="search-worker-blocks-title-wr">
  89 + <div class="search-worker-blocks-title-title"><?= $user->name ?></div>
  90 + <?php
  91 + echo StarRating::widget([
  92 + 'name' => 'rating_review_comment',
  93 + 'value' => $user->userInfo->rating,
  94 + 'pluginOptions' => [
  95 + 'displayOnly' => true,
  96 + 'size' => 'xxs',
  97 + 'min' => 0,
  98 + 'max' => 10,
  99 + 'stars' => 10,
  100 + ],
  101 + ]);
  102 + ?>
  103 + <?= Html::a(count($user->comments) . ' ะผะฝะตะฝะธะน', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?>
  104 + </div>
  105 + <div class="tender-offer-proj-txt">
  106 + <?= $model->text ?>
  107 + </div>
  108 + <ul class="download-list-files">
  109 + <?php
  110 + foreach($model->getFilesList() as $file) {
  111 + ?>
  112 + <li>
  113 + <span></span>
  114 + <?= Html::a($file->name, $file->dir, [
  115 + 'class' => 'download-link-file',
  116 + 'download' => 'download',
  117 + ]) ?>
  118 + <?= Html::a('ะกะบะฐั‡ะฐั‚ัŒ', $file->dir, [
  119 + 'class' => 'download-link',
  120 + 'download' => 'download',
  121 + ]) ?>
  122 + </li>
  123 + <?php
  124 + }
  125 + ?>
  126 + </ul>
  127 + </div>
  128 + <div class="tender-more-buttons-wr">
  129 + <?= Html::a('ะŸะพั€ั‚ั„ะพะปะธะพ', $user->getLink('portfolio'), [ 'class' => 'get-project-new' ]) ?>
  130 + <?= Html::a('ะšะพะฝั‚ะฐะบั‚ั‹', $user->link, [ 'class' => 'get-list-new' ]) ?>
  131 +
  132 + <?php
  133 + if($model->status == $model::STATUS_ANONYMOUS) {
  134 + echo Html::tag('div', 'ะะฝะพะฝะธะผะฝะพะต ะฟั€ะตะดะปะพะถะตะฝะธะต', [ 'class' => 'project_status' ]);
  135 + }
  136 + if(\Yii::$app->user->getId() == $model->owner->user_id) {
  137 + ?>
  138 + <div class="project_owner_state">
  139 + <p>
  140 + <?php
  141 + switch($model->state) {
  142 + case 1:
  143 + echo 'ะŸั€ะตะดะปะพะถะตะฝะธะต ะฝะต ั€ะฐััะผะพั‚ั€ะตะฝะพ';
  144 + break;
  145 + case 2:
  146 + echo 'ะ˜ัะฟะพะปะฝะธั‚ะตะปัŒ ะฟะพัั‚ะฐะฒะปะตะฝ ะฝะฐ ั€ะฐััะผะพั‚ั€ะตะฝะธะต';
  147 + break;
  148 + case 3:
  149 + echo 'ะ˜ัะฟะพะปะฝะธั‚ะตะปัŒ ะฝะฐะทะฝะฐั‡ะตะฝ ะธัะฟะพะปะฝะธั‚ะตะปะตะผ';
  150 + break;
  151 + case 4:
  152 + echo 'ะ’ั‹ ะพั‚ะบะฐะทะฐะปะธ ะดะฐะฝะฝะพะผัƒ ะธัะฟะพะปะฝะธั‚ะตะปัŽ';
  153 + break;
  154 + case 5:
  155 + echo 'ะ˜ัะฟะพะปะฝะธั‚ะตะปัŒ ะพั‚ะบะฐะทะฐะปัั ะพั‚ ะดะฐะฝะฝะพะณะพ ะฟั€ะตะดะปะพะถะตะฝะธั';
  156 + break;
  157 + }
  158 + ?>
  159 + </p>
  160 + </div>
  161 + <?php
  162 + if($model->state != $model::STATE_TRASH) {
  163 + ?>
  164 + <div class="project_owner_control">
  165 + <span>ะžั‚ะผะตั‚ะธั‚ัŒ ะบะฐะบ: </span>
  166 + <p class="new_mark_"></p>
  167 + <div>
  168 + <?php
  169 + echo Html::a('ะฝะพะฒั‹ะน', [ '#' ], [
  170 + 'data-project-id' => $model->owner->project_id,
  171 + 'data-comment-id' => $model->comment_id,
  172 + 'class' => 'artbox_project_make_new' . ( ( $model->state == $model::STATE_NEW ) ? ' active' : '' ),
  173 + ]);
  174 + echo Html::a('ะบะฐะฝะดะธะดะฐั‚', [ '#' ], [
  175 + 'data-project-id' => $model->owner->project_id,
  176 + 'data-comment-id' => $model->comment_id,
  177 + 'class' => 'artbox_project_make_candidate' . ( ( $model->state == $model::STATE_CANDIDATE ) ? ' active' : '' ),
  178 + ]);
  179 + echo Html::a('ะธัะฟะพะปะฝะธั‚ะตะปัŒ', [ '#' ], [
  180 + 'data-project-id' => $model->owner->project_id,
  181 + 'data-comment-id' => $model->comment_id,
  182 + 'class' => 'artbox_project_make_performer' . ( ( $model->state == $model::STATE_PERFORMER ) ? ' active' : '' ),
  183 + ]);
  184 + echo Html::a('ะพั‚ะบะฐะทะฐั‚ัŒ', [ '#' ], [
  185 + 'data-project-id' => $model->owner->project_id,
  186 + 'data-comment-id' => $model->comment_id,
  187 + 'class' => 'artbox_project_make_deny' . ( ( $model->state == $model::STATE_DENY ) ? ' active' : '' ),
  188 + ]);
  189 + ?>
  190 + </div>
  191 + </div>
  192 + <?php
  193 + }
  194 + }
  195 + ?>
  196 + </div>
  197 +
  198 +
  199 +</div>
... ...
common/modules/comment/widgets/views/_question_comment_view.php 0 โ†’ 100755
  1 +<?php
  2 + use common\models\User;
  3 + use common\modules\comment\widgets\CommentWidget;
  4 + use yii\helpers\Html;
  5 + use yii\web\View;
  6 +
  7 + /**
  8 + * @var View $this
  9 + * @var \common\modules\comment\models\Comment $model Current comment model
  10 + * @var integer $key ID of current comment
  11 + * @var integer $index index of current element according
  12 + * to current page, starting from 0
  13 + * @var \yii\widgets\ListView $widget current ListView instance
  14 + * @var User $user
  15 + */
  16 + $user = $model->user;
  17 + if(empty( $model->comment_pid )) {
  18 + $model->buildButtons([
  19 + 'reply',
  20 + 'delete',
  21 + ]);
  22 + }
  23 +?>
  24 + <div class="<?= ( ( !empty( $model->child ) ) ? 'has-child' : '' ) ?>">
  25 + <div class="header-cabinet-foto" style="background: none;"><?= Html::img(( !empty( $model->user ) && !empty( $model->user->userInfo->image ) ) ? $model->user->minImg($model->user->userInfo->image, 48, 48) : '/images/ico-profile.png') ?></div>
  26 + <div style="width: 500px; float: left; margin-left: 12px;">
  27 + <div class="comments-name style <?= CommentWidget::$baseClass[ 'comment_author' ] ?>">
  28 + <a href="/"><?= $model->getAuthor(' (ะ“ะพัั‚ัŒ)') ?></a>
  29 +
  30 + </div>
  31 +
  32 + <?php
  33 + /* == STATUS PRO ==
  34 + ?>
  35 + <div class="comments-status"><span>Pro</span></div>
  36 + <?php
  37 + */
  38 + ?>
  39 + <div class="blog-post-date style">
  40 + <span></span>
  41 + <p><?= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?></p>
  42 + </div>
  43 + <!-- <div class="comments-date style">--><? //= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?><!--</div>-->
  44 + </div>
  45 + <div class="comments-content">
  46 + <div class="style" style="font-weight: 700;">ะ’ะพะฟั€ะพั</div>
  47 + <div class="style" style="margin-top: 2px"><?= $model->text ?></div>
  48 + </div>
  49 + <?php
  50 + if(!empty( $model->child )) {
  51 + echo Html::tag('div', $this->render('@common/modules/comment/widgets/views/_question_comment_view', [
  52 + 'model' => $model->child,
  53 + 'key' => $key,
  54 + 'index' => $index,
  55 + 'widget' => $widget,
  56 + ]), [
  57 + 'class' => CommentWidget::$baseClass[ 'comment_container' ],
  58 + 'data' => [
  59 + 'key' => $model->child->comment_id,
  60 + 'form' => $model->formName(),
  61 + ],
  62 + ]);
  63 + }
  64 + ?>
  65 + <?php
  66 + if(array_filter($model->buttons)) {
  67 + ?>
  68 + <div class="buutons_comm style" style="margin-top: 15px">
  69 + <?php
  70 + if(!empty( $model->buttons[ 'delete' ] )) {
  71 + echo Html::a(( $model->user_id != NULL && $model->user_id == \Yii::$app->user->id ) ? 'ะฃะดะฐะปะธั‚ัŒ' : 'ะŸะพะถะฐะปะพะฒะฐั‚ัŒัั ', $model->buttons[ 'delete' ], [ 'class' => 'artbox_comment_delete_answer' ]);
  72 + }
  73 + if(!empty( $model->buttons[ 'update' ] )) {
  74 + echo Html::a('ะ ะตะดะฐะบั‚ะธั€ะพะฒะฐั‚ัŒ', $model->buttons[ 'update' ], [ 'class' => 'artbox_comment_update_answer' ]);
  75 + }
  76 + if(!empty( $model->buttons[ 'reply' ] )) {
  77 + echo Html::a('ะžั‚ะฒะตั‚ะธั‚ัŒ', $model->buttons[ 'reply' ], [ 'class' => CommentWidget::$baseClass[ 'comment_reply' ] . ' artbox_comment_reply_answer' ]);
  78 + }
  79 + ?>
  80 + </div>
  81 + <?php
  82 + }
  83 + ?>
  84 + </div>
  85 +<?php
  86 + /* == PROJECT INFO ==
  87 + ?>
  88 + <div class="comments-project-link">ะŸั€ะพะตะบั‚: <a href="#">ะ ะตะผะพะฝั‚ ัะฟะฐะปัŒะฝะธ</a></div>
  89 + <?php
  90 + */
  91 +?>
0 92 \ No newline at end of file
... ...
common/modules/comment/widgets/views/_review_comment_view.php
1   -<?php
2   - use common\models\User;
3   - use yii\helpers\Html;
4   -
5   - /**
6   - * @var \common\modules\comment\models\Comment $model Current comment model
7   - * @var integer $key ID of current comment
8   - * @var integer $index index of current element according
9   - * to current page, starting from 0
10   - * @var \yii\widgets\ListView $widget current ListView instance
11   - * @var User $user
12   - */
13   - $user = $model->user;
14   -?>
15   - <div class="comments-name">
16   - <?php
17   - if(!empty($user)) {
18   - echo $user->name;
19   - } else {
20   - echo $model->user_name;
21   - }
22   - ?>
23   - </div>
24   -<?php
25   - /* == STATUS PRO ==
26   - ?>
27   - <div class="comments-status"><span>Pro</span></div>
28   - <?php
29   - */
30   -?>
31   - <div class="comments-date"><?= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?></div>
32   -<?php
33   - if(!empty( $model->rating )) {
34   - ?>
35   - <div class="rating">
36   - <!--ะพั†ะตะฝะบะฐ-->
37   - <input type="hidden" class="val" value="<?= $model->rating->value ?>"/>
38   - </div>
39   - <?php
40   - }
41   -?>
42   - <div class="comments-content">
43   - <?= $model->text ?>
44   - </div>
45   -<?php
46   - /* == PROJECT INFO ==
47   - ?>
48   - <div class="comments-project-link">ะŸั€ะพะตะบั‚: <a href="#">ะ ะตะผะพะฝั‚ ัะฟะฐะปัŒะฝะธ</a></div>
49   - <?php
50   - */
  1 +<?php
  2 + use common\models\User;
  3 + use common\modules\comment\widgets\CommentWidget;
  4 + use kartik\rating\StarRating;
  5 + use yii\helpers\Html;
  6 + use yii\web\View;
  7 +
  8 + /**
  9 + * @var View $this
  10 + * @var \common\modules\comment\models\Comment $model Current comment model
  11 + * @var integer $key ID of current comment
  12 + * @var integer $index index of current element according
  13 + * to current page, starting from 0
  14 + * @var \yii\widgets\ListView $widget current ListView instance
  15 + * @var User $user
  16 + */
  17 + $user = $model->user;
  18 + $model->buildButtons([ 'delete' ]);
  19 +?>
  20 + <div class="comments-name <?= CommentWidget::$baseClass[ 'comment_author' ] ?>">
  21 + <?= $model->getAuthor(' (ะ“ะพัั‚ัŒ)') ?>
  22 + </div>
  23 +<?php
  24 + /* == STATUS PRO ==
  25 + ?>
  26 + <div class="comments-status"><span>Pro</span></div>
  27 + <?php
  28 + */
  29 +?>
  30 + <div class="comments-date"><?= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?></div>
  31 +<?php
  32 + if(!empty( $model->rating )) {
  33 + echo StarRating::widget([
  34 + 'name' => 'rating_review_comment',
  35 + 'value' => $model->rating->value,
  36 + 'pluginOptions' => [
  37 + 'size' => 'xxs',
  38 + 'displayOnly' => true,
  39 + 'min' => 0,
  40 + 'max' => 5,
  41 + 'stars' => 5,
  42 + ],
  43 + ]);
  44 + }
  45 +?>
  46 + <div class="comments-content">
  47 + <?= $model->text ?>
  48 + </div>
  49 + <div>
  50 + <?php
  51 + if(!empty( $model->buttons[ 'delete' ] )) {
  52 + echo Html::a(( $model->user_id != NULL && $model->user_id == \Yii::$app->user->id ) ? 'ะฃะดะฐะปะธั‚ัŒ' : 'ะŸะพะถะฐะปะพะฒะฐั‚ัŒัั ', $model->buttons[ 'delete' ], [ 'class' => CommentWidget::$baseClass[ 'comment_delete' ] ]);
  53 + }
  54 + if(!empty( $model->buttons[ 'update' ] )) {
  55 + echo Html::a('ะ ะตะดะฐะบั‚ะธั€ะพะฒะฐั‚ัŒ', $model->buttons[ 'update' ], [ 'class' => CommentWidget::$baseClass[ 'comment_update' ] ]);
  56 + }
  57 + if(!empty( $model->buttons[ 'reply' ] )) {
  58 + echo Html::a('ะžั‚ะฒะตั‚ะธั‚ัŒ', $model->buttons[ 'reply' ], [ 'class' => CommentWidget::$baseClass[ 'comment_reply' ] ]);
  59 + }
  60 + ?>
  61 + </div>
  62 +<?php
  63 + /* == PROJECT INFO ==
  64 + ?>
  65 + <div class="comments-project-link">ะŸั€ะพะตะบั‚: <a href="#">ะ ะตะผะพะฝั‚ ัะฟะฐะปัŒะฝะธ</a></div>
  66 + <?php
  67 + */
51 68 ?>
52 69 \ No newline at end of file
... ...
common/modules/comment/widgets/views/form-comment-answer.php 0 โ†’ 100755
  1 +<?php
  2 + /**
  3 + * @var \common\modules\comment\models\Comment $model
  4 + * @var \common\models\User $user
  5 + * @var \yii\data\ActiveDataProvider $dataProvider
  6 + * @var null|\common\modules\comment\models\Rating $rating
  7 + */
  8 + use common\models\Project;
  9 + use yii\widgets\ActiveForm;
  10 + use yii\helpers\Html;
  11 +
  12 +?>
  13 +<?php
  14 + if(!empty( $model->model_id )) {
  15 + $project = Project::findOne($model->model_id);
  16 + }
  17 + if(!empty( $project ) && $project->user_id != \Yii::$app->user->id) {
  18 + ?>
  19 + <div class="tender-add-answer-title fix_tender_answer">ะ—ะฐะดะฐั‚ัŒ ะฒะพะฟั€ะพั</div>
  20 + <?php
  21 + }
  22 +?>
  23 +<div class="new-portf-add-comm style tender_questions_" style="padding-top: 16px">
  24 +
  25 + <?php
  26 + if(!empty( \Yii::$app->user->id )) { ?>
  27 + <div class="form-ico-ded-wr" style="width: 100%">
  28 + <div class="header-cabinet-foto">
  29 + <img src="<?php echo \Yii::$app->user->identity->userInfo->image; ?>" alt="">
  30 + </div>
  31 + <div class="form-value-ded-name"><?php echo \Yii::$app->user->identity->name; ?></div>
  32 + </div>
  33 +
  34 +
  35 + <?php
  36 + }
  37 + $form = ActiveForm::begin(['options' => ['data' => ['pjax' => true]]]);
  38 + if(!$model->isNewRecord) {
  39 + echo $form->field($model, 'comment_id')
  40 + ->hiddenInput()
  41 + ->label(false)
  42 + ->error(false);
  43 + }
  44 + if(!empty( $model->comment_pid )) {
  45 + echo $form->field($model, 'comment_pid')
  46 + ->hiddenInput()
  47 + ->label(false)
  48 + ->error(false);
  49 + }
  50 + if($model->scenario == $model::SCENARIO_GUEST) {
  51 + echo $form->field($model, 'user_name', [
  52 + 'options' => [
  53 + 'class' => 'input-blocks-comm',
  54 + ],
  55 + 'inputOptions' => [
  56 + 'class' => 'custom-input-4',
  57 + ],
  58 + ])
  59 + ->textInput();
  60 + echo $form->field($model, 'user_email', [
  61 + 'options' => [
  62 + 'class' => 'input-blocks-comm',
  63 + ],
  64 + 'inputOptions' => [
  65 + 'class' => 'custom-input-4',
  66 + ],
  67 + ])
  68 + ->textInput();
  69 + }
  70 +
  71 + ?>
  72 + <div class="artbox_comment_reply_block artbox_comment_reply_answer_block"></div>
  73 + <?php
  74 +
  75 + echo $form->field($model, 'text', [
  76 + 'options' => [
  77 + 'class' => 'input-blocks-comm area-comm tender_com_fix_',
  78 + ],
  79 + 'inputOptions' => [
  80 + 'class' => 'custom-area-4',
  81 + ],
  82 + ])
  83 + ->label($model->isNewRecord ? 'ะ’ะพะฟั€ะพั' : 'ะžั‚ะฒะตั‚', [ 'class' => 'artbox_comment_answer_label' ])
  84 + ->textarea();
  85 + ?>
  86 + <div class="input-blocks-comm-button style">
  87 + <?php
  88 + if($model->isNewRecord) {
  89 + echo Html::submitButton('ะ—ะฐะดะฐั‚ัŒ ะฒะพะฟั€ะพั');
  90 + } else {
  91 + echo Html::submitButton('ะžะฑะฝะพะฒะธั‚ัŒ ะฒะพะฟั€ะพั', [ 'class' => 'artbox_comment_update_answer_submit' ]);
  92 + }
  93 + ?>
  94 + </div>
  95 + <?php
  96 + $form->end();
  97 + ?>
  98 +</div>
0 99 \ No newline at end of file
... ...
common/modules/comment/widgets/views/form-comment-review.php
1   -<?php
2   - /**
3   - * @var \common\modules\comment\models\Comment $model
4   - * @var \common\models\User $user
5   - * @var \yii\data\ActiveDataProvider $dataProvider
6   - * @var null|\common\modules\comment\models\Rating $rating
7   - */
8   - use yii\widgets\ActiveForm;
9   - use yii\helpers\Html;
10   -
11   -?>
12   -<div class="workplace-title style">
13   - <p></p>ะœะฝะตะฝะธั ะพ ะฟะพะปัŒะทะพะฒะฐั‚ะตะปะต: <?= $dataProvider->totalCount ?></p></div>
14   -<div class="new-portf-add-comm style">
15   - <?php
16   - $form = ActiveForm::begin();
17   - echo $form->field($rating, 'value')
18   - ->label(false)
19   - ->radioList([
20   - 1 => 1,
21   - 2 => 2,
22   - 3 => 3,
23   - 4 => 4,
24   - 5 => 5,
25   - ]);
26   - if($model->scenario == $model::SCENARIO_GUEST) {
27   - echo $form->field($model, 'user_name', [
28   - 'options' => [
29   - 'class' => 'input-blocks-comm',
30   - ],
31   - 'inputOptions' => [
32   - 'class' => 'custom-input-4',
33   - ],
34   - ])
35   - ->textInput();
36   - echo $form->field($model, 'user_email', [
37   - 'options' => [
38   - 'class' => 'input-blocks-comm',
39   - ],
40   - 'inputOptions' => [
41   - 'class' => 'custom-input-4',
42   - ],
43   - ])
44   - ->textInput();
45   - }
46   -
47   - ?>
48   - <div class="artbox_comment_reply_block"></div>
49   - <?php
50   - echo $form->field($model, 'text', [
51   - 'options' => [
52   - 'class' => 'input-blocks-comm area-comm',
53   - ],
54   - 'inputOptions' => [
55   - 'class' => 'custom-area-4',
56   - ],
57   - ])
58   - ->textarea();
59   - ?>
60   - <div class="input-blocks-comm-button style">
61   - <?= Html::submitButton('ะ”ะพะฑะฐะฒะธั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะน') ?>
62   - </div>
63   - <?php
64   - $form->end();
65   - ?>
  1 +<?php
  2 + /**
  3 + * @var View $this
  4 + * @var \common\modules\comment\models\Comment $model
  5 + * @var \common\models\User $user
  6 + * @var \yii\data\ActiveDataProvider $dataProvider
  7 + * @var null|\common\modules\comment\models\Rating $rating
  8 + */
  9 + use common\modules\comment\widgets\CommentWidget;
  10 + use kartik\rating\StarRating;
  11 + use yii\web\View;
  12 + use yii\widgets\ActiveForm;
  13 + use yii\helpers\Html;
  14 +
  15 +?>
  16 +<div class="new-portf-add-comm style">
  17 + <?php
  18 + $form = ActiveForm::begin();
  19 + if(!$model->isNewRecord) {
  20 + echo $form->field($model, 'comment_id')
  21 + ->hiddenInput()
  22 + ->label(false)
  23 + ->error(false);
  24 + }
  25 + echo $form->field(( !empty( $model->rating ) ? $model->rating : $rating ), 'value')
  26 + ->label(false)
  27 + ->widget(StarRating::className(), [
  28 + 'pluginOptions' => [
  29 + 'size' => 'xxs',
  30 + 'step' => 1,
  31 + 'value' => 2,
  32 + 'showCaption' => false,
  33 + 'stars' => 5,
  34 + 'min' => 0,
  35 + 'max' => 5,
  36 + ],
  37 + ]);
  38 + if($model->scenario == $model::SCENARIO_GUEST) {
  39 + echo $form->field($model, 'user_name', [
  40 + 'options' => [
  41 + 'class' => 'input-blocks-comm',
  42 + ],
  43 + 'inputOptions' => [
  44 + 'class' => 'custom-input-4',
  45 + ],
  46 + ])
  47 + ->textInput();
  48 + echo $form->field($model, 'user_email', [
  49 + 'options' => [
  50 + 'class' => 'input-blocks-comm',
  51 + ],
  52 + 'inputOptions' => [
  53 + 'class' => 'custom-input-4',
  54 + ],
  55 + ])
  56 + ->textInput();
  57 + }
  58 + if(!empty( $model->comment_pid )) {
  59 + echo Html::tag('div', Html::activeHiddenInput($model, 'comment_pid') . Html::tag('p', $model->parent->author, [ 'class' => 'artbox_comment_reply_author' ]), [ 'class' => CommentWidget::$baseClass[ 'reply_block' ] ]);
  60 + } else {
  61 + echo Html::tag('div', '', [ 'class' => CommentWidget::$baseClass[ 'reply_block' ] . ' test_class' ]);
  62 + }
  63 + echo $form->field($model, 'text', [
  64 + 'options' => [
  65 + 'class' => 'input-blocks-comm area-comm',
  66 + ],
  67 + 'inputOptions' => [
  68 + 'class' => 'custom-area-4',
  69 + ],
  70 + ])
  71 + ->textarea();
  72 + ?>
  73 + <div class="input-blocks-comm-button style">
  74 + <?php
  75 + if($model->isNewRecord) {
  76 + echo Html::submitButton('ะ”ะพะฑะฐะฒะธั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะน');
  77 + } else {
  78 + echo Html::submitButton('ะžะฑะฝะพะฒะธั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะน', [ 'class' => CommentWidget::$baseClass[ 'comment_update_submit' ] ]);
  79 + }
  80 + ?>
  81 + </div>
  82 + <?php
  83 + $form->end();
  84 + ?>
66 85 </div>
67 86 \ No newline at end of file
... ...
common/modules/comment/widgets/views/form-comment.php
1   -<?php
2   - /**
3   - * @var \common\modules\comment\models\Comment $model
4   - * @var \common\models\User $user
5   - * @var \yii\data\ActiveDataProvider $dataProvider
6   - * @var null|\common\modules\comment\models\Rating $rating
7   - */
8   - use yii\widgets\ActiveForm;
9   - use yii\helpers\Html;
10   -
11   -?>
12   -<div class="new-portf-comm-count">ะšะพะผะผะตะฝั‚ะฐั€ะธะธ: <?= $dataProvider->totalCount ?></div>
13   -
14   -<div class="new-portf-add-comm style">
15   -
16   - <?php
17   - $form = ActiveForm::begin();
18   -
19   - echo $form->field($rating, 'value')
20   - ->label(false)
21   - ->radioList([
22   - 1 => 1,
23   - 2 => 2,
24   - 3 => 3,
25   - 4 => 4,
26   - 5 => 5,
27   - ]);
28   -
29   - if($model->scenario == $model::SCENARIO_GUEST) {
30   - echo $form->field($model, 'user_name', [
31   - 'options' => [
32   - 'class' => 'input-blocks-comm',
33   - ],
34   - 'inputOptions' => [
35   - 'class' => 'custom-input-4',
36   - ],
37   - ])
38   - ->textInput();
39   - echo $form->field($model, 'user_email', [
40   - 'options' => [
41   - 'class' => 'input-blocks-comm',
42   - ],
43   - 'inputOptions' => [
44   - 'class' => 'custom-input-4',
45   - ],
46   - ])
47   - ->textInput();
48   - }
49   -
50   - ?>
51   - <div class="artbox_comment_reply_block"></div>
52   - <?php
53   -
54   - echo $form->field($model, 'text', [
55   - 'options' => [
56   - 'class' => 'input-blocks-comm area-comm',
57   - ],
58   - 'inputOptions' => [
59   - 'class' => 'custom-area-4',
60   - ],
61   - ])
62   - ->textarea();
63   - ?>
64   - <div class="input-blocks-comm-button style">
65   - <?= Html::submitButton('ะ”ะพะฑะฐะฒะธั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะน') ?>
66   - </div>
67   - <?php
68   - $form->end();
69   - ?>
  1 +<?php
  2 + /**
  3 + * @var \common\modules\comment\models\Comment $model
  4 + * @var \common\models\User $user
  5 + * @var \yii\data\ActiveDataProvider $dataProvider
  6 + * @var null|\common\modules\comment\models\Rating $rating
  7 + */
  8 + use kartik\rating\StarRating;
  9 + use yii\widgets\ActiveForm;
  10 + use yii\helpers\Html;
  11 +
  12 +?>
  13 +<div class="new-portf-comm-count">ะšะพะผะผะตะฝั‚ะฐั€ะธะธ: <?= $dataProvider->totalCount ?></div>
  14 +
  15 +<div class="new-portf-add-comm style">
  16 +
  17 + <?php
  18 + $form = ActiveForm::begin();
  19 + if($rating) {
  20 + echo $form->field(( !empty( $model->rating ) ? $model->rating : $rating ), 'value')
  21 + ->label(false)
  22 + ->widget(StarRating::className(), [
  23 + 'pluginOptions' => [
  24 + 'size' => 'xxs',
  25 + 'step' => 1,
  26 + 'value' => 2,
  27 + 'showCaption' => false,
  28 + 'min' => 0,
  29 + 'max' => 10,
  30 + 'stars' => 10,
  31 + ],
  32 + ]);
  33 + }
  34 +
  35 + if($model->scenario == $model::SCENARIO_GUEST) {
  36 + echo $form->field($model, 'user_name', [
  37 + 'options' => [
  38 + 'class' => 'input-blocks-comm fix_marg_',
  39 + ],
  40 + 'inputOptions' => [
  41 + 'class' => 'custom-input-4',
  42 + ],
  43 + ])
  44 + ->textInput();
  45 + echo $form->field($model, 'user_email', [
  46 + 'options' => [
  47 + 'class' => 'input-blocks-comm',
  48 + ],
  49 + 'inputOptions' => [
  50 + 'class' => 'custom-input-4',
  51 + ],
  52 + ])
  53 + ->textInput()
  54 + ->hint('ะ’ะฐัˆ email ะฝะต ะฑัƒะดะตั‚ ะดะพัั‚ัƒะฟะตะฝ ะบ ะฟั€ะพัะผะพั‚ั€ัƒ.');
  55 + }
  56 +
  57 + ?>
  58 + <div class="artbox_comment_reply_block"></div>
  59 + <?php
  60 +
  61 + echo $form->field($model, 'text', [
  62 + 'options' => [
  63 + 'class' => 'input-blocks-comm area-comm',
  64 + ],
  65 + 'inputOptions' => [
  66 + 'class' => 'custom-area-4',
  67 + ],
  68 + ])
  69 + ->textarea();
  70 + ?>
  71 + <div class="input-blocks-comm-button style">
  72 + <?= Html::submitButton('ะ”ะพะฑะฐะฒะธั‚ัŒ ะบะพะผะผะตะฝั‚ะฐั€ะธะน') ?>
  73 + </div>
  74 + <?php
  75 + $form->end();
  76 + ?>
70 77 </div>
71 78 \ No newline at end of file
... ...
common/modules/comment/widgets/views/form-project-comment.php
1   -<?php
2   - /**
3   - * @var \common\modules\comment\models\CommentProject $model
4   - * @var \common\models\User $user
5   - * @var \yii\data\ActiveDataProvider $dataProvider
6   - */
7   - use common\models\Currency;
8   - use yii\widgets\ActiveForm;
9   - use yii\helpers\Html;
10   -
11   - $currencies = Currency::getCurrencyDropdown();
12   -?>
13   -
14   -<div class="new-portf-add-comm style">
15   - <div class="box-wr">
16   - <div class="box-all">
17   - <div class="tender-add-answer-title"><?= Yii::t('app', 'add_answer') ?></div>
18   - <div class="form-tender-answer style">
19   - <?php
20   - $form = ActiveForm::begin([ 'options' => [ 'class' => 'resformsfile MultiFile-intercepted', 'enctype' => 'multipart/form-data' ] ]);
21   - ?>
22   - <div class="form-value-wr style">
23   - <div class="form-ico-ded-wr">
24   - <div class="header-cabinet-foto">
25   - <?= Html::img(($user->userInfo->image)?:'') ?>
26   - </div>
27   - <div class="form-value-ded-name">
28   - <?= $user->name ?>
29   - </div>
30   - </div>
31   - <div class="form-value-price-wr">
32   - <div class="form-value-price-title">ะกั‚ะพะธะผะพัั‚ัŒ</div>
33   - <div class="form-price-wr">
34   - <?= $form->field($model, 'budget_from', [
35   - 'template' => "{input}\n{error}",
36   - 'options' => [ 'tag' => 'span' ],
37   - ])
38   - ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_from') ]) ?>
39   - <?= $form->field($model, 'budget_to', [
40   - 'template' => "{input}\n{error}",
41   - 'options' => [ 'tag' => 'span' ],
42   - ])
43   - ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_to') ]) ?>
44   - <?= $form->field($model, 'budget_currency', [
45   - 'template' => "{input}<div class='select-after'></div>\n{error}",
46   - 'options' => [ 'class' => 'blocks-check-list-wrapp check-valuta' ],
47   - ])
48   - ->dropDownList($currencies) ?>
49   - </div>
50   - </div>
51   - <div class="form-value-price-wr" style="float: right">
52   - <div class="form-value-price-title">
53   - ะกั€ะพะบะธ(<span style="font-weight: normal">ะฒ ะดะฝัั…</span>)
54   - </div>
55   - <div class="form-price-wr">
56   - <?= $form->field($model, 'term_from', [
57   - 'template' => "{input}\n{error}",
58   - 'options' => [ 'tag' => 'span' ],
59   - ])
60   - ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_from') ]) ?>
61   - <?= $form->field($model, 'term_to', [
62   - 'template' => "{input}\n{error}",
63   - 'options' => [ 'tag' => 'span' ],
64   - ])
65   - ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_to') ]) ?>
66   - </div>
67   - </div>
68   - </div>
69   - <?= $form->field($model, 'text', [
70   - 'template' => "{input}\n{error}",
71   - 'options' => [ 'class' => 'form-tender-txt style' ],
72   - ])
73   - ->textarea([ 'placeholder' => $model->getAttributeLabel('text') ]) ?>
74   - <div class="tender-file-wr">
75   - <?= $form->field($model, 'file[]')
76   - ->fileInput([ 'class' => 'multi' ])
77   - ->label(false) ?>
78   - <a href="#" class="addfilemulti">ะŸั€ะธะบั€ะตะฟะธั‚ัŒ ั„ะฐะนะป</a>
79   - <div class="max-size">ะœะฐะบัะธะผะฐะปัŒะฝั‹ะน ั€ะฐะทะผะตั€<br/>ั„ะฐะนะปะฐ 5 ะœะ‘</div>
80   - </div>
81   - <div class="tender-form-buttons-wr">
82   - <?php
83   - echo Html::submitInput('ะŸะพะดะฐั‚ัŒ ะทะฐัะฒะบัƒ', [ 'class' => 'get-project-new' ]);
84   - echo Html::submitInput('ะพั‚ะฒะตั‚ะธั‚ัŒ ะฐะฝะพะฝะธะผะฝะพ', [
85   - 'class' => 'get-list-new',
86   - 'name' => 'CommentProject[anonymous]',
87   - ]);
88   - echo Html::a('ะžั‡ะธัั‚ะธั‚ัŒ', [
89   - 'tender/view',
90   - 'tender_id' => \Yii::$app->request->get('tender_id'),
91   - '#' => 'w1',
92   - ]);
93   - ?>
94   - </div>
95   - <?php
96   - $form->end();
97   - ?>
98   - </div>
99   - </div>
100   - </div>
  1 +<?php
  2 + /**
  3 + * @var \common\modules\comment\models\CommentProject $model
  4 + * @var \common\models\User $user
  5 + * @var \yii\data\ActiveDataProvider $dataProvider
  6 + */
  7 + use common\models\Currency;
  8 + use yii\widgets\ActiveForm;
  9 + use yii\helpers\Html;
  10 +
  11 + $currencies = Currency::getCurrencyDropdown();
  12 +?>
  13 +<div class="tender-add-answer-title fix_tender_answer"><?= Yii::t('app', 'add_answer') ?></div>
  14 +<div class="new-portf-add-comm style fix-portf_">
  15 +
  16 +
  17 +
  18 + <div class="form-tender-answer _fix_errors_tender style">
  19 + <?php
  20 + $form = ActiveForm::begin([ 'options' => [ 'class' => 'resformsfile MultiFile-intercepted', 'enctype' => 'multipart/form-data', 'data' => ['pjax' => true] ] ]);
  21 + ?>
  22 + <div class="form-value-wr style">
  23 + <div class="form-ico-ded-wr">
  24 + <div class="header-cabinet-foto">
  25 + <?= Html::img(($user->userInfo->image)?:'') ?>
  26 + </div>
  27 + <div class="form-value-ded-name">
  28 + <?= $user->name ?>
  29 + </div>
  30 + </div>
  31 + <div class="form-value-price-wr">
  32 + <div class="form-value-price-title">ะกั‚ะพะธะผะพัั‚ัŒ</div>
  33 + <div class="form-price-wr">
  34 + <?= $form->field($model, 'budget_from', [
  35 + 'template' => "{input}\n{error}",
  36 + 'options' => [ 'tag' => 'span' ],
  37 + ])
  38 + ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_from') ]) ?>
  39 + <?= $form->field($model, 'budget_to', [
  40 + 'template' => "{input}\n{error}",
  41 + 'options' => [ 'tag' => 'span' ],
  42 + ])
  43 + ->input('number', [ 'placeholder' => $model->getAttributeLabel('budget_to') ]) ?>
  44 + <?= $form->field($model, 'budget_currency', [
  45 + 'template' => "{input}<div class='select-after'></div>\n{error}",
  46 + 'options' => [ 'class' => 'blocks-check-list-wrapp check-valuta' ],
  47 + ])
  48 + ->dropDownList($currencies) ?>
  49 + </div>
  50 + </div>
  51 + <div class="form-value-price-wr" style="float: right">
  52 + <div class="form-value-price-title">
  53 + ะกั€ะพะบะธ(<span style="font-weight: normal">ะฒ ะดะฝัั…</span>)
  54 + </div>
  55 + <div class="form-price-wr">
  56 + <?= $form->field($model, 'term_from', [
  57 + 'template' => "{input}\n{error}",
  58 + 'options' => [ 'tag' => 'span' ],
  59 + ])
  60 + ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_from') ]) ?>
  61 + <?= $form->field($model, 'term_to', [
  62 + 'template' => "{input}\n{error}",
  63 + 'options' => [ 'tag' => 'span' ],
  64 + ])
  65 + ->input('number', [ 'placeholder' => $model->getAttributeLabel('term_to') ]) ?>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + <?= $form->field($model, 'text', [
  70 + 'template' => "{input}\n{error}",
  71 + 'options' => [ 'class' => 'form-tender-txt style' ],
  72 + ])
  73 + ->textarea([ 'placeholder' => $model->getAttributeLabel('text') ]) ?>
  74 + <div class="tender-file-wr">
  75 + <?= $form->field($model, 'file[]')
  76 + ->fileInput([ 'class' => 'multi' ])
  77 + ->label(false) ?>
  78 + <a href="#" class="addfilemulti">ะŸั€ะธะบั€ะตะฟะธั‚ัŒ ั„ะฐะนะป</a>
  79 + <div class="max-size">ะœะฐะบัะธะผะฐะปัŒะฝั‹ะน ั€ะฐะทะผะตั€<br/>ั„ะฐะนะปะฐ 5 ะœะ‘</div>
  80 + </div>
  81 + <div class="tender-form-buttons-wr">
  82 + <?php
  83 + echo Html::submitInput('ะŸะพะดะฐั‚ัŒ ะทะฐัะฒะบัƒ', [ 'class' => 'get-project-new' ]);
  84 + echo Html::submitInput('ะพั‚ะฒะตั‚ะธั‚ัŒ ะฐะฝะพะฝะธะผะฝะพ', [
  85 + 'class' => 'get-list-new',
  86 + 'name' => 'CommentProject[anonymous]',
  87 + ]);
  88 + echo Html::a('ะžั‡ะธัั‚ะธั‚ัŒ', [
  89 + 'tender/view',
  90 + 'tender_id' => \Yii::$app->request->get('tender_id'),
  91 + '#' => 'w1',
  92 + ]);
  93 + ?>
  94 + </div>
  95 + <?php
  96 + $form->end();
  97 + ?>
  98 + </div>
  99 +
  100 +
101 101 </div>
102 102 \ No newline at end of file
... ...
common/modules/comment/widgets/views/list-comment-question.php 0 โ†’ 100755
  1 +<?php
  2 + /**
  3 + * @var \yii\data\DataProviderInterface $dataProvider
  4 + * @var Comment $commentClass
  5 + */
  6 + use common\modules\comment\models\Comment;
  7 + use common\modules\comment\widgets\CommentWidget;
  8 +
  9 +
  10 + if(!empty( $dataProvider )) {
  11 + ?>
  12 + <div class="tender-offer-proj-title-all">ะ’ะพะฟั€ะพัะพะฒ: (<?= $dataProvider->totalCount ?>)</div>
  13 + <?php
  14 + }
  15 +
  16 +
  17 + echo \yii\widgets\ListView::widget([
  18 + 'dataProvider' => $dataProvider,
  19 + 'itemView' => '_question_comment_view',
  20 + 'options' => [
  21 + 'tag' => 'ul',
  22 + 'class' => 'proektant-comments tender_list_comm_ style',
  23 + ],
  24 + 'itemOptions' => [
  25 + 'tag' => 'li',
  26 + 'class' => CommentWidget::$baseClass[ 'comment_container' ],
  27 + 'data' => [
  28 + 'form' => $commentClass->formName(),
  29 + ],
  30 + ],
  31 + 'layout' => "{items}\n{pager}",
  32 + ]);
0 33 \ No newline at end of file
... ...
common/modules/comment/widgets/views/list-comment-review.php
1   -<?php
2   - /**
3   - * @var \yii\data\DataProviderInterface $dataProvider
4   - */
5   -echo \yii\widgets\ListView::widget([
6   - 'dataProvider' => $dataProvider,
7   - 'itemView' => '_review_comment_view',
8   - 'options' => [
9   - 'tag' => 'ul',
10   - 'class' => 'proektant-comments style'
11   - ],
12   - 'itemOptions' => [
13   - 'tag' => 'li',
14   - ],
15   - 'layout' => "{items}\n{pager}",
16   -]);
17 1 \ No newline at end of file
  2 +<?php
  3 + /**
  4 + * @var \yii\data\DataProviderInterface $dataProvider
  5 + * @var Comment $commentClass
  6 + */
  7 + use common\modules\comment\models\Comment;
  8 + use common\modules\comment\widgets\CommentWidget;
  9 + echo \yii\widgets\ListView::widget([
  10 + 'dataProvider' => $dataProvider,
  11 + 'itemView' => '_review_comment_view',
  12 + 'options' => [
  13 + 'tag' => 'ul',
  14 + 'class' => 'proektant-comments style',
  15 + ],
  16 + 'itemOptions' => [
  17 + 'tag' => 'li',
  18 + 'class' => CommentWidget::$baseClass[ 'comment_container' ],
  19 + 'data' => [
  20 + 'form' => $commentClass->formName(),
  21 + ],
  22 + ],
  23 + 'layout' => "{items}\n<div class='navi-buttons-wr style'>{pager}</div>",
  24 + ]);
18 25 \ No newline at end of file
... ...
common/modules/comment/widgets/views/list-comment.php
1   -<?php
2   - /**
3   - * @var \yii\data\DataProviderInterface $dataProvider
4   - */
5   -echo \yii\widgets\ListView::widget([
6   - 'dataProvider' => $dataProvider,
7   - 'itemView' => 'project_comment_view',
8   - 'itemOptions' => [
9   - 'tag' => false,
10   - ],
11   - 'summary' => '',
  1 +<?php
  2 + /**
  3 + * @var \yii\data\DataProviderInterface $dataProvider
  4 + */
  5 +echo \yii\widgets\ListView::widget([
  6 + 'dataProvider' => $dataProvider,
  7 + 'itemView' => 'project_comment_view',
  8 + 'itemOptions' => [
  9 + 'tag' => false,
  10 + ],
  11 + 'summary' => '',
12 12 ]);
13 13 \ No newline at end of file
... ...
common/modules/comment/widgets/views/list-project-comment.php
1   -<?php
2   - /**
3   - * @var \yii\data\DataProviderInterface $dataProvider
4   - */
5   -?>
6   -<div class="box-wr">
7   - <div class="box-all">
8   - <div class="tender-offer-proj-title-all style">ะŸั€ะตะดะปะพะถะตะฝะธั ะฟั€ะพะตะบั‚ะฐะฝั‚ะพะฒ (<?=$dataProvider->getTotalCount()?>)</div>
9   - <div class="tender-offer-proj-blocks-wr style">
10   - <?php
11   - echo \yii\widgets\ListView::widget([
12   - 'dataProvider' => $dataProvider,
13   - 'itemView' => '_project_comment_view',
14   - 'itemOptions' => [
15   - 'class' => 'tender-offer-proj-blocks style',
16   - ],
17   - 'summary' => '',
18   - ]);
19   - ?>
20   - </div>
21   - </div>
  1 +<?php
  2 + /**
  3 + * @var \yii\data\DataProviderInterface $dataProvider
  4 + */
  5 +?>
  6 +<div class="box-wr">
  7 + <div class="box-all">
  8 + <div class="tender-offer-proj-title-all style">ะŸั€ะตะดะปะพะถะตะฝะธั ะฟั€ะพะตะบั‚ะฐะฝั‚ะพะฒ (<?=$dataProvider->getTotalCount()?>)</div>
  9 + <div class="tender-offer-proj-blocks-wr style">
  10 + <?php
  11 + echo \yii\widgets\ListView::widget([
  12 + 'dataProvider' => $dataProvider,
  13 + 'itemView' => '_project_comment_view',
  14 + 'itemOptions' => [
  15 + 'class' => 'tender-offer-proj-blocks style',
  16 + ],
  17 + 'summary' => '',
  18 + ]);
  19 + ?>
  20 + </div>
  21 + </div>
22 22 </div>
23 23 \ No newline at end of file
... ...
common/modules/comment/widgets/views/project_comment_view.php
1   -<?php
2   - use common\models\User;
3   - use yii\helpers\Html;
4   -
5   - /**
6   - * @var \common\modules\comment\models\Comment $model Current comment model
7   - * @var integer $key ID of current comment
8   - * @var integer $index index of current element according to
9   - * current page, starting from 0
10   - * @var \yii\widgets\ListView $widget current ListView instance
11   - * @var User $user
12   - */
13   - $user = NULL;
14   - if(!empty( $model->user_id )) {
15   - $user = User::find()
16   - ->where([ 'id' => $model->user_id ])
17   - ->with('userInfo')
18   - ->one();
19   - }
20   -?>
21   -<div class="new-portf-comm-read artbox_comment_container" data-comment_id="<?= $model->comment_id ?>" data-form_name="<?= $model->formName() ?>">
22   - <div class="style">
23   - <div class="header-cabinet-foto">
24   - <?php
25   - if(!empty( $user ) && !empty( $user->userInfo->image )) {
26   - echo "<img src='{$user->userInfo->image}' alt=''>";
27   - } else {
28   - echo "<img src='/images/ded-ico.png' alt=''>";
29   - }
30   - ?>
31   - </div>
32   - <div class="new-prof-wrapper-read">
33   - <div class="new-portf-comm-read-title">
34   - <?php
35   - if(!empty( $user )) {
36   - echo Html::a('<span class="artbox_comment_author">' . $user->firstname . ' ' . $user->lastname . '</span>', [
37   - 'performer/common',
38   - 'performer_id' => $user->id,
39   - ]);
40   - } else {
41   - echo '<span class="artbox_comment_author">' . $model->user_name . '</span>' . '(ะ“ะพัั‚ัŒ)';
42   - }
43   - ?>
44   - </div>
45   - <div class="new-portf-comm-read-rating">
46   - <?php
47   - if($rating = $model->hasRating()) {
48   - ?>
49   - <div class="rating">
50   - <!--ะพั†ะตะฝะบะฐ-->
51   - <input type="hidden" class="val" value="<?= $rating->value ?>"/>
52   - <!--ะบะพะปะธั‡ะตัั‚ะฒะพ ะณะพะปะพัะพะฒ-->
53   - <input type="hidden" class="votes" value="1"/>
54   - </div>
55   - <?php
56   - }
57   - ?>
58   - </div>
59   - <div class="blog-post-date">
60   - <span></span>
61   - <p><?= date('d.m.Y', strtotime($model->date_add)) ?></p>
62   - </div>
63   - </div>
64   -
65   - <div class="new-portf-answer artbox_comment_text">
66   - <?= Html::encode($model->text) ?>
67   - </div>
68   - <div style="clear:both"></div>
69   - <?php
70   - /*
71   - ?>
72   - <div class="action_panel">
73   - <ul>
74   - <li style="display:inline-block" class="artbox_comment_reply">ะžั‚ะฒะตั‚ะธั‚ัŒ</li>
75   - <li style="display:inline-block" class="artbox_comment_update">ะ ะตะดะฐะบั‚ะธั€ะพะฒะฐั‚ัŒ</li>
76   - <li style="display:inline-block" class="artbox_comment_delete">ะฃะดะฐะปะธั‚ัŒ</li>
77   - </ul>
78   - </div>
79   - <?php
80   - */
81   - ?>
82   - </div>
83   - <div class="style"></div>
  1 +<?php
  2 + use common\models\User;
  3 + use common\modules\comment\widgets\CommentWidget;
  4 + use kartik\rating\StarRating;
  5 + use yii\helpers\Html;
  6 +
  7 + /**
  8 + * @var \common\modules\comment\models\Comment $model Current comment model
  9 + * @var integer $key ID of current comment
  10 + * @var integer $index index of current element according to
  11 + * current page, starting from 0
  12 + * @var \yii\widgets\ListView $widget current ListView instance
  13 + * @var User $user
  14 + */
  15 + $user = NULL;
  16 + if(!empty( $model->user_id )) {
  17 + $user = User::find()
  18 + ->where([ 'id' => $model->user_id ])
  19 + ->with('userInfo')
  20 + ->one();
  21 + }
  22 + $model->buildButtons([ 'delete' ]);
  23 +?>
  24 +<div class="new-portf-comm-read artbox_comment_container" data-key="<?= $model->comment_id ?>" data-form="<?= $model->formName() ?>">
  25 + <div class="style">
  26 + <div class="header-cabinet-foto">
  27 + <?php
  28 + if(!empty( $user ) && !empty( $user->userInfo->image )) {
  29 + echo "<img src='{$user->userInfo->image}' alt=''>";
  30 + } else {
  31 + echo "<img src='/images/ico-profile.png' alt=''>";
  32 + }
  33 + ?>
  34 + </div>
  35 + <div style="width: 500px; float: left; margin-left: 12px;">
  36 + <div class="comments-name style artbox_comment_author">
  37 + <?php
  38 + if(!empty( $user )) {
  39 + echo Html::a('<span class="artbox_comment_author">' . $user->firstname . ' ' . $user->lastname . '</span>', [
  40 + 'performer/common',
  41 + 'performer_id' => $user->id,
  42 + ]);
  43 + } else {
  44 + echo '<span class="artbox_comment_author">' . $model->user_name . '</span>' . '(ะ“ะพัั‚ัŒ)';
  45 + }
  46 + ?>
  47 + </div>
  48 + <div class="new-portf-comm-read-rating">
  49 + <?php
  50 + if($rating = $model->hasRating()) {
  51 + echo StarRating::widget([
  52 + 'name' => 'rating_project_comment',
  53 + 'value' => $rating->value,
  54 + 'pluginOptions' => [
  55 + 'displayOnly' => true,
  56 + 'size' => 'xxs',
  57 + 'min' => 0,
  58 + 'max' => 10,
  59 + 'stars' => 10,
  60 + ],
  61 + ]);
  62 + }
  63 + ?>
  64 + </div>
  65 + <div class="blog-post-date style">
  66 + <span></span>
  67 + <p><?= date('d.m.Y', strtotime($model->date_add)) ?></p>
  68 + </div>
  69 + </div>
  70 +
  71 + <div class="new-portf-answer artbox_comment_text">
  72 + <?= Html::encode($model->text) ?>
  73 + </div>
  74 + <div style="clear:both"></div>
  75 + <div>
  76 + <?php
  77 + if(!empty( $model->buttons[ 'delete' ] )) {
  78 + echo Html::a(( $model->user_id != NULL && $model->user_id == \Yii::$app->user->id ) ? 'ะฃะดะฐะปะธั‚ัŒ' : 'ะŸะพะถะฐะปะพะฒะฐั‚ัŒัั ', $model->buttons[ 'delete' ], [ 'class' => CommentWidget::$baseClass[ 'comment_delete' ] ]);
  79 + }
  80 + if(!empty( $model->buttons[ 'update' ] )) {
  81 + echo Html::a('ะ ะตะดะฐะบั‚ะธั€ะพะฒะฐั‚ัŒ', $model->buttons[ 'update' ], [ 'class' => CommentWidget::$baseClass[ 'comment_update' ] ]);
  82 + }
  83 + if(!empty( $model->buttons[ 'reply' ] )) {
  84 + echo Html::a('ะžั‚ะฒะตั‚ะธั‚ัŒ', $model->buttons[ 'reply' ], [ 'class' => CommentWidget::$baseClass[ 'comment_reply' ] ]);
  85 + }
  86 + ?>
  87 + </div>
  88 + <?php
  89 + /*
  90 + ?>
  91 + <div class="action_panel">
  92 + <ul>
  93 + <li style="display:inline-block" class="artbox_comment_reply">ะžั‚ะฒะตั‚ะธั‚ัŒ</li>
  94 + <li style="display:inline-block" class="artbox_comment_update">ะ ะตะดะฐะบั‚ะธั€ะพะฒะฐั‚ัŒ</li>
  95 + <li style="display:inline-block" class="artbox_comment_delete">ะฃะดะฐะปะธั‚ัŒ</li>
  96 + </ul>
  97 + </div>
  98 + <?php
  99 + */
  100 + ?>
  101 + </div>
  102 + <div class="style"></div>
84 103 </div>
85 104 \ No newline at end of file
... ...
common/modules/product/models/Product.php
... ... @@ -3,6 +3,8 @@
3 3 namespace common\modules\product\models;
4 4  
5 5 use common\behaviors\Slug;
  6 +use common\models\ProductToRating;
  7 +use common\modules\comment\models\Comment;
6 8 use common\modules\product\behaviors\FilterBehavior;
7 9 use common\modules\rubrication\models\TaxGroup;
8 10 use common\modules\rubrication\models\TaxOption;
... ... @@ -28,6 +30,7 @@ use yii\web\UploadedFile;
28 30 * @property boolean $is_top
29 31 * @property boolean $is_new
30 32 * @property boolean $akciya
  33 + * @property ProductToRating $averageRating
31 34 * @property array $properties
32 35 * @property ProductVariant $enabledVariant
33 36 * @property array $enabledVariants
... ... @@ -378,4 +381,33 @@ class Product extends \yii\db\ActiveRecord
378 381 }
379 382 return $op;
380 383 }
  384 +
  385 + public function recalculateRating() {
  386 + /**
  387 + * @var ProductToRating $averageRating
  388 + */
  389 + $average = $this->getComments()->joinWith('rating')->select(['average' => 'avg(rating.value)::float'])->scalar();
  390 + if(!$average) {
  391 + $average = 0;
  392 + }
  393 + $averageRating = $this->averageRating;
  394 + if(!empty($averageRating)) {
  395 + $averageRating->value = $average;
  396 + } else {
  397 + $averageRating = new ProductToRating(['product_id' => $this->product_id, 'value' => $average]);
  398 + }
  399 + if($averageRating->save()) {
  400 + return true;
  401 + } else {
  402 + return false;
  403 + }
  404 + }
  405 +
  406 + public function getComments() {
  407 + return $this->hasMany(Comment::className(), ['model_id' => 'product_id'])->where(['comment.model' => self::className()]);
  408 + }
  409 +
  410 + public function getAverageRating() {
  411 + return $this->hasOne(ProductToRating::className(), ['product_id' => 'product_id']);
  412 + }
381 413 }
... ...
composer.json
... ... @@ -44,7 +44,8 @@
44 44 "yurkinx/yii2-image": "dev-master",
45 45 "cics/yii2-video-embed-widget": "dev-master",
46 46 "sersid/yii2-owl-carousel-asset": "*",
47   - "wbraganca/yii2-dynamicform": "dev-master"
  47 + "wbraganca/yii2-dynamicform": "dev-master",
  48 + "kartik-v/yii2-widget-rating": "*"
48 49 },
49 50 "require-dev": {
50 51 "yiisoft/yii2-codeception": "*",
... ...
console/migrations/m160721_152001_create_product_to_rating.php 0 โ†’ 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160721_152001_create_product_to_rating extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->createTable('product_to_rating', [
  10 + 'product_to_rating_id' => $this->primaryKey(),
  11 + 'product_id' => $this->integer()->notNull(),
  12 + 'value' => $this->float()->defaultValue(0),
  13 + ]);
  14 +
  15 + $this->addForeignKey('product_to_rating_product', 'product_to_rating', 'product_id', 'product', 'product_id', 'CASCADE', 'CASCADE');
  16 + }
  17 +
  18 + public function down()
  19 + {
  20 + $this->dropForeignKey('product_to_rating_product', 'product_to_rating');
  21 + $this->dropTable('product_to_rating');
  22 + }
  23 +}
... ...
frontend/controllers/CatalogController.php
... ... @@ -115,6 +115,15 @@ class CatalogController extends \yii\web\Controller
115 115 }
116 116  
117 117 $priceLimits = $productModel->priceLimits($category, $params);
  118 +
  119 + /*
  120 + * Greedy search for comments and rating
  121 + */
  122 + $query = $productProvider->query;
  123 + $query->with(['comments', 'averageRating']);
  124 + /*
  125 + * End of greedy search for rating and comments
  126 + */
118 127  
119 128 return $this->render(
120 129 'products',
... ...
frontend/views/catalog/product.php
1 1 <?php
2   -use yii\widgets\Breadcrumbs;
  2 + use common\modules\comment\models\Comment;
  3 + use common\modules\comment\models\Rating;
  4 + use common\modules\comment\widgets\CommentWidget;
  5 + use kartik\rating\StarRating;
  6 + use yii\widgets\Breadcrumbs;
3 7 use yii\web\View;
4 8 use yii\helpers\Url;
5 9 use frontend\widgets\Seo;
6   -
  10 +
7 11 $this->params['seo']['key'] = $product->category->categoryName->value;
8 12 $this->params['seo']['fields']['name'] = $product->fullname;
9 13 $this->params['seo']['h1'] = !empty(Seo::widget([ 'row'=>'h1'])) ? Seo::widget([ 'row'=>'h1']) : $product->fullname;
... ... @@ -86,8 +90,7 @@ $this-&gt;registerJs (&quot;
86 90 });
87 91 ", View::POS_READY, 'Shadowbox');
88 92 ?>
89   -
90   -
  93 +
91 94 <nav class="bread-crumbs">
92 95 <?= Breadcrumbs::widget ([
93 96 'links' => $this->params['breadcrumbs'],
... ... @@ -152,6 +155,33 @@ $this-&gt;registerJs (&quot;
152 155 <?php endif?>
153 156 </ul>
154 157 </div>
  158 + <div class="artbox_comment_description">
  159 + <?php
  160 + if(!empty($product->averageRating)) {
  161 + echo StarRating::widget([
  162 + 'name' => 'rating_product',
  163 + 'value' => $product->averageRating->value,
  164 + 'pluginOptions' => [
  165 + 'displayOnly' => true,
  166 + 'size' => 'xxs',
  167 + 'min' => 0,
  168 + 'max' => 5,
  169 + 'stars' => 5,
  170 + ],
  171 + ]);
  172 + }
  173 + ?>
  174 + <p><a href="#artbox-comment">
  175 + <?php
  176 + $comment_count = count($product->comments);
  177 + if($comment_count) {
  178 + echo "ะžั‚ะทั‹ะฒะพะฒ: ".$comment_count;
  179 + } else {
  180 + echo "ะžัั‚ะฐะฒั‚ัŒ ะพั‚ะทั‹ะฒ";
  181 + }
  182 + ?>
  183 + </a></p>
  184 + </div>
155 185 <br>
156 186 <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,gplus,twitter" data-size="s"></div>
157 187 </div>
... ... @@ -216,7 +246,34 @@ $this-&gt;registerJs (&quot;
216 246 </ul>
217 247 </div>
218 248 <div class="both"></div>
219   -
  249 + <div class="comment-wrapper">
  250 + <?php
  251 + echo CommentWidget::widget([
  252 + 'comment_class' => Comment::className(),
  253 + 'rating_class' => Rating::className(),
  254 + 'success_text' => 'ะšะพะผะผะตะฝั‚ะฐั€ะธะน ัƒัะฟะตัˆะฝะพ ะดะพะฑะฐะฒะปะตะฝ',
  255 + 'class_options' => [
  256 + 'scenario' => \Yii::$app->user->isGuest?Comment::SCENARIO_GUEST:Comment::SCENARIO_USER,
  257 + 'status' => Comment::STATUS_ACTIVE,
  258 + 'user_id' => \Yii::$app->user->isGuest?NULL:\Yii::$app->user->id,
  259 + ],
  260 + 'model' => $product->className(),
  261 + 'model_id' => $product->product_id,
  262 + 'list_options' => [
  263 + 'view' => 'list-comment-review',
  264 + ],
  265 + 'form_options' => [
  266 + 'view' => 'form-comment-review',
  267 + 'tag' => 'span',
  268 + ],
  269 + 'options' => [
  270 + 'class' => 'proektant-comments-wr style',
  271 + 'id' => 'artbox-comment',
  272 + ],
  273 + ]);
  274 + ?>
  275 + </div>
  276 +
220 277 <?= \common\modules\product\widgets\similarProducts::widget(['product' => $product])?>
221 278 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'promo'])?>
222 279 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'new'])?>
... ...
frontend/views/catalog/product_item.php
1 1 <?php
2   -/** @var \common\modules\product\models\Product $product */
3   -use yii\helpers\Url;
  2 + /** @var \common\modules\product\models\Product $product */
  3 + use kartik\rating\StarRating;
  4 + use yii\helpers\Html;
  5 + use yii\helpers\Url;
  6 +
4 7 ?>
5 8 <li class="item" itemscope itemtype="http://schema.org/Product">
6 9 <div class="boxitem">
7 10 <div class="pixbox">
8   - <a href="<?= Url::to(['catalog/product', 'product' => $product,'#' => 'm' .$product->enabledVariants[0]->product_variant_id]) ?>">
9   - <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[0]->imageUrl, 'list',['alt' => $product->category->categoryName->value . ' ' .
10   - $product->fullname, 'title' => $product->category->categoryName->value . ' ' .
11   - $product->fullname])?>
  11 + <a href="<?= Url::to([
  12 + 'catalog/product',
  13 + 'product' => $product,
  14 + '#' => 'm' . $product->enabledVariants[ 0 ]->product_variant_id,
  15 + ]) ?>">
  16 + <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[ 0 ]->imageUrl, 'list', [
  17 + 'alt' => $product->category->categoryName->value . ' ' . $product->fullname,
  18 + 'title' => $product->category->categoryName->value . ' ' . $product->fullname,
  19 + ]) ?>
12 20 </a>
13 21 </div>
14   - <?php if(!empty($product->is_top) || !empty($product->is_new) || !empty($product->akciya)) :?>
  22 + <?php if(!empty( $product->is_top ) || !empty( $product->is_new ) || !empty( $product->akciya )) : ?>
15 23 <ul class="product-special">
16   - <?php if(!empty($product->is_top)) :?>
17   - <li class="top"><div>top</div></li>
18   - <?php endif?>
19   - <?php if(!empty($product->is_new)) :?>
20   - <li class="new"><div>new</div></li>
21   - <?php endif?>
22   - <?php if(!empty($product->akciya)) :?>
23   - <li class="promo"><div>promo</div></li>
24   - <?php endif?>
  24 + <?php if(!empty( $product->is_top )) : ?>
  25 + <li class="top">
  26 + <div>top</div>
  27 + </li>
  28 + <?php endif ?>
  29 + <?php if(!empty( $product->is_new )) : ?>
  30 + <li class="new">
  31 + <div>new</div>
  32 + </li>
  33 + <?php endif ?>
  34 + <?php if(!empty( $product->akciya )) : ?>
  35 + <li class="promo">
  36 + <div>promo</div>
  37 + </li>
  38 + <?php endif ?>
25 39 </ul>
26   - <?php endif?>
  40 + <?php endif ?>
  41 + <div class="comment_display_block">
  42 + <?php
  43 + if(!empty( $product->averageRating )) {
  44 + echo StarRating::widget([
  45 + 'name' => 'rating_product',
  46 + 'value' => $product->averageRating->value,
  47 + 'pluginOptions' => [
  48 + 'displayOnly' => true,
  49 + 'size' => 'xxs',
  50 + 'min' => 0,
  51 + 'max' => 5,
  52 + 'stars' => 5,
  53 + ],
  54 + ]);
  55 + }
  56 + ?>
  57 + <p>
  58 + <?php
  59 + $comment_count = count($product->comments);
  60 + echo Html::a(($comment_count?'ะžั‚ะทั‹ะฒะพะฒ: ' . count($product->comments):"ะžัั‚ะฐะฒะธั‚ัŒ ะพั‚ะทั‹ะฒ"), ['catalog/product', 'product' => $product, '#' => 'artbox-comment'])
  61 + ?>
  62 + </p>
  63 + </div>
27 64 <div itemprop="name"><a href="<?= Url::to([
28   - 'catalog/product',
29   - 'product' => $product,
30   - '#' => 'm' .$product->enabledVariants[0]->product_variant_id])
31   - ?>"
32   - class="name"><?= $product->fullname ?>
33   - </a></div>
34   -
  65 + 'catalog/product',
  66 + 'product' => $product,
  67 + '#' => 'm' . $product->enabledVariants[ 0 ]->product_variant_id,
  68 + ]) ?>"
  69 + class="name"><?= $product->fullname ?>
  70 + </a></div>
  71 +
35 72 <?php
36   -
37   - echo '<div class="cost-block" itemprop="offers" itemscope itemtype="http://schema.org/Offer">';
38   - echo '<p class="cost">';
39   - // ะตัั‚ัŒ ัะบะธะดะบะฐ
40   - if ($product->enabledVariants[0]->price_old != 0 && $product->enabledVariants[0]->price_old != $product->enabledVariants[0]->price)
41   - {
42   - echo '<strike><span id=\'old_cost\' itemprop="price">'.$product->enabledVariants[0]->price_old.'</span> ะณั€ะฝ.</strike>&nbsp;';
43   - }
44   -
45   - echo $product->enabledVariants[0]->price.' <span>ะณั€ะฝ.</span></p>';
46   - echo '<meta itemprop="priceCurrency" content = "UAH">';
47   - echo '</div>';
48   -
  73 +
  74 + echo '<div class="cost-block" itemprop="offers" itemscope itemtype="http://schema.org/Offer">';
  75 + echo '<p class="cost">';
  76 + // ะตัั‚ัŒ ัะบะธะดะบะฐ
  77 + if($product->enabledVariants[ 0 ]->price_old != 0 && $product->enabledVariants[ 0 ]->price_old != $product->enabledVariants[ 0 ]->price) {
  78 + echo '<strike><span id=\'old_cost\' itemprop="price">' . $product->enabledVariants[ 0 ]->price_old . '</span> ะณั€ะฝ.</strike>&nbsp;';
  79 + }
  80 +
  81 + echo $product->enabledVariants[ 0 ]->price . ' <span>ะณั€ะฝ.</span></p>';
  82 + echo '<meta itemprop="priceCurrency" content = "UAH">';
  83 + echo '</div>';
  84 +
49 85 ?>
50 86 </div>
51 87 <a href="<?= Url::to([
52 88 'catalog/product',
53 89 'product' => $product,
54   - '#' => 'm' .$product->enabledVariants[0]->product_variant_id])
55   - ?>" class="link_buy">ะšัƒะฟะธั‚ัŒ</a>
56   -
  90 + '#' => 'm' . $product->enabledVariants[ 0 ]->product_variant_id,
  91 + ]) ?>" class="link_buy">ะšัƒะฟะธั‚ัŒ</a>
  92 +
57 93 <div class="mycarousel">
58 94 <ul class="jcarousel jcarousel-skin-tango">
59   - <?php foreach ($product->enabledVariants as $variant) : ?>
60   - <?php if (!empty($variant->image)) :?>
61   - <li>
62   - <a href="<?= Url::to([
63   - 'catalog/product',
64   - 'product' => $product,
65   - '#' => 'm' . $variant->product_variant_id]) ?>">
66   - <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant',['alt' => $product->category->categoryName->value . ' ' .
67   - $product->fullname, 'title' => $product->category->categoryName->value . ' ' .
68   - $product->fullname])?>
69   - </a>
70   - </li>
  95 + <?php foreach($product->enabledVariants as $variant) : ?>
  96 + <?php if(!empty( $variant->image )) : ?>
  97 + <li>
  98 + <a href="<?= Url::to([
  99 + 'catalog/product',
  100 + 'product' => $product,
  101 + '#' => 'm' . $variant->product_variant_id,
  102 + ]) ?>">
  103 + <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant', [
  104 + 'alt' => $product->category->categoryName->value . ' ' . $product->fullname,
  105 + 'title' => $product->category->categoryName->value . ' ' . $product->fullname,
  106 + ]) ?>
  107 + </a>
  108 + </li>
71 109 <?php endif; ?>
72 110 <?php endforeach; ?>
73 111 </ul>
... ...
frontend/views/catalog/products.php
... ... @@ -12,7 +12,7 @@ use common\modules\product\helpers\FilterHelper;
12 12 use frontend\widgets\Seo;
13 13 //$this->title = $category->categoryName->value;
14 14 $this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : '';
15   -
  15 +
16 16 $this->params['seo']['fields']['meta-title'] = $category->meta_title;
17 17 $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name;
18 18 $this->params['seo']['seo_text'] = $category->seo_text;
... ...
frontend/views/products/_product.php
1 1 <?php
2 2 use yii\helpers\Url;
3   -
  3 +
4 4 ?>
5 5 <div class="boxitem">
6 6 <div class="pixbox">
... ...
frontend/web/css/style.css
1   -html,form,body{padding:0;margin:0;font-family:'Roboto';font-size:14px;color:#333;height:100%}h1,h2,h3{margin:0px;padding:0px 0px 10px 0px}.fl{float:left}.fotter .wrap .fr{float:right;width:180px;height:50px;position:relative;font-size:12px}.fotter .wrap .fr img{position:absolute;top:50%;margin-top:-10px;right:0}.fotter .wrap .fl{line-height:50px;font-size:12px}.both{clear:both}h1{margin:10px 0;font-size:24px}h3{margin-bottom:30px}p{margin:3px 0px;padding:0px}a{color:#6a6a6a;font-size:14px;text-decoration:underline}a:hover{color:#799920}.wrap{width:960px;margin:0px auto}.f{background:#ffffff}.br{-webkit-box-shadow:-1px 5px 14px 0px rgba(50, 46, 50, 0.46);-moz-box-shadow:-1px 5px 14px 0px rgba(50, 46, 50, 0.46);box-shadow:-1px 5px 14px 0px rgba(50, 46, 50, 0.46);padding:20px}nav.top{background:#f5f5f5;padding:10px 0px;border-bottom:1px solid #d2d2d2;font-size:12px}nav.top ul{list-style:none;margin:0px;padding:0px}nav.top ul li{float:left;padding-right:20px}nav.top ul li a{font-size:12px}nav.top a{color:#6a6a6a;text-decoration:none}#help{background:url('../img/help.png') right no-repeat;padding-right:20px}#help span{border-bottom:1px dotted #6a6a6a}#login{background:url('../img/login.png') right no-repeat;padding-right:20px;font-size:12px}#login span{border-bottom:1px dotted #6a6a6a}.search{margin:-5px 0px -5px 100px;float:left}nav input[type="text"]{width:325px;outline:0;border:1px solid #d8d6d6;border-radius:5px;padding:5px 0px 5px 0px;font-size:14px;text-indent:10px}nav input[type="submit"]{width:35px;height:29px;border:none;background:url('../img/lupa_sub.png') center no-repeat;margin-left:-35px;cursor:pointer}.header{margin:0px 0px 20px}.phone{float:left;position:relative;text-align:center;}.phone .tel{font-size:23px}.phone .tel span.more{margin-bottom:3px}.more_block{background:#ffffff;border:1px solid #d2d2d2;padding:10px;position:absolute;font-size:20px;display:none;z-index:99}.more{background:url('../img/more.png') no-repeat;width:12px;height:7px;display:inline-block;cursor:pointer;margin-bottom:5px}.logo{margin:0px auto 0px;width:193px}.logo a{display:block;width:193px;height:84px;background:url('../img/logo.png') no-repeat}.logo a span{display:none}#call{color:#6a6a6a;text-decoration:none;border-bottom:1px dotted #6a6a6a}.basket{float:right;position:relative;border:1px solid #d2d2d2;border-radius:5px;padding:15px 20px;font-size:18px;text-transform:uppercase;margin-top:13px}.basket .info{float:left;border-right:1px solid #d2d2d2;padding-right:10px;margin-right:17px}.basket .info span{color:#f75d50;font-size:22px}.basket a:link,.basket a:visited{text-decoration:none;color:#000000;font-size:18px}.basket span.more{margin-bottom:-1px}.menu{background:#596065;border:1px solid #e8e8e8}.menu ul{margin:0px;padding:0px;list-style:none}.menu ul li{float:left;border-left:1px solid #8b9094;height:43px}.menu ul li:first-child{border-left:none}.menu ul li a{width:100%;height:100%;line-height:43px;float:left;box-sizing:border-box;padding:0 19px;text-transform:uppercase;color:#ffffff;font-size:15px;text-decoration:none;font-weight:600}.menu ul li:hover{background:#3e454b}.menu ul li.active a{background:#f5f5f5;color:#596065}.menu ul li.active a:hover{cursor:default}.menu_childs{background:#f5f5f5;border:1px solid #e8e8e8;border-bottom:2px solid #596065}.menu_childs ul{margin:0px;padding:0px;list-style:none}.menu_childs ul li{float:left}.menu_childs ul li a{float:left;padding:15px 23px 15px 23px;text-transform:uppercase;color:#596065;font-size:14px;font-weight:bold;text-decoration:none}.menu_childs ul li a:hover{color:#878b8e}.fr ul li{border:none}.akciya a{background:#f75d50;color:#ffffff}.brands a{background:#95ba2f;color:#ffffff}a.myorders{color:#f75d50}.sub{margin:2px 0px 0px 0px}.sub img{float:left;margin-right:2px}.rubrics{margin:60px 0 0 0;padding-bottom:27px}.rubrics ul{list-style:none;margin:0px;padding:0px}.rubrics ul li{float:left;margin:0px 35px}.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}.rubrics ul li.item_ryukzaki a{background:url('../img/ico1.png') no-repeat}.rubrics ul li.item_sumki a{background:url('../img/ico2.png') no-repeat}.rubrics ul li.item_chehly a{background:url('../img/ico3.png') no-repeat}.rubrics ul li.item_nesessery a{background:url('../img/ico4.png') no-repeat}.rubrics ul li.item_koshelki a{background:url('../img/ico5.png') no-repeat}.products{padding-bottom:30px;padding-top:20px}.why_me_,.products{border-top:1px solid #d2d2d2}.products ul{list-style:none;margin:0;padding:0}.products ul li.item{float:left;width:192px;margin:0 0 50px 0;text-align:center;position:relative}.products ul li a.name,.special-products a.name{display:block;color:#799920;font-size:15px;text-decoration:none;margin:15px 0 0 0;height:35px;overflow:hidden;box-sizing:border-box;padding:0 10px}.products ul li a.name:hover,.special-products a.name:hover{text-decoration:underline}.products ul li .info{text-align:left}.pn{border:none}.cost,.product_read_price #cost{color:#f75d50;font-size:18px;margin:0;padding:0}.cost span,.cost span.valute,.product_read_price .valute{font-size:14px}strike,strike span#old_cost{font-size:14px;color:#333}.submit4m,a.link_buy,.checkout_basket button,.submit4{background:#95ba2f;border-radius:4px;height:29px;text-transform:uppercase;color:#ffffff;text-decoration:none;font-weight:600;text-align:center;border-bottom:3px solid #799920;font-size:12px}.submit4.bottom3{font-size:12px !important;display:block}.basket .submit4.bottom3{font-size:12px !important;display:block;margin-top:10px}a.link_buy,.checkout_basket button{display:block;margin:0 auto 10px auto;width:122px;line-height:32px}.checkout_basket button,.submit4{margin:0;padding:0 20px;line-height:31px;width:auto;border-top:0;border-left:0;border-right:0;cursor:pointer}a.link_buy:hover,.submit4m:hover,.checkout_basket button:hover,.submit4:hover,.btn-primary:hover{border-bottom:3px solid #95ba2f}a.link_buy:active,.submit4m:active,.checkout_basket button:active,.submit4:active,.btn-primary:active{background:#799920;border-bottom:3px solid #799920}.checkout_basket button:focus,.submit4:focus{outline:none}.mycarousel{position:absolute;right:22px;top:13px}ul.mycarousel{list-style:none;margin:0px;padding:0px}ul.mycarousel li{margin:0px;padding:0px}.mycarousel img{border:1px solid #d2d2d2}h3{text-align:center;text-transform:uppercase;font-size:20px}span.why {height: 29px;display: block;width:213px;height:49px;background:url('../img/logo-why.png') no-repeat;margin:0px auto;padding:0 0 20px 0}ul.why_list{list-style:none;margin:0px;padding:0px}ul.why_list li{float:left;margin-left:58px;width:288px;height:96px;box-sizing:border-box;padding-left:110px;margin-top:20px}ul.why_list li div{display:table-cell;height:96px;vertical-align:middle}ul.why_list li span{font-weight:bold;color:#799920}ul.why_list li.item1{background:url('../img/why_item1.png') left no-repeat}ul.why_list li.item2{background:url('../img/why_item2.png') left no-repeat}ul.why_list li.item3{background:url('../img/why_item3.png') left no-repeat}ul.why_list li.item4{background:url('../img/why_item4.png') left no-repeat}ul.why_list li.item5{background:url('../img/why_item5.png') left no-repeat}ul.why_list li.item6{background:url('../img/why_item6.png') left no-repeat}.banner_akciya{margin:50px 0px}.bottom{background:#4d5458;padding:40px 0px;color:#ffffff}.bottom .leftbar{float:left;width:210px}.bottom ul{list-style:none;margin:0px;padding:0px;line-height:23px}.bottom ul a{color:#ffffff;font-size:15px;text-decoration:none}.bottom ul a:hover{color:#799920}.phones{padding-left:25px;background:url('../img/phone.png') left top no-repeat;margin-top:50px;line-height:23px;font-size:18px}.map{padding:5px 0px 5px 25px;background:url('../img/map.png') left no-repeat;margin-bottom:7px}a.more_map{color:#99a5ad;border-bottom:1px dotted #99a5ad;text-decoration:none;font-size:11px;text-align:center}.bread-crumbs{padding:0 0 0 20px;border-bottom:1px solid #d2d2d2;height:29px}.bread-crumbs ul{list-style:none;margin:0 0 0 0;padding:0;height:29px}.bread-crumbs ul li{float:left;padding-left:20px;height:100%;line-height:29px;color:#7d7d7d;position:relative;font-size:12px}.bread-crumbs ul li:first-child{padding-left:0}.bread-crumbs ul li a{font-size:12px;display:block;color:#7d7d7d}.bread-crumbs ul li a:visited,.bread-crumbs ul li a:link{color:#7d7d7d;text-decoration:underline}.bread-crumbs ul li a:hover{color:#464646;text-decoration:none}.breadcrumb > li + li:before{color:#ccc;content:"/";position:absolute;top:0;left:8px}.loyout{padding:20px 0px}.leftbar{float:left;width:172px;margin-right:20px}.rightbar{float:right;width:380px;margin-left:40px}.rightbar.basket_rightbar{margin-right:20px}.rightbar2{float:right;width:320px}.content{overflow:hidden}* html .content{height:1%}.content2{overflow:hidden}* html .content2{height:1%}.filters{border-top:1px solid #d2d2d2;padding:20px 0px 0px;margin-top:20px}.filters .begin{text-transform:uppercase;font-weight:bold;font-size:12px}.filters ul{list-style:none;margin:0px;padding:0px;line-height:22px;margin-top:6px}.filters ul li{position:relative;box-sizing:border-box;padding-left:24px;line-height:16px;margin-top:7px}.filters ul li:first-child{margin-top:0}.filters ul li>input{position:absolute;left:4px;margin:0px 0 0;top:3px}.filters ul li a{color:#464646;text-decoration:none;font-size:13px;line-height:16px}.filters ul li a:hover{text-decoration:underline}.filters ul li.hidden{color: #9da9b1}.productLeftBar{float:left;width:228px;margin-left:20px;margin-right:20px}.productRightBar{float:right;width:260px;margin:0 20px}.productLeftBar h1{font-size:24px;border-bottom:1px solid #d2d2d2;margin-bottom:10px}ul.product_mod{list-style:none;margin:10px 0 0 0;padding:0;float:left}ul.product_mod li{float:left;width:46px;height:46px;background:#fff;border:1px solid #d2d2d2;margin:5px 5px 0 0;text-align:center;position:relative}ul.product_mod li.active:before{width:48px;height:48px;position:absolute;content:'';background:none;border:2px solid #95ba2f;top:-1px;left:-1px;box-sizing:border-box}ul.product_mod li a{width:46px;height:46px;display:table-cell;vertical-align:middle}ul.product_mod li a:focus{outline:none}ul.product_mod li img{vertical-align:middle;max-width:46px;max-height:46px}ul.product_colors{list-style:none;margin:30px 0 0 0;padding:0;float:left}ul.product_colors li{float:left;margin:10px 10px 0 0;width:98px;height:98px;text-align:center;border:1px solid #d2d2d2}ul.product_colors li a{width:98px;height:98px;vertical-align:middle;display:table-cell}ul.product_colors li img{max-width:98px;max-height:98px;vertical-align:middle}.productLeftBar .begin{text-transform:uppercase;font-weight:bold;font-size:12px}.cost_box{border-top:1px solid #d2d2d2;border-bottom:1px solid #d2d2d2;margin:10px 0px;padding:10px 0px}.cost_box .w{float:left;margin-right:20px;padding-top:5px}.product_service ul{list-style:none;margin:0px;padding:0px}.product_service ul li a{color:#799920;text-decoration:none;border-bottom:1px dotted #799920;font-size:12px}.product_service ul li.item1{background:url('../img/li1.png') left no-repeat;padding:3px 23px}.product_service ul li.item2{background:url('../img/li2.png') left no-repeat;padding:3px 23px}.product_service ul li.item3{background:url('../img/li3.png') left no-repeat;padding:3px 23px}#nav_product{list-style:none;margin:0px;padding:0px;line-height:23px}#nav_product li a{background:url('../img/li_plus.png') left no-repeat;padding:3px 15px;color:#000000;text-transform:uppercase;text-decoration:none;font-weight:bold;font-size:12px}#nav_product li a.active{background:url('../img/li_minus.png') left no-repeat}#nav_product li .info{display:none;border-bottom:1px solid #d2d2d2;padding:10px 0px;margin-bottom:10px}#nav_product li .info,#nav_product li .info p{font-size:12px;line-height:16px}.modal_box{position:fixed;left:0;top:0;width:100%;height:100%;z-index:999;background:#000;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity:0.5;opacity:0.5}#data_box{position:absolute;top:100px;z-index:1000;width:400px;background:#ffffff;-webkit-box-shadow:0 0 15px #000;-moz-box-shadow:0 0 15px #000;box-shadow:0 0 15px #000;border:7px solid #1b9bb6;border-radius:5px}#data_box .data_wrp{padding:25px 15px 15px 15px}#data_box .data_wrp h1{text-transform:uppercase}#data_box .data_wrp hr{height:1px;border:none;color:#000000;background:#000000;margin:45px 0px 20px 0px}#data_box .data_wrp hr.hr{height:1px;border:none;color:#000000;background:#000000;margin:20px 0px 20px 0px}#data_box .pic-tango{margin-right:7px;margin-bottom:7px}#modal_close{cursor:pointer;margin-top:-80px;margin-right:-50px}.rightbar .control-label,.textareagroup .control-label{float:left;width:80px;padding-top:5px}.form-control{outline:0;border:1px solid #d8d6d6;border-radius:5px;padding:5px 0px 5px 0px;font-size:14px;text-indent:10px;margin-bottom:3px;width:250px}.form-control:focus{border:#1b9bb6 1px solid;box-shadow:0 0 10px #1b9bb6;-webkit-box-shadow:0 0 10px #1b9bb6;-moz-box-shadow:0 0 10px #1b9bb6}.help-block{color:red;font-size:12px;margin-bottom:5px}.basket_item{padding:10px 0px;border-bottom:1px solid #b7b7b7;clear:both}.basket_item img{margin-right:20px}.basket_item .count{margin:20px 0px}.basket_item .fr{margin-top:13px}.basket_item .info{overflow:hidden}.basket_item > a{display:block;float:left}a.del:visited,a.del:link{background:url('../img/del.png') left center no-repeat;padding:2px 25px;font-size:12px;font-weight:normal;color:#787878;text-decoration:underline}a.del:hover{color:#a52828;text-decoration:underline}.total{text-align:right;color:#87476a;font-size:20px;margin:10px 0px}.submit4m{font-family:Roboto;border:none;background:#95ba2f;border-radius:4px;color:#ffffff;text-transform:uppercase;font-size:10px;cursor:pointer;width:102px;height:29px;border-bottom:3px solid #799920;line-height:29px}.submit4m:active,.submit4m:focus{outline:none}.btn-primary{border-bottom:3px solid #799920;border-top:0;border-right:0;border-left:0;margin-top:5px;padding:0 15px;background:#95ba2f;border-radius:4px;color:#ffffff;text-transform:uppercase;text-decoration:none;font-size:12px;font-weight:bold;cursor:pointer;height:29px;line-height:29px}.btn-primary:active,.btn-primary:focus{outline:none}a.logout:visited,a.logout:link{border:none;padding:3px 5px;background:#f75d50;border-radius:5px;color:#ffffff;text-transform:uppercase;text-decoration:none;font-size:11px;font-weight:normal;cursor:pointer}a.logout:hover{background:#95ba2f}.boy_box{border-bottom:1px solid #b7b7b7;padding:0px 0px 15px 0px}.boy_box div{padding-top:10px}.content_product .info{padding:0px 0px 20px 0px}a.btn-success{display:inline-block;border:2px solid #d8d6d6;color:#95ba2f;border-radius:5px;padding:5px;margin-bottom:10px;text-decoration:none;font-size:14px}a.btn-success:hover{border:#95ba2f 2px solid;color:#f75d50}.txtb1{font-size:14px;font-weight:bold}.txtf{font-size:14px;font-weight:bold;color:#87476a}.txtfb{font-size:20px;font-weight:bold;color:#87476a}.count{margin:20px 0px}.count input[type="number"]{outline:0;width:50px;border:1px solid #d8d6d6;border-radius:5px;padding:5px 0px 5px 0px;font-size:14px;text-indent:10px;margin-bottom:7px}a.link2:visited,a.link2:link{font-size:14px;font-weight:bold;color:#95ba2f;text-decoration:none}a.link2:hover{color:#f75d50;text-decoration:underline}.well{margin:50px auto;width:400px;background:#f5f5f5;border:1px solid #e8e8e8;padding:20px;border-radius:5px}.control-label{float:left;width:100px;padding-top:5px}#user-verifycode-image{display:block}.form-inline{display:inline}.form-inline .form-group{float:left;margin-right:10px}.form-inline .form-group select{width:100px}.form-group{margin-bottom:10px}.table-bordered{width:100%;border:1px solid silver}.table-bordered th{background:#B3D1FD;padding:5px}.table-bordered tr td{border:1px solid silver;padding:5px}.table-bordered .filters{display:none}.formCost label{float:left;width:30px}ul.brends_list{list-style:none;margin:0px;padding:0px}ul.brends_list li{float:left;text-align:center;margin:0px 15px 20px 15px}.compare{text-align:center}.compare a:visited,.compare a:link{font-size:12px;text-decoration:underline}.alert-success{margin:10px 0px;padding:10px;border:1px solid #3ed824;border-radius:5px;background:#c0feb5}.news_item{padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid silver}.news_item img{margin-right:20px}.news_item a{font-size:16px}.pic{width:392px;height:365px}.pic a{width:392px;height:365px;display:table-cell;vertical-align:middle}.pic a img{max-width:392px;max-height:365px;vertical-align:middle}input#subscribe-email::-webkit-input-placeholder{color:#596065}input#subscribe-email::-moz-placeholder{color:#596065}input#subscribe-email:-ms-input-placeholder{color:#596065}input#subscribe-sale::-webkit-input-placeholder{color:#596065}input#subscribe-sale::-moz-placeholder{color:#596065}input#subscribe-sale:-ms-input-placeholder{color:#596065}#subscribe-email,#subscribe-sale{color:#596065}#subscribe-sale{width:100px;float:left;margin-right:20px;height:28px}.saletxt{width:150px;float:left;color:#ffffff;font-size:12px}#subscribe-email{width:370px}.txts{color:#9da9b1;font-size:18px;margin-bottom:20px}.content ul.pagination{list-style:none;text-align:center;margin:0 0 16px 0;padding:0 0 20px 0;border-bottom:1px solid #d2d2d2}.content ul.pagination li{display:inline}.content ul.pagination li a{padding:3px;color:#82a02f;font-size:15px;margin:0;text-decoration:none}.content ul.pagination li a:hover{text-decoration:underline}.content ul.pagination li.active a{color:#333333}.boxitem{height:283px}ul.social{margin-top:20px}.social{list-style:none;margin:10px;padding:0px;height:48px}.social li{display:inline-block;margin-right:7px;padding-bottom:10px}.social li a{width:36px;height:36px;display:block;margin:0;padding:0;text-indent:-9999px;background:#bcbcbc url(../img/social-ico-two.png) no-repeat 0 0;border-radius:48px;-moz-border-radius:48px;-webkit-border-radius:48px;-webkit-transition:all 0.5s ease-out;-moz-transition:all 0.5s ease-out;transition:all 0.5s ease-out}.social .fb{background-position:-44px 0;cursor:pointer}.social .vk{cursor:pointer}.social .vk:hover{background-color:#5B7FA6}.social .fb:hover{background-color:#354f89}.social .gp{background-position:-132px 0;cursor:pointer}.social .gp:hover{background-color:#c72f21}.social .tw{background-position:-144px 0;cursor:pointer}.social .tw:hover{background-color:#6398c9}.social .ok{background-position:-89px 0;cursor:pointer}.social .ok:hover{background-color:#f88f15}.social ul li a:hover{background-color:#065baa}.socialbox{margin:10px 0px}.hide{display:none}.footer .fl{font-size:12px}.fotter{background:#484f55;height:50px;color:#98a3ab}.fotter a{color:#98a3ab;line-height:50px;float:left;font-size:12px}.view_products2{list-style:none;overflow:auto;height:400px}.view_products2 img{float:left;margin-right:20px}.view_products2 li{margin:10px 0px}.pixbox{width:160px;margin:0 auto;height:200px;overflow:hidden;text-align:center}.form-order{background:#f5f5f5;padding:0 20px 20px 20px}#order-payment{float:right;width:280px}#order-delivery{float:right;width:280px}.delivery-data{margin-bottom:27px;position:relative;background:#95ba2f;display:none;border-radius:5px;float:left;box-sizing:border-box;padding:14px 20px;color:#fff;font-size:13px}.jcarousel-next-disabled,.jcarousel-prev-disabled{opacity:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"}.content2 br{display:none}.pixbox a{width:160px;height:200px;display:table-cell;vertical-align:middle}.pixbox img{max-width:160px;max-height:200px;vertical-align:middle}.pagination li.prev.disabled span{display:none}.pagination li.next.disabled span{display:none}.fr{float:right}.nobottom{border-bottom:none !important}.dotted a{border-bottom:1px dotted #808080}.mycabinet{padding-left:20px;margin-top:20px}.mycabinet .begin{text-transform:uppercase;font-size:13px;font-weight:bold;padding-bottom:15px}.mycabinet ul{margin:0px;padding:0px;list-style:none}.mycabinet ul li{padding-top:10px;padding-bottom:10px}.mycabinet a{color:#799920;text-decoration:none}.lay_title .uppercase{text-transform:uppercase}.lay_title .center{text-align:center}.lay_title{padding-top:15px;font-size:24px}.user_data{width:390px;border-right:1px solid #d2d2d2;float:left}.user_data .col{padding-bottom:35px}.user_data .col.last{padding-bottom:0px}.user_data .title{text-transform:uppercase;font-weight:bold;width:170px;float:left;font-size:13px}.user_data .data{float:left;font-size:13px}.edit_menu{float:left;padding-left:60px;font-size:13px}.edit_menu div{padding-bottom:20px}.edit_menu a{color:#799920;text-decoration:none}.edit_menu .dotted{border-bottom:1px dotted #799920}.user_edit_area{padding-top:30px}.user_data_editing{float:left}.inputs .col{padding-bottom:12px !important}.user_data_editing .col{padding-bottom:35px;width:432px}.user_data_editing .title{text-transform:uppercase;font-weight:bold;width:170px;float:left;font-size:13px}.user_data_editing .data{float:left;font-size:13px;width:262px}.user_data_editing input[type="text"]{padding:0;margin:0;border:1px solid #d2d2d2;padding-top:7px;padding-bottom:7px;padding-left:10px;padding-right:10px;border-radius:4px;font-size:12px;margin-top:-10px;width:240px}.user_data_editing .add{color:#799920;text-decoration:none;border-bottom:1px dotted #799920}.add_more{padding-bottom:24px;padding-left:170px}.delete{float:right}.delete_button{background:url('../img/ico_close.png') right no-repeat;width:16px;height:16px;float:right}.content_area{width:450px}#cancel{text-decoration:none;color:#799920;font-size:13px;border-bottom:1px dotted #799920;float:left;margin-left:40px}.buttons{display:inline-flex;align-items:center}.favorites{background-color:#f5f5f5;padding:5px;font-size:14px}.favorites .fav_point{background-color:#ffffff;border:1px solid #d2d2d2;border-radius:3px;padding-top:10px;padding-bottom:10px;padding-left:20px;padding-right:20px;margin-top:5px}.favorites .fav_point .left{float:left;padding-right:0;width:178px}.favorites .fav_point .right{float:right;padding-right:0;padding-left:0}.favorites .link{color:#799920;text-decoration:none;border-bottom:1px dotted #799920}.redtext{color:#f75d50}.greentext{color:#95ba2f}.hold .orders_view{display:none !important}.orders_view{width:680px;margin-top:13px;padding-top:13px;padding-bottom:5px;border-top:1px solid #d2d2d2;display:block}.orders_view .order{float:left;width:225px;text-align:center}.orders_view .order .order_price{color:#f75d50;font-weight:bold;font-size:15px}.orders_view .order .order_price span{font-size:24px}.orders_view .order img{padding-bottom:22px}.orders_view .order .note{font-size:13px}.orders_view .order .note span{color:#f75d50}.basket_hovered{position:absolute;border:1px solid #d2d2d2;border-radius:5px;padding:15px 20px;background-color:white;right:-1px;margin-top:10px;width:640px;display:none;z-index:1111}.open .basket_hovered{display:block}.open,.open .basket_hovered{-moz-box-shadow:0px 0px 5px rgba(149,149,149,0.75);-webkit-box-shadow:0px 0px 5px rgba(149,149,149,0.75);box-shadow:0px 0px 5px rgba(149,149,149,0.75)}.basket_hovered1:before{position:absolute;left:0;content:' ';width:100%;background-color:white;height:10px;top:45px;z-index:1112}.basket_item input{border:1px solid #d2d2d2;border-radius:4px;padding:9px;width:26px;font-size:18px;font-weight:bold;text-align:center;background-color:white;color:black;margin:7px}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.minus{background:url('../img/minus.png') no-repeat;width:15px;height:15px;display:inline-block;cursor:pointer}.plus{background:url('../img/plus.png') no-repeat;width:15px;height:15px;display:inline-block;cursor:pointer}.basket_sum{padding-top:15px}.basket_sum .sum_text{font-size:15px;text-transform:none;padding-top:12px;float:right !important;padding-top:1px;margin-bottom:11px}.basket_sum .sum_text span{font-size:18px;color:#f75d50;font-weight:bold}.basket_sum a{color:white !important;font-size:15px !important;float:right}.black{z-index:9999;width:100%;height:100%;position:absolute;display:block;padding-top:6%}.black:before{content:'';background-color:rgba(0,0,0,0.5);width:100%;height:100%;position:fixed;top:0}.black.hidden{display:none}.black .item_added_win{background-color:#ffffff;width:640px;margin:auto;position:relative}.black_close{position:absolute;top:30px;right:30px;background:url('../img/ico_close2.png') no-repeat;width:22px;height:22px;display:inline-block;cursor:pointer}.block_content{padding-left:20px;padding-right:20px}.item_added_win h2{text-transform:uppercase;text-align:center;padding:30px}.block_content .item{padding-top:20px;padding-bottom:20px;border-bottom:1px solid #d2d2d2}.uppercase{text-transform:uppercase}.w230{width:230px}.w260{width:260px}.w430{width:430px}.borderbottom{border-bottom:1px solid #d2d2d2}.left_block .begin{text-transform:uppercase;font-size:13px;font-weight:bold;padding-bottom:15px}.color_variants .variant{text-align:center;border:1px solid #d2d2d2;float:left;margin-right:5px;margin-bottom:5px}.variant:hover{cursor:pointer}.color_variants{margin-top:14px;margin-bottom:-5px}.color_variants .variant.active{width:44px;height:44px;border:2px solid #95ba2f}.color_variants .variant.active a{width:44px;height:44px}.tobasket{margin-top:20px;margin-bottom:20px}.tobasket:hover{color:white}.variant{width:46px;height:46px}.variant.active{width:44px;height:44px}.layout{margin-top:15px}.left_block{float:left}.right_block{float:right}.center_block{float:left;margin-left:23px}.left_block .links{margin-top:25px}.left_block .links li{list-style:none;padding-left:25px;display:inline-block;cursor:pointer;height:20px}.left_block .links ul{margin:0;padding:0}.left_block .links a{font-size:13.5px;text-decoration:none;color:#8ba73e}.links .add_bookmarks{background:url('../img/ico_add_bookmark.png') no-repeat center left}.links .what_price{background:url('../img/ico_price.png') no-repeat center left}.links .add_compare{background:url('../img/ico_scales.png') no-repeat center left}.spoiler_one{padding-top:15px;padding-bottom:15px;border-bottom:1px solid #d2d2d2}.spoiler_one .spoiler_content{margin-top:15px;font-size:13px}.spoiler_one .spoiler_content.hidden{display:none}.title_spoiler:hover{cursor:pointer}.title_spoiler{background:url('../img/ico_open.png') no-repeat center left;padding-left:17px;font-size:13px;text-transform:uppercase;color:#333333;font-weight:bold;text-decoration:none}.title_spoiler.closed{background:url('../img/ico_close3.png') no-repeat center left}.features{list-style:none;padding:0;margin:0;font-size:13px}.features a{font-size:13px;text-decoration:none;border-bottom:1px dotted #8ba73e;color:#8ba73e}.features li{padding-top:5px;padding-bottom:4px}.note_prod{width:225px;height:23px;overflow:hidden;border-radius:5px;display:table;text-transform:uppercase;font-size:11px;font-weight:bold}.note_prod .one{z-index:999}.note_prod .two{z-index:998}.note_prod .blue{float:left;padding-top:5px;padding-bottom:5px;background-color:#42b9f6;padding-left:10px;padding-right:5px;position:relative}.note_prod .blue:after{content:'';width:0;height:0;border-top:13px solid transparent;border-left:5px solid #42b9f6;border-bottom:13px solid transparent;position:absolute;top:-1px;margin-left:5px}.note_prod .red{float:left;padding-top:5px;padding-bottom:5px;background-color:#f75d50;padding-left:10px;padding-right:5px;position:relative;color:#ffffff}.note_prod .red:after{content:'';width:0;height:0;border-top:13px solid transparent;border-left:5px solid #f75d50;border-bottom:13px solid transparent;position:absolute;top:-1px;margin-left:5px}.note_prod .yellow{float:left;padding-top:5px;padding-bottom:5px;background-color:#fbc665;padding-left:10px;padding-right:5px;position:relative}.note_prod .yellow:after{content:'';width:0;height:0;border-top:13px solid transparent;border-left:5px solid #fbc665;border-bottom:13px solid transparent;position:absolute;top:-1px;margin-left:5px}.products_block .product{float:left;width:190px;vertical-align:bottom}.product .image{height:225px;position:relative}.product .image img{position:absolute;bottom:0;left:15px}.price{font-size:18px;color:#f75d50;font-weight:bold;text-align:center}.product{padding-bottom:30px;position:relative}.product p{font-size:15px;text-align:center;margin-top:15px}.left52{margin-left:52px}.product a{color:#ffffff}.mrg1{margin-top:25px;margin-bottom:15px}.products_martopbot{margin-top:60px;margin-bottom:100px}.cont_shop_but{display:table-cell;vertical-align:middle;padding:35px}.cont_shop{text-decoration:none;font-size:12px;border-bottom:1px dotted #799920;color:#799920}.icons{width:45px;height:50%;position:absolute;z-index:9;right:0;padding-top:25px;padding-right:15px}.icons a{width:44px;height:44px;float:left;border:1px solid #d2d2d2;margin-bottom:5px;background-color:white}a:hover{cursor:pointer}.basket_item .form-group{display:inline}.basket.open:after{content:'';position:absolute;top:43px;width:100%;height:10px;background-color:white;left:0;z-index:9990}.basket_hovered .basket_sum{float:left}a.active{font-weight:bold;text-decoration:underline}.HOME_RIGHT{display:inline-block;vertical-align:top;margin-left:10px;position:absolute}#HOME_UNDER_SLIDER > div{display:inline-block;margin-right:3px;margin-top:3px}.sort_block{display:inline-block}.sort_block ul{display:inline-block;margin:0;padding:0}.sort_block ul li{display:inline-block;margin:0 0.5em;list-style:none}.sort_block ul li a.asc:after,.sort_block ul li a.desc:after{display:block;width:5px;height:3px;position:absolute;top:50%;margin-top:-1px;right:-10px;content:'';background:url("../img/arrow_sort_asc_desc.png") no-repeat}.sort_block ul li a.asc:after{background-position:0 0}.sort_block ul li a.desc:after{background-position:0 -3px}.home_banner_up{margin-top:20px}.home_banner_up .HOME_RIGHT{display:block;float:right;position:static;margin-left:0}#HOME_SLIDER .jssorb03 div,#HOME_SLIDER .jssorb03 div:hover,#HOME_SLIDER .jssorb03 .av{width:6px;height:6px;border-radius:50%;line-height:6px;background:#fff;border:2px solid #fff;box-shadow:0px 0px 5px 0px rgba(54, 54, 54, 0.75)}#HOME_SLIDER .jssorb03 div.av:hover,#HOME_SLIDER .jssorb03 div.av:active,#HOME_SLIDER .jssorb03 .av{cursor:default;background:#95BA2F}.special-products{padding-top:30px}.special-products .link_buy{margin-bottom:0}.special-products .item{margin-bottom:0 !important;text-align:center}.why_me_{padding-top:30px;overflow:hidden;margin-bottom:60px}.why_me_ .why_list{width:1038px;margin-left:-58px}.seo_text p{margin:12px 0 0 0;font-size:13px !important;color:#333 !important;font-family:Roboto !important}.seo_text p:first-child{margin-top:0}.product-special{position:absolute}.jcarousel-skin-tango .jcarousel-item{width:38px;height:38px;border:1px solid #d2d2d2;text-align:center;background:#fff}.jcarousel-skin-tango .jcarousel-item a{display:table-cell;width:38px;height:38px;vertical-align:middle}.mycarousel img{max-width:38px;max-height:38px;border:0;vertical-align:middle}.jcarousel-skin-tango .jcarousel-clip-vertical,.jcarousel-skin-tango .jcarousel-container-vertical{height:175px}.jcarousel-skin-tango .jcarousel-container-vertical{padding:0}.jcarousel-skin-tango .jcarousel-prev-vertical{top:-13px}.jcarousel-skin-tango .jcarousel-next-vertical{bottom:-13px}.jcarousel-skin-tango .jcarousel-prev-vertical,.jcarousel-skin-tango .jcarousel-next-vertical{left:0;width:42px;background-position:14px 0}.jcarousel-skin-tango .jcarousel-prev-vertical:hover,.jcarousel-skin-tango .jcarousel-next-vertical:hover{background-position:14px 0;left:0}ul.product-special{position:absolute;top:0;left:16px}ul.product-special li{width:100%;float:left}ul.product-special li div{color:#333;font-size:10px;text-transform:uppercase;font-weight:700;height:22px;line-height:24px;padding:0 9px;position:relative;border-top-left-radius:4px;border-bottom-left-radius:4px;margin-top:8px;float:left}ul.product-special li:first-child{margin-top:0}ul.product-special li.top div{background:#fbc665}ul.product-special li.top div:after{content:'';position:absolute;right:-19px;top:3px;border:11px solid transparent;border-top:5px solid #fbc665;transform:rotate(-90deg)}ul.product-special li.new div{background:#42b9f6}ul.product-special li.new div:after{content:'';position:absolute;right:-18px;top:2px;border:11px solid transparent;border-top:5px solid #42b9f6;transform:rotate(-90deg)}ul.product-special li.promo div{background:#f75d50}ul.product-special li.promo div:after{content:'';position:absolute;right:-18px;top:2px;border:11px solid transparent;border-top:5px solid #f75d50;transform:rotate(-90deg)}.cost-block{margin-top:1px}.products.pn a.link_buy{margin-bottom:0}.products.pn{padding-bottom:0}.products.pn>ul{width:100%;float:left;margin-bottom:-3px}._form_checkbox_reset,.sort_block ul li a,.sort_block{font-size:12px}.filter_accept_bloc{margin-top:13px;margin-bottom:0}._form_checkbox_reset{color:#6a6a6a;display:block;width:128px;height:28px;border:1px solid #d2d2d2;line-height:28px;text-align:center;border-radius:4px;text-decoration:none;margin:0 auto}._form_checkbox_reset:hover{border:1px solid #95ba2f;color:#6a6a6a}._form_checkbox_reset:active{border:1px solid #95ba2f;background:#95ba2f;color:#fff}.sort_block ul li a{color:#8fa951;position:relative}.sort_block ul li a:hover{color:#333}#HOME_SLIDER .jssora03l,#HOME_SLIDER .jssora03r{width:36px;height:340px;background:url('../img/new_arrows_.png') no-repeat}#HOME_SLIDER .jssora03l,#HOME_SLIDER .jssora03l:hover{background-position:0 50%;left:0;top:0}#HOME_SLIDER .jssora03r,#HOME_SLIDER .jssora03r:hover{background-position:-36px 50%;right:0;top:0}.loyout ._prd_spec-wr{margin-top:10px}.loyout .special-products:first-child{border-top:0;padding-top:0}.irs-slider{width:13px;height:13px;top:25px;border-radius:100%;box-shadow:none;border:1px solid #d2d2d2;background:#ffffff;background:-moz-linear-gradient(top, #ffffff 0%, #ebebeb 100%);background:-webkit-linear-gradient(top, #ffffff 0%,#ebebeb 100%);background:linear-gradient(to bottom, #ffffff 0%,#ebebeb 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ebebeb',GradientType=0 )}.irs-slider.state_hover,.irs-slider:hover{background:#ffffff}.irs-slider:after{display:none}.irs-slider:before{content:"";position:absolute;width:5px;height:5px;z-index:2;border:1px solid #d2d2d2;border-radius:100%;background:#799920;top:3px;left:3px}.irs-bar{height:3px;top:30px}.irs-line{height:9px;background:#ebebeb;border:1px solid #d2d2d2;top:27px}.irs-line:before{width:166px;height:5px;position:absolute;content:'';top:2px;left:2px;background:#d2d2d2;border-radius:5px}.irs-min,.irs-max{display:none}.irs{height:49px}.price_filter.first_price_li{margin-top:8px}.product_read_ .w{width:110px;overflow:hidden;margin:0;padding-top:0;display:table-cell;vertical-align:middle;height:32px;float:none}.product_read_ .w strike,.product_read_ .w .cost{width:100%;float:left}.product_read_price .link_buy{width:118px;position:absolute;top:50%;right:0;margin:-16px 0 0 0}.product_read_price{position:relative;min-height:32px;margin-top:10px}.special-products.products h3{margin-bottom:10px}.special-products.products li.item{margin-top:30px}.productLeftBar .cost_box{border-top:0;padding:10px 0 15px 0}.productLeftBar .product_mod{width:100%;float:left;border-bottom:1px solid #d2d2d2;padding-bottom:15px}.field-orders-delivery .control-label,.field-orders-payment .control-label,.field-orders-body .control-label,.textareagroup .control-label{width:100%;float:left}.basket_title_{text-align:center}.cont_shopping-wr{width:100%;float:left;margin-top:10px}.cont_shopping-wr .cont_shopping{float:right}.cont_shopping{display:block !important;border-top:0 !important;border-left:0 !important;border-right:0 !important;border-bottom:1px dashed #799920 !important;color:#799920 !important;margin:0 !important;padding:0 !important;font-size:12px !important;float:left;border-radius:0 !important}.info.product-thumb-video{width:100%;height:100%}.info.product-thumb-video iframe,.info.product-thumb-video embed{width:100% !important;height:auto !important}.input-blocks-wrapper,.input-blocks{width:100%;float:left}.form-order .input-blocks-wrapper{margin-top:6px}.input-blocks label{font-size:13px;color:#333}.basket_input_2 label{height:30px;line-height:30px;float:left;width:70px !important;padding-top:0 !important}.custom-input-2{width:100%;height:30px;box-sizing:border-box;outline:none;line-height:30px;padding-left:8px;margin-top:5px;background:#fff;border-radius:4px}.custom-input-2,.custom-area-2,.textareagroup textarea{border:1px solid #d2d2d2;box-sizing:border-box;font-size:13px;color:#636363}.custom-area-2,.textareagroup textarea{min-height:128px;max-height:128px;resize:none;width:100%;max-width:100%;outline:none;padding-left:8px;padding-top:8px;margin-top:8px}.basket_input_2 .custom-input-2{width:270px;float:right;margin-top:0}.custom-input-2:focus,.custom-area-3:focus,.textareagroup textarea:focus{box-shadow:1px 2px 2px 0px rgba(215, 215, 215, 0.75) inset;transition:0.1s}.textareagroup textarea:focus{border:1px solid #d2d2d2}.title_groups,.radio_grp label.control-label,.textareagroup .control-label{font-size:12px;font-weight:bold;text-transform:uppercase;margin-bottom:12px}.input-blocks-group{width:100%;float:left;border-bottom:1px solid #d2d2d2;padding-bottom:20px;margin-top:18px}.custom-form-buttons{width:100%;float:left}input.custom-radio + label,input.custom-check + label{font-size:13px;cursor:pointer;margin-left:6px}input.custom-radio,input.custom-check{display:none}input.custom-radio + label span{width:16px;height:16px;background:url('../img/radio_new.png') no-repeat;float:left;transition:.2s;margin-top:1px}input.custom-radio:checked + label span,input.custom-radio:checked + label:hover span{background:url('../img/radio_new-active.png') no-repeat}input.custom-radio + label:hover{text-decoration:underline}.custom-form-buttons{margin-top:7px}.custom-form-buttons:first-child{margin-top:0}.delivery-data .field-order-delivery-childs .control-label{display:none}.checkout_basket{width:100%;float:left}.checkout_basket button{margin:0 auto}.input-blocks-wrapper .help-block{padding-left:71px;padding-top:4px;width:100%;float:left;box-sizing:border-box;margin-bottom:0}.cont_shop_but-wr{height:33px;margin-top:35px;padding-bottom:29px}.cont_shop_but-wr .cont_shop{margin-top:8px;float:left}.cont_shop_but-wr .submit4.bottom3{float:right}._qqq_ .params{font-size:12px}.activeShow{border-bottom:0 !important}.delivery-data:after{width:100%;border-bottom:1px solid #d2d2d2;position:absolute;content:'';bottom:-27px;left:0}.img_ajax_basket img{margin-right:0 !important;max-width:90px;max-height:90px;vertical-align:middle}.jcarousel-skin-tango>li{display:none}#login-form{margin:50px auto 0 auto}#bg{top:0 !important;z-index:1 !important}.top,.wrap,.bottom,.fotter{position:relative;z-index:2}.owl-pagination{display:none}.owl-controls .owl-buttons div{width:34px !important;height:50px !important;background:#596065 !important;top:50% !important;margin:-25px 0 0 0 !important;opacity:1 !important;border-radius:0 !important;padding:0 !important;position:absolute}.owl-controls .owl-buttons div:hover{background:#acafb2 !important;transition:0.2s !important}.owl-controls .owl-buttons .owl-prev{border-top-right-radius:4px !important;border-bottom-right-radius:4px !important;left:-20px}.owl-controls .owl-buttons .owl-next{border-top-left-radius:4px !important;border-bottom-left-radius:4px !important;right:-20px}.owl-controls .owl-buttons div:before{position:absolute;content:'';width:8px;height:22px;background:url("../img/arrows_blocks.png") no-repeat;top:50%;margin-top:-11px;left:50%;margin-left:-4px}.owl-controls .owl-buttons .owl-prev:before{background-position:0 0}.owl-controls .owl-buttons .owl-next:before{background-position:-8px 0}.basket_input_2.required .control-label{position:relative}.basket_input_2.required .control-label:before{position:absolute;top:0;content:'*';color:#D60000;left:-11px;padding-top:2px}.float-left{float:left}.blog-show-img{padding-right:20px}.text_seo.hidden_seo{height:178px;overflow:hidden;position:relative}.text_seo.hidden_seo div{height:162px;overflow:hidden;position:relative}.text_seo.hidden_seo a{position:absolute;bottom:0;right:0;font-size:16px}.text_seo.hidden_seo div:before{content:'';display:block;position:absolute;bottom:0;right:0;left:0;height:120px;background:-moz-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:-o-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:-ms-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%)}.special-products{border-bottom:1px solid #d2d2d2}a.link_buy,.checkout_basket button,.submit4{font-size:15px}.cost,.product_read_price #cost{font-size:20px}.cost span,.cost span.valute,.product_read_price .valute{font-size:15px}
2 1 \ No newline at end of file
  2 +html,form,body{padding:0;margin:0;font-family:'Roboto';font-size:14px;color:#333;height:100%}h1,h2,h3{margin:0;padding:0 0 10px}.fl{float:left}.fotter .wrap .fr{float:right;width:180px;height:50px;position:relative;font-size:12px}.fotter .wrap .fr img{position:absolute;top:50%;margin-top:-10px;right:0}.fotter .wrap .fl{line-height:50px;font-size:12px}.both{clear:both}h1{margin:10px 0;font-size:24px}h3{margin-bottom:30px}p{margin:3px 0;padding:0}a{color:#6a6a6a;font-size:14px;text-decoration:underline}a:hover{color:#799920}.wrap{width:960px;margin:0 auto}.f{background:#fff}.br{-webkit-box-shadow:-1px 5px 14px 0 rgba(50,46,50,0.46);-moz-box-shadow:-1px 5px 14px 0 rgba(50,46,50,0.46);box-shadow:-1px 5px 14px 0 rgba(50,46,50,0.46);padding:20px}nav.top{background:#f5f5f5;padding:10px 0;border-bottom:1px solid #d2d2d2;font-size:12px}nav.top ul{list-style:none;margin:0;padding:0}nav.top ul li{float:left;padding-right:20px}nav.top ul li a{font-size:12px}nav.top a{color:#6a6a6a;text-decoration:none}#help{background:url(../img/help.png) right no-repeat;padding-right:20px}#help span{border-bottom:1px dotted #6a6a6a}#login{background:url(../img/login.png) right no-repeat;padding-right:20px;font-size:12px}#login span{border-bottom:1px dotted #6a6a6a}.search{margin:-5px 0 -5px 100px;float:left}nav input[type="text"]{width:325px;outline:0;border:1px solid #d8d6d6;border-radius:5px;padding:5px 0;font-size:14px;text-indent:10px}nav input[type="submit"]{width:35px;height:29px;border:none;background:url(../img/lupa_sub.png) center no-repeat;margin-left:-35px;cursor:pointer}.header{margin:0 0 20px}.phone{float:left;position:relative;text-align:center}.phone .tel{font-size:23px}.phone .tel span.more{margin-bottom:3px}.more_block{background:#fff;border:1px solid #d2d2d2;padding:10px;position:absolute;font-size:20px;display:none;z-index:99}.more{background:url(../img/more.png) no-repeat;width:12px;height:7px;display:inline-block;cursor:pointer;margin-bottom:5px}.logo{margin:0 auto;width:193px}.logo a{display:block;width:193px;height:84px;background:url(../img/logo.png) no-repeat}.logo a span{display:none}#call{color:#6a6a6a;text-decoration:none;border-bottom:1px dotted #6a6a6a}.basket{float:right;position:relative;border:1px solid #d2d2d2;border-radius:5px;padding:15px 20px;font-size:18px;text-transform:uppercase;margin-top:13px}.basket .info{float:left;border-right:1px solid #d2d2d2;padding-right:10px;margin-right:17px}.basket .info span{color:#f75d50;font-size:22px}.basket a:link,.basket a:visited{text-decoration:none;color:#000;font-size:18px}.basket span.more{margin-bottom:-1px}.menu{background:#596065;border:1px solid #e8e8e8}.menu ul{margin:0;padding:0;list-style:none}.menu ul li{float:left;border-left:1px solid #8b9094;height:43px}.menu ul li:first-child{border-left:none}.menu ul li a{width:100%;height:100%;line-height:43px;float:left;box-sizing:border-box;padding:0 19px;text-transform:uppercase;color:#fff;font-size:15px;text-decoration:none;font-weight:600}.menu ul li:hover{background:#3e454b}.menu ul li.active a{background:#f5f5f5;color:#596065}.menu ul li.active a:hover{cursor:default}.menu_childs{background:#f5f5f5;border:1px solid #e8e8e8;border-bottom:2px solid #596065}.menu_childs ul{margin:0;padding:0;list-style:none}.menu_childs ul li{float:left}.menu_childs ul li a{float:left;padding:15px 23px;text-transform:uppercase;color:#596065;font-size:14px;font-weight:700;text-decoration:none}.menu_childs ul li a:hover{color:#878b8e}.fr ul li{border:none}.akciya a{background:#f75d50;color:#fff}.brands a{background:#95ba2f;color:#fff}a.myorders{color:#f75d50}.sub{margin:2px 0 0}.sub img{float:left;margin-right:2px}.rubrics{margin:60px 0 0;padding-bottom:27px}.rubrics ul{list-style:none;margin:0;padding:0}.rubrics ul li{float:left;margin:0 35px}.rubrics ul li a{float:left;width:120px;padding-top:130px;text-align:center;text-transform:uppercase;color:#494949;text-decoration:none;font-weight:700}.rubrics ul li.item_ryukzaki a{background:url(../img/ico1.png) no-repeat}.rubrics ul li.item_sumki a{background:url(../img/ico2.png) no-repeat}.rubrics ul li.item_chehly a{background:url(../img/ico3.png) no-repeat}.rubrics ul li.item_nesessery a{background:url(../img/ico4.png) no-repeat}.rubrics ul li.item_koshelki a{background:url(../img/ico5.png) no-repeat}.products{padding-bottom:30px;padding-top:20px}.why_me_,.products{border-top:1px solid #d2d2d2}.products ul{list-style:none;margin:0;padding:0}.products ul li.item{float:left;width:192px;margin:0 0 50px;text-align:center;position:relative}.products ul li a.name,.special-products a.name{display:block;color:#799920;font-size:15px;text-decoration:none;margin:15px 0 0;height:35px;overflow:hidden;box-sizing:border-box;padding:0 10px}.products ul li a.name:hover,.special-products a.name:hover{text-decoration:underline}.products ul li .info{text-align:left}.pn{border:none}.cost,.product_read_price #cost{color:#f75d50;font-size:18px;margin:0;padding:0}.cost span,.cost span.valute,.product_read_price .valute{font-size:14px}strike,strike span#old_cost{font-size:14px;color:#333}.submit4m,a.link_buy,.checkout_basket button,.submit4{background:#95ba2f;border-radius:4px;height:29px;text-transform:uppercase;color:#fff;text-decoration:none;font-weight:600;text-align:center;border-bottom:3px solid #799920;font-size:12px}.submit4.bottom3{font-size:12px!important;display:block}.basket .submit4.bottom3{font-size:12px!important;display:block;margin-top:10px}a.link_buy,.checkout_basket button{display:block;margin:0 auto 10px;width:122px;line-height:32px}.checkout_basket button,.submit4{margin:0;padding:0 20px;line-height:31px;width:auto;border-top:0;border-left:0;border-right:0;cursor:pointer}a.link_buy:hover,.submit4m:hover,.checkout_basket button:hover,.submit4:hover,.btn-primary:hover{border-bottom:3px solid #95ba2f}a.link_buy:active,.submit4m:active,.checkout_basket button:active,.submit4:active,.btn-primary:active{background:#799920;border-bottom:3px solid #799920}.checkout_basket button:focus,.submit4:focus{outline:none}.mycarousel{position:absolute;right:22px;top:13px}ul.mycarousel{list-style:none;margin:0;padding:0}ul.mycarousel li{margin:0;padding:0}.mycarousel img{border:1px solid #d2d2d2}h3{text-align:center;text-transform:uppercase;font-size:20px}span.why{width:213px;height:49px;background:url(../img/logo-why.png) no-repeat;margin:0 auto;padding:0 0 20px;height:29px;display:block}ul.why_list{list-style:none;margin:0;padding:0}ul.why_list li{float:left;margin-left:58px;width:288px;height:96px;box-sizing:border-box;padding-left:110px;margin-top:20px}ul.why_list li div{display:table-cell;height:96px;vertical-align:middle}ul.why_list li span{font-weight:700;color:#799920}ul.why_list li.item1{background:url(../img/why_item1.png) left no-repeat}ul.why_list li.item2{background:url(../img/why_item2.png) left no-repeat}ul.why_list li.item3{background:url(../img/why_item3.png) left no-repeat}ul.why_list li.item4{background:url(../img/why_item4.png) left no-repeat}ul.why_list li.item5{background:url(../img/why_item5.png) left no-repeat}ul.why_list li.item6{background:url(../img/why_item6.png) left no-repeat}.banner_akciya{margin:50px 0}.bottom{background:#4d5458;padding:40px 0;color:#fff}.bottom .leftbar{float:left;width:210px}.bottom ul{list-style:none;margin:0;padding:0;line-height:23px}.bottom ul a{color:#fff;font-size:15px;text-decoration:none}.bottom ul a:hover{color:#799920}.phones{padding-left:25px;background:url(../img/phone.png) left top no-repeat;margin-top:50px;line-height:23px;font-size:18px}.map{padding:5px 0 5px 25px;background:url(../img/map.png) left no-repeat;margin-bottom:7px}a.more_map{color:#99a5ad;border-bottom:1px dotted #99a5ad;text-decoration:none;font-size:11px;text-align:center}.bread-crumbs{padding:0 0 0 20px;border-bottom:1px solid #d2d2d2;height:29px}.bread-crumbs ul{list-style:none;margin:0;padding:0;height:29px}.bread-crumbs ul li{float:left;padding-left:20px;height:100%;line-height:29px;color:#7d7d7d;position:relative;font-size:12px}.bread-crumbs ul li:first-child{padding-left:0}.bread-crumbs ul li a{font-size:12px;display:block;color:#7d7d7d}.bread-crumbs ul li a:visited,.bread-crumbs ul li a:link{color:#7d7d7d;text-decoration:underline}.bread-crumbs ul li a:hover{color:#464646;text-decoration:none}.breadcrumb > li + li:before{color:#ccc;content:"/";position:absolute;top:0;left:8px}.loyout{padding:20px 0}.leftbar{float:left;width:172px;margin-right:20px}.rightbar{float:right;width:380px;margin-left:40px}.rightbar.basket_rightbar{margin-right:20px}.rightbar2{float:right;width:320px}.content{overflow:hidden}* html .content{height:1%}.content2{overflow:hidden}* html .content2{height:1%}.filters{border-top:1px solid #d2d2d2;padding:20px 0 0;margin-top:20px}.filters .begin{text-transform:uppercase;font-weight:700;font-size:12px}.filters ul{list-style:none;margin:0;padding:0;line-height:22px;margin-top:6px}.filters ul li{position:relative;box-sizing:border-box;padding-left:24px;line-height:16px;margin-top:7px}.filters ul li:first-child{margin-top:0}.filters ul li>input{position:absolute;left:4px;margin:0;top:3px}.filters ul li a{color:#464646;text-decoration:none;font-size:13px;line-height:16px}.filters ul li a:hover{text-decoration:underline}.productLeftBar{float:left;width:228px;margin-left:20px;margin-right:20px}.productRightBar{float:right;width:260px;margin:0 20px}.productLeftBar h1{font-size:24px;border-bottom:1px solid #d2d2d2;margin-bottom:10px}ul.product_mod{list-style:none;margin:10px 0 0;padding:0;float:left}ul.product_mod li{float:left;width:46px;height:46px;background:#fff;border:1px solid #d2d2d2;margin:5px 5px 0 0;text-align:center;position:relative}ul.product_mod li.active:before{width:48px;height:48px;position:absolute;content:'';background:none;border:2px solid #95ba2f;top:-1px;left:-1px;box-sizing:border-box}ul.product_mod li a{width:46px;height:46px;display:table-cell;vertical-align:middle}ul.product_mod li a:focus{outline:none}ul.product_mod li img{vertical-align:middle;max-width:46px;max-height:46px}ul.product_colors{list-style:none;margin:30px 0 0;padding:0;float:left}ul.product_colors li{float:left;margin:10px 10px 0 0;width:98px;height:98px;text-align:center;border:1px solid #d2d2d2}ul.product_colors li a{width:98px;height:98px;vertical-align:middle;display:table-cell}ul.product_colors li img{max-width:98px;max-height:98px;vertical-align:middle}.productLeftBar .begin{text-transform:uppercase;font-weight:700;font-size:12px}.cost_box{border-top:1px solid #d2d2d2;border-bottom:1px solid #d2d2d2;margin:10px 0;padding:10px 0}.cost_box .w{float:left;margin-right:20px;padding-top:5px}.product_service ul{list-style:none;margin:0;padding:0}.product_service ul li a{color:#799920;text-decoration:none;border-bottom:1px dotted #799920;font-size:12px}.product_service ul li.item1{background:url(../img/li1.png) left no-repeat;padding:3px 23px}.product_service ul li.item2{background:url(../img/li2.png) left no-repeat;padding:3px 23px}.product_service ul li.item3{background:url(../img/li3.png) left no-repeat;padding:3px 23px}#nav_product{list-style:none;margin:0;padding:0;line-height:23px}#nav_product li a{background:url(../img/li_plus.png) left no-repeat;padding:3px 15px;color:#000;text-transform:uppercase;text-decoration:none;font-weight:700;font-size:12px}#nav_product li a.active{background:url(../img/li_minus.png) left no-repeat}#nav_product li .info{display:none;border-bottom:1px solid #d2d2d2;padding:10px 0;margin-bottom:10px}#nav_product li .info,#nav_product li .info p{font-size:12px;line-height:16px}.modal_box{position:fixed;left:0;top:0;width:100%;height:100%;z-index:999;background:#000;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#data_box{position:absolute;top:100px;z-index:1000;width:400px;background:#fff;-webkit-box-shadow:0 0 15px #000;-moz-box-shadow:0 0 15px #000;box-shadow:0 0 15px #000;border:7px solid #1b9bb6;border-radius:5px}#data_box .data_wrp{padding:25px 15px 15px}#data_box .data_wrp h1{text-transform:uppercase}#data_box .data_wrp hr{height:1px;border:none;color:#000;background:#000;margin:45px 0 20px}#data_box .data_wrp hr.hr{height:1px;border:none;color:#000;background:#000;margin:20px 0}#data_box .pic-tango{margin-right:7px;margin-bottom:7px}#modal_close{cursor:pointer;margin-top:-80px;margin-right:-50px}.rightbar .control-label,.textareagroup .control-label{float:left;width:80px;padding-top:5px}.form-control{outline:0;border:1px solid #d8d6d6;border-radius:5px;padding:5px 0;font-size:14px;text-indent:10px;margin-bottom:3px;width:250px}.form-control:focus{border:#1b9bb6 1px solid;box-shadow:0 0 10px #1b9bb6;-webkit-box-shadow:0 0 10px #1b9bb6;-moz-box-shadow:0 0 10px #1b9bb6}.help-block{color:red;font-size:12px;margin-bottom:5px}.basket_item{padding:10px 0;border-bottom:1px solid #b7b7b7;clear:both}.basket_item img{margin-right:20px}.basket_item .count{margin:20px 0}.basket_item .fr{margin-top:13px}.basket_item .info{overflow:hidden}.basket_item > a{display:block;float:left}a.del:visited,a.del:link{background:url(../img/del.png) left center no-repeat;padding:2px 25px;font-size:12px;font-weight:400;color:#787878;text-decoration:underline}a.del:hover{color:#a52828;text-decoration:underline}.total{text-align:right;color:#87476a;font-size:20px;margin:10px 0}.submit4m{font-family:Roboto;border:none;background:#95ba2f;border-radius:4px;color:#fff;text-transform:uppercase;font-size:10px;cursor:pointer;width:102px;height:29px;border-bottom:3px solid #799920;line-height:29px}.submit4m:active,.submit4m:focus{outline:none}.btn-primary{border-bottom:3px solid #799920;border-top:0;border-right:0;border-left:0;margin-top:5px;padding:0 15px;background:#95ba2f;border-radius:4px;color:#fff;text-transform:uppercase;text-decoration:none;font-size:12px;font-weight:700;cursor:pointer;height:29px;line-height:29px}.btn-primary:active,.btn-primary:focus{outline:none}a.logout:visited,a.logout:link{border:none;padding:3px 5px;background:#f75d50;border-radius:5px;color:#fff;text-transform:uppercase;text-decoration:none;font-size:11px;font-weight:400;cursor:pointer}a.logout:hover{background:#95ba2f}.boy_box{border-bottom:1px solid #b7b7b7;padding:0 0 15px}.boy_box div{padding-top:10px}.content_product .info{padding:0 0 20px}a.btn-success{display:inline-block;border:2px solid #d8d6d6;color:#95ba2f;border-radius:5px;padding:5px;margin-bottom:10px;text-decoration:none;font-size:14px}a.btn-success:hover{border:#95ba2f 2px solid;color:#f75d50}.txtb1{font-size:14px;font-weight:700}.txtf{font-size:14px;font-weight:700;color:#87476a}.txtfb{font-size:20px;font-weight:700;color:#87476a}.count{margin:20px 0}.count input[type="number"]{outline:0;width:50px;border:1px solid #d8d6d6;border-radius:5px;padding:5px 0;font-size:14px;text-indent:10px;margin-bottom:7px}a.link2:visited,a.link2:link{font-size:14px;font-weight:700;color:#95ba2f;text-decoration:none}a.link2:hover{color:#f75d50;text-decoration:underline}.well{margin:50px auto;width:400px;background:#f5f5f5;border:1px solid #e8e8e8;padding:20px;border-radius:5px}.control-label{float:left;width:100px;padding-top:5px}#user-verifycode-image{display:block}.form-inline{display:inline}.form-inline .form-group{float:left;margin-right:10px}.form-inline .form-group select{width:100px}.form-group{margin-bottom:10px}.table-bordered{width:100%;border:1px solid silver}.table-bordered th{background:#B3D1FD;padding:5px}.table-bordered tr td{border:1px solid silver;padding:5px}.table-bordered .filters{display:none}.formCost label{float:left;width:30px}ul.brends_list{list-style:none;margin:0;padding:0}ul.brends_list li{float:left;text-align:center;margin:0 15px 20px}.compare{text-align:center}.compare a:visited,.compare a:link{font-size:12px;text-decoration:underline}.alert-success{margin:10px 0;padding:10px;border:1px solid #3ed824;border-radius:5px;background:#c0feb5}.news_item{padding-bottom:20px;margin-bottom:20px;border-bottom:1px solid silver}.news_item img{margin-right:20px}.news_item a{font-size:16px}.pic{width:392px;height:365px}.pic a{width:392px;height:365px;display:table-cell;vertical-align:middle}.pic a img{max-width:392px;max-height:365px;vertical-align:middle}input#subscribe-email::-webkit-input-placeholder{color:#596065}input#subscribe-email::-moz-placeholder{color:#596065}input#subscribe-email:-ms-input-placeholder{color:#596065}input#subscribe-sale::-webkit-input-placeholder{color:#596065}input#subscribe-sale::-moz-placeholder{color:#596065}input#subscribe-sale:-ms-input-placeholder{color:#596065}#subscribe-email,#subscribe-sale{color:#596065}#subscribe-sale{width:100px;float:left;margin-right:20px;height:28px}.saletxt{width:150px;float:left;color:#fff;font-size:12px}#subscribe-email{width:370px}.txts{color:#9da9b1;font-size:18px;margin-bottom:20px}.content ul.pagination{list-style:none;text-align:center;margin:0 0 16px;padding:0 0 20px;border-bottom:1px solid #d2d2d2}.content ul.pagination li{display:inline}.content ul.pagination li a{padding:3px;color:#82a02f;font-size:15px;margin:0;text-decoration:none}.content ul.pagination li a:hover{text-decoration:underline}.content ul.pagination li.active a{color:#333}.boxitem{height:318px}ul.social{margin-top:20px}.social{list-style:none;margin:10px;padding:0;height:48px}.social li{display:inline-block;margin-right:7px;padding-bottom:10px}.social li a{width:36px;height:36px;display:block;margin:0;padding:0;text-indent:-9999px;background:#bcbcbc url(../img/social-ico-two.png) no-repeat 0 0;border-radius:48px;-moz-border-radius:48px;-webkit-border-radius:48px;-webkit-transition:all .5s ease-out;-moz-transition:all .5s ease-out;transition:all .5s ease-out}.social .fb{background-position:-44px 0;cursor:pointer}.social .vk{cursor:pointer}.social .vk:hover{background-color:#5B7FA6}.social .fb:hover{background-color:#354f89}.social .gp{background-position:-132px 0;cursor:pointer}.social .gp:hover{background-color:#c72f21}.social .tw{background-position:-144px 0;cursor:pointer}.social .tw:hover{background-color:#6398c9}.social .ok{background-position:-89px 0;cursor:pointer}.social .ok:hover{background-color:#f88f15}.social ul li a:hover{background-color:#065baa}.socialbox{margin:10px 0}.hide{display:none}.footer .fl{font-size:12px}.fotter{background:#484f55;height:50px;color:#98a3ab}.fotter a{color:#98a3ab;line-height:50px;float:left;font-size:12px}.view_products2{list-style:none;overflow:auto;height:400px}.view_products2 img{float:left;margin-right:20px}.view_products2 li{margin:10px 0}.pixbox{width:160px;margin:0 auto;height:200px;overflow:hidden;text-align:center}.form-order{background:#f5f5f5;padding:0 20px 20px}#order-payment{float:right;width:280px}#order-delivery{float:right;width:280px}.delivery-data{margin-bottom:27px;position:relative;background:#95ba2f;display:none;border-radius:5px;float:left;box-sizing:border-box;padding:14px 20px;color:#fff;font-size:13px}.jcarousel-next-disabled,.jcarousel-prev-disabled{opacity:0;-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0)}.content2 br{display:none}.pixbox a{width:160px;height:200px;display:table-cell;vertical-align:middle}.pixbox img{max-width:160px;max-height:200px;vertical-align:middle}.pagination li.prev.disabled span{display:none}.pagination li.next.disabled span{display:none}.fr{float:right}.nobottom{border-bottom:none!important}.dotted a{border-bottom:1px dotted gray}.mycabinet{padding-left:20px;margin-top:20px}.mycabinet .begin{text-transform:uppercase;font-size:13px;font-weight:700;padding-bottom:15px}.mycabinet ul{margin:0;padding:0;list-style:none}.mycabinet ul li{padding-top:10px;padding-bottom:10px}.mycabinet a{color:#799920;text-decoration:none}.lay_title .uppercase{text-transform:uppercase}.lay_title .center{text-align:center}.lay_title{padding-top:15px;font-size:24px}.user_data{width:390px;border-right:1px solid #d2d2d2;float:left}.user_data .col{padding-bottom:35px}.user_data .col.last{padding-bottom:0}.user_data .title{text-transform:uppercase;font-weight:700;width:170px;float:left;font-size:13px}.user_data .data{float:left;font-size:13px}.edit_menu{float:left;padding-left:60px;font-size:13px}.edit_menu div{padding-bottom:20px}.edit_menu a{color:#799920;text-decoration:none}.edit_menu .dotted{border-bottom:1px dotted #799920}.user_edit_area{padding-top:30px}.user_data_editing{float:left}.inputs .col{padding-bottom:12px!important}.user_data_editing .col{padding-bottom:35px;width:432px}.user_data_editing .title{text-transform:uppercase;font-weight:700;width:170px;float:left;font-size:13px}.user_data_editing .data{float:left;font-size:13px;width:262px}.user_data_editing input[type="text"]{padding:0;margin:0;border:1px solid #d2d2d2;padding-top:7px;padding-bottom:7px;padding-left:10px;padding-right:10px;border-radius:4px;font-size:12px;margin-top:-10px;width:240px}.user_data_editing .add{color:#799920;text-decoration:none;border-bottom:1px dotted #799920}.add_more{padding-bottom:24px;padding-left:170px}.delete{float:right}.delete_button{background:url(../img/ico_close.png) right no-repeat;width:16px;height:16px;float:right}.content_area{width:450px}#cancel{text-decoration:none;color:#799920;font-size:13px;border-bottom:1px dotted #799920;float:left;margin-left:40px}.buttons{display:inline-flex;align-items:center}.favorites{background-color:#f5f5f5;padding:5px;font-size:14px}.favorites .fav_point{background-color:#fff;border:1px solid #d2d2d2;border-radius:3px;margin-top:5px;padding:10px 20px}.favorites .fav_point .left{float:left;padding-right:0;width:178px}.favorites .fav_point .right{float:right;padding-right:0;padding-left:0}.favorites .link{color:#799920;text-decoration:none;border-bottom:1px dotted #799920}.redtext{color:#f75d50}.greentext{color:#95ba2f}.hold .orders_view{display:none!important}.orders_view{width:680px;margin-top:13px;padding-top:13px;padding-bottom:5px;border-top:1px solid #d2d2d2;display:block}.orders_view .order{float:left;width:225px;text-align:center}.orders_view .order .order_price{color:#f75d50;font-weight:700;font-size:15px}.orders_view .order .order_price span{font-size:24px}.orders_view .order img{padding-bottom:22px}.orders_view .order .note{font-size:13px}.orders_view .order .note span{color:#f75d50}.basket_hovered{position:absolute;border:1px solid #d2d2d2;border-radius:5px;padding:15px 20px;background-color:#fff;right:-1px;margin-top:10px;width:640px;display:none;z-index:1111}.open .basket_hovered{display:block}.open,.open .basket_hovered{-moz-box-shadow:0 0 5px rgba(149,149,149,0.75);-webkit-box-shadow:0 0 5px rgba(149,149,149,0.75);box-shadow:0 0 5px rgba(149,149,149,0.75)}.basket_hovered1:before{position:absolute;left:0;content:' ';width:100%;background-color:#fff;height:10px;top:45px;z-index:1112}.basket_item input{border:1px solid #d2d2d2;border-radius:4px;padding:9px;width:26px;font-size:18px;font-weight:700;text-align:center;background-color:#fff;color:#000;margin:7px}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.minus{background:url(../img/minus.png) no-repeat;width:15px;height:15px;display:inline-block;cursor:pointer}.plus{background:url(../img/plus.png) no-repeat;width:15px;height:15px;display:inline-block;cursor:pointer}.basket_sum{padding-top:15px}.basket_sum .sum_text{font-size:15px;text-transform:none;padding-top:12px;float:right!important;padding-top:1px;margin-bottom:11px}.basket_sum .sum_text span{font-size:18px;color:#f75d50;font-weight:700}.basket_sum a{color:#fff!important;font-size:15px!important;float:right}.black{z-index:9999;width:100%;height:100%;position:absolute;display:block;padding-top:6%}.black:before{content:'';background-color:rgba(0,0,0,0.5);width:100%;height:100%;position:fixed;top:0}.black.hidden{display:none}.black .item_added_win{background-color:#fff;width:640px;margin:auto;position:relative}.black_close{position:absolute;top:30px;right:30px;background:url(../img/ico_close2.png) no-repeat;width:22px;height:22px;display:inline-block;cursor:pointer}.block_content{padding-left:20px;padding-right:20px}.item_added_win h2{text-transform:uppercase;text-align:center;padding:30px}.block_content .item{padding-top:20px;padding-bottom:20px;border-bottom:1px solid #d2d2d2}.uppercase{text-transform:uppercase}.w230{width:230px}.w260{width:260px}.w430{width:430px}.borderbottom{border-bottom:1px solid #d2d2d2}.left_block .begin{text-transform:uppercase;font-size:13px;font-weight:700;padding-bottom:15px}.color_variants .variant{text-align:center;border:1px solid #d2d2d2;float:left;margin-right:5px;margin-bottom:5px}.variant:hover{cursor:pointer}.color_variants{margin-top:14px;margin-bottom:-5px}.color_variants .variant.active{width:44px;height:44px;border:2px solid #95ba2f}.color_variants .variant.active a{width:44px;height:44px}.tobasket{margin-top:20px;margin-bottom:20px}.tobasket:hover{color:#fff}.variant{width:46px;height:46px}.variant.active{width:44px;height:44px}.layout{margin-top:15px}.left_block{float:left}.right_block{float:right}.center_block{float:left;margin-left:23px}.left_block .links{margin-top:25px}.left_block .links li{list-style:none;padding-left:25px;display:inline-block;cursor:pointer;height:20px}.left_block .links ul{margin:0;padding:0}.left_block .links a{font-size:13.5px;text-decoration:none;color:#8ba73e}.links .add_bookmarks{background:url(../img/ico_add_bookmark.png) no-repeat center left}.links .what_price{background:url(../img/ico_price.png) no-repeat center left}.links .add_compare{background:url(../img/ico_scales.png) no-repeat center left}.spoiler_one{padding-top:15px;padding-bottom:15px;border-bottom:1px solid #d2d2d2}.spoiler_one .spoiler_content{margin-top:15px;font-size:13px}.spoiler_one .spoiler_content.hidden{display:none}.title_spoiler:hover{cursor:pointer}.title_spoiler{background:url(../img/ico_open.png) no-repeat center left;padding-left:17px;font-size:13px;text-transform:uppercase;color:#333;font-weight:700;text-decoration:none}.title_spoiler.closed{background:url(../img/ico_close3.png) no-repeat center left}.features{list-style:none;padding:0;margin:0;font-size:13px}.features a{font-size:13px;text-decoration:none;border-bottom:1px dotted #8ba73e;color:#8ba73e}.features li{padding-top:5px;padding-bottom:4px}.note_prod{width:225px;height:23px;overflow:hidden;border-radius:5px;display:table;text-transform:uppercase;font-size:11px;font-weight:700}.note_prod .one{z-index:999}.note_prod .two{z-index:998}.note_prod .blue{float:left;background-color:#42b9f6;position:relative;padding:5px 5px 5px 10px}.note_prod .blue:after{content:'';width:0;height:0;border-top:13px solid transparent;border-left:5px solid #42b9f6;border-bottom:13px solid transparent;position:absolute;top:-1px;margin-left:5px}.note_prod .red{float:left;background-color:#f75d50;position:relative;color:#fff;padding:5px 5px 5px 10px}.note_prod .red:after{content:'';width:0;height:0;border-top:13px solid transparent;border-left:5px solid #f75d50;border-bottom:13px solid transparent;position:absolute;top:-1px;margin-left:5px}.note_prod .yellow{float:left;background-color:#fbc665;position:relative;padding:5px 5px 5px 10px}.note_prod .yellow:after{content:'';width:0;height:0;border-top:13px solid transparent;border-left:5px solid #fbc665;border-bottom:13px solid transparent;position:absolute;top:-1px;margin-left:5px}.products_block .product{float:left;width:190px;vertical-align:bottom}.product .image{height:225px;position:relative}.product .image img{position:absolute;bottom:0;left:15px}.price{font-size:18px;color:#f75d50;font-weight:700;text-align:center}.product{padding-bottom:30px;position:relative}.product p{font-size:15px;text-align:center;margin-top:15px}.left52{margin-left:52px}.product a{color:#fff}.mrg1{margin-top:25px;margin-bottom:15px}.products_martopbot{margin-top:60px;margin-bottom:100px}.cont_shop_but{display:table-cell;vertical-align:middle;padding:35px}.cont_shop{text-decoration:none;font-size:12px;border-bottom:1px dotted #799920;color:#799920}.icons{width:45px;height:50%;position:absolute;z-index:9;right:0;padding-top:25px;padding-right:15px}.icons a{width:44px;height:44px;float:left;border:1px solid #d2d2d2;margin-bottom:5px;background-color:#fff}a:hover{cursor:pointer}.basket_item .form-group{display:inline}.basket.open:after{content:'';position:absolute;top:43px;width:100%;height:10px;background-color:#fff;left:0;z-index:9990}.basket_hovered .basket_sum{float:left}a.active{font-weight:700;text-decoration:underline}.HOME_RIGHT{display:inline-block;vertical-align:top;margin-left:10px;position:absolute}#HOME_UNDER_SLIDER > div{display:inline-block;margin-right:3px;margin-top:3px}.sort_block{display:inline-block}.sort_block ul{display:inline-block;margin:0;padding:0}.sort_block ul li{display:inline-block;margin:0 .5em;list-style:none}.sort_block ul li a.asc:after,.sort_block ul li a.desc:after{display:block;width:5px;height:3px;position:absolute;top:50%;margin-top:-1px;right:-10px;content:'';background:url(../img/arrow_sort_asc_desc.png) no-repeat}.sort_block ul li a.asc:after{background-position:0 0}.sort_block ul li a.desc:after{background-position:0 -3px}.home_banner_up{margin-top:20px}.home_banner_up .HOME_RIGHT{display:block;float:right;position:static;margin-left:0}#HOME_SLIDER .jssorb03 div,#HOME_SLIDER .jssorb03 div:hover,#HOME_SLIDER .jssorb03 .av{width:6px;height:6px;border-radius:50%;line-height:6px;background:#fff;border:2px solid #fff;box-shadow:0 0 5px 0 rgba(54,54,54,0.75)}#HOME_SLIDER .jssorb03 div.av:hover,#HOME_SLIDER .jssorb03 div.av:active,#HOME_SLIDER .jssorb03 .av{cursor:default;background:#95BA2F}.special-products{padding-top:30px}.special-products .link_buy{margin-bottom:0}.special-products .item{margin-bottom:0!important;text-align:center}.why_me_{padding-top:30px;overflow:hidden;margin-bottom:60px}.why_me_ .why_list{width:1038px;margin-left:-58px}.seo_text p{margin:12px 0 0;font-size:13px!important;color:#333!important;font-family:Roboto!important}.seo_text p:first-child{margin-top:0}.product-special{position:absolute}.jcarousel-skin-tango .jcarousel-item{width:38px;height:38px;border:1px solid #d2d2d2;text-align:center;background:#fff}.jcarousel-skin-tango .jcarousel-item a{display:table-cell;width:38px;height:38px;vertical-align:middle}.mycarousel img{max-width:38px;max-height:38px;border:0;vertical-align:middle}.jcarousel-skin-tango .jcarousel-clip-vertical,.jcarousel-skin-tango .jcarousel-container-vertical{height:175px}.jcarousel-skin-tango .jcarousel-container-vertical{padding:0}.jcarousel-skin-tango .jcarousel-prev-vertical{top:-13px}.jcarousel-skin-tango .jcarousel-next-vertical{bottom:-13px}.jcarousel-skin-tango .jcarousel-prev-vertical,.jcarousel-skin-tango .jcarousel-next-vertical{left:0;width:42px;background-position:14px 0}.jcarousel-skin-tango .jcarousel-prev-vertical:hover,.jcarousel-skin-tango .jcarousel-next-vertical:hover{background-position:14px 0;left:0}ul.product-special{position:absolute;top:0;left:16px}ul.product-special li{width:100%;float:left}ul.product-special li div{color:#333;font-size:10px;text-transform:uppercase;font-weight:700;height:22px;line-height:24px;padding:0 9px;position:relative;border-top-left-radius:4px;border-bottom-left-radius:4px;margin-top:8px;float:left}ul.product-special li:first-child{margin-top:0}ul.product-special li.top div{background:#fbc665}ul.product-special li.top div:after{content:'';position:absolute;right:-19px;top:3px;border:11px solid transparent;border-top:5px solid #fbc665;transform:rotate(-90deg)}ul.product-special li.new div{background:#42b9f6}ul.product-special li.new div:after{content:'';position:absolute;right:-18px;top:2px;border:11px solid transparent;border-top:5px solid #42b9f6;transform:rotate(-90deg)}ul.product-special li.promo div{background:#f75d50}ul.product-special li.promo div:after{content:'';position:absolute;right:-18px;top:2px;border:11px solid transparent;border-top:5px solid #f75d50;transform:rotate(-90deg)}.cost-block{margin-top:1px}.products.pn a.link_buy{margin-bottom:0}.products.pn{padding-bottom:0}.products.pn>ul{width:100%;float:left;margin-bottom:-3px}._form_checkbox_reset,.sort_block ul li a,.sort_block{font-size:12px}.filter_accept_bloc{margin-top:13px;margin-bottom:0}._form_checkbox_reset{color:#6a6a6a;display:block;width:128px;height:28px;border:1px solid #d2d2d2;line-height:28px;text-align:center;border-radius:4px;text-decoration:none;margin:0 auto}._form_checkbox_reset:hover{border:1px solid #95ba2f;color:#6a6a6a}._form_checkbox_reset:active{border:1px solid #95ba2f;background:#95ba2f;color:#fff}.sort_block ul li a{color:#8fa951;position:relative}.sort_block ul li a:hover{color:#333}#HOME_SLIDER .jssora03l,#HOME_SLIDER .jssora03r{width:36px;height:340px;background:url(../img/new_arrows_.png) no-repeat}#HOME_SLIDER .jssora03l,#HOME_SLIDER .jssora03l:hover{background-position:0 50%;left:0;top:0}#HOME_SLIDER .jssora03r,#HOME_SLIDER .jssora03r:hover{background-position:-36px 50%;right:0;top:0}.loyout ._prd_spec-wr{margin-top:10px}.loyout .special-products:first-child{border-top:0;padding-top:0}.irs-slider{width:13px;height:13px;top:25px;border-radius:100%;box-shadow:none;border:1px solid #d2d2d2;background:#fff;background:-moz-linear-gradient(top,#fff 0%,#ebebeb 100%);background:-webkit-linear-gradient(top,#fff 0%,#ebebeb 100%);background:linear-gradient(to bottom,#fff 0%,#ebebeb 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#ebebeb',GradientType=0)}.irs-slider.state_hover,.irs-slider:hover{background:#fff}.irs-slider:after{display:none}.irs-slider:before{content:"";position:absolute;width:5px;height:5px;z-index:2;border:1px solid #d2d2d2;border-radius:100%;background:#799920;top:3px;left:3px}.irs-bar{height:3px;top:30px}.irs-line{height:9px;background:#ebebeb;border:1px solid #d2d2d2;top:27px}.irs-line:before{width:166px;height:5px;position:absolute;content:'';top:2px;left:2px;background:#d2d2d2;border-radius:5px}.irs-min,.irs-max{display:none}.irs{height:49px}.price_filter.first_price_li{margin-top:8px}.product_read_ .w{width:110px;overflow:hidden;margin:0;padding-top:0;display:table-cell;vertical-align:middle;height:32px;float:none}.product_read_ .w strike,.product_read_ .w .cost{width:100%;float:left}.product_read_price .link_buy{width:118px;position:absolute;top:50%;right:0;margin:-16px 0 0}.product_read_price{position:relative;min-height:32px;margin-top:10px}.special-products.products h3{margin-bottom:10px}.special-products.products li.item{margin-top:30px}.productLeftBar .cost_box{border-top:0;padding:10px 0 15px}.productLeftBar .product_mod{width:100%;float:left;border-bottom:1px solid #d2d2d2;padding-bottom:15px}.field-orders-delivery .control-label,.field-orders-payment .control-label,.field-orders-body .control-label,.textareagroup .control-label{width:100%;float:left}.basket_title_{text-align:center}.cont_shopping-wr{width:100%;float:left;margin-top:10px}.cont_shopping-wr .cont_shopping{float:right}.cont_shopping{display:block!important;border-top:0!important;border-left:0!important;border-right:0!important;border-bottom:1px dashed #799920!important;color:#799920!important;margin:0!important;padding:0!important;font-size:12px!important;float:left;border-radius:0!important}.info.product-thumb-video{width:100%;height:100%}.info.product-thumb-video iframe,.info.product-thumb-video embed{width:100%!important;height:auto!important}.input-blocks-wrapper,.input-blocks{width:100%;float:left}.form-order .input-blocks-wrapper{margin-top:6px}.input-blocks label{font-size:13px;color:#333}.basket_input_2 label{height:30px;line-height:30px;float:left;width:70px!important;padding-top:0!important}.custom-input-2{width:100%;height:30px;box-sizing:border-box;outline:none;line-height:30px;padding-left:8px;margin-top:5px;background:#fff;border-radius:4px}.custom-input-2,.custom-area-2,.textareagroup textarea{border:1px solid #d2d2d2;box-sizing:border-box;font-size:13px;color:#636363}.custom-area-2,.textareagroup textarea{min-height:128px;max-height:128px;resize:none;width:100%;max-width:100%;outline:none;padding-left:8px;padding-top:8px;margin-top:8px}.basket_input_2 .custom-input-2{width:270px;float:right;margin-top:0}.custom-input-2:focus,.custom-area-3:focus,.textareagroup textarea:focus{box-shadow:1px 2px 2px 0 rgba(215,215,215,0.75) inset;transition:.1s}.textareagroup textarea:focus{border:1px solid #d2d2d2}.title_groups,.radio_grp label.control-label,.textareagroup .control-label{font-size:12px;font-weight:700;text-transform:uppercase;margin-bottom:12px}.input-blocks-group{width:100%;float:left;border-bottom:1px solid #d2d2d2;padding-bottom:20px;margin-top:18px}.custom-form-buttons{width:100%;float:left}input.custom-radio + label,input.custom-check + label{font-size:13px;cursor:pointer;margin-left:6px}input.custom-radio,input.custom-check{display:none}input.custom-radio + label span{width:16px;height:16px;background:url(../img/radio_new.png) no-repeat;float:left;transition:.2s;margin-top:1px}input.custom-radio:checked + label span,input.custom-radio:checked + label:hover span{background:url(../img/radio_new-active.png) no-repeat}input.custom-radio + label:hover{text-decoration:underline}.custom-form-buttons{margin-top:7px}.custom-form-buttons:first-child{margin-top:0}.delivery-data .field-order-delivery-childs .control-label{display:none}.checkout_basket{width:100%;float:left}.checkout_basket button{margin:0 auto}.input-blocks-wrapper .help-block{padding-left:71px;padding-top:4px;width:100%;float:left;box-sizing:border-box;margin-bottom:0}.cont_shop_but-wr{height:33px;margin-top:35px;padding-bottom:29px}.cont_shop_but-wr .cont_shop{margin-top:8px;float:left}.cont_shop_but-wr .submit4.bottom3{float:right}._qqq_ .params{font-size:12px}.activeShow{border-bottom:0!important}.delivery-data:after{width:100%;border-bottom:1px solid #d2d2d2;position:absolute;content:'';bottom:-27px;left:0}.img_ajax_basket img{margin-right:0!important;max-width:90px;max-height:90px;vertical-align:middle}.jcarousel-skin-tango>li{display:none}#login-form{margin:50px auto 0}#bg{top:0!important;z-index:1!important}.top,.wrap,.bottom,.fotter{position:relative;z-index:2}.owl-pagination{display:none}.owl-controls .owl-buttons div{width:34px!important;height:50px!important;background:#596065!important;top:50%!important;margin:-25px 0 0!important;opacity:1!important;border-radius:0!important;padding:0!important;position:absolute}.owl-controls .owl-buttons div:hover{background:#acafb2!important;transition:.2s!important}.owl-controls .owl-buttons .owl-prev{border-top-right-radius:4px!important;border-bottom-right-radius:4px!important;left:-20px}.owl-controls .owl-buttons .owl-next{border-top-left-radius:4px!important;border-bottom-left-radius:4px!important;right:-20px}.owl-controls .owl-buttons div:before{position:absolute;content:'';width:8px;height:22px;background:url(../img/arrows_blocks.png) no-repeat;top:50%;margin-top:-11px;left:50%;margin-left:-4px}.owl-controls .owl-buttons .owl-prev:before{background-position:0 0}.owl-controls .owl-buttons .owl-next:before{background-position:-8px 0}.basket_input_2.required .control-label{position:relative}.basket_input_2.required .control-label:before{position:absolute;top:0;content:'*';color:#D60000;left:-11px;padding-top:2px}.float-left{float:left}.blog-show-img{padding-right:20px}.text_seo.hidden_seo{height:178px;overflow:hidden;position:relative}.text_seo.hidden_seo div{height:162px;overflow:hidden;position:relative}.text_seo.hidden_seo a{position:absolute;bottom:0;right:0;font-size:16px}.text_seo.hidden_seo div:before{content:'';display:block;position:absolute;bottom:0;right:0;left:0;height:120px;background:-moz-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,rgba(255,255,255,0)),color-stop(100%,#fff));background:-webkit-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:-o-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:-ms-linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%);background:linear-gradient(top,rgba(255,255,255,0) 0%,#fff 100%)}.special-products{border-bottom:1px solid #d2d2d2}a.link_buy,.checkout_basket button,.submit4{font-size:15px}.cost,.product_read_price #cost{font-size:20px}.cost span,.cost span.valute,.product_read_price .valute{font-size:15px}.comment_display_block{height:35px}
3 3 \ No newline at end of file
... ...
frontend/web/css/style.dev.css
... ... @@ -500,7 +500,7 @@ input#subscribe-sale:-ms-input-placeholder {
500 500 .content ul.pagination li a:hover {text-decoration: underline}
501 501 .content ul.pagination li.active a{color: #333333;}
502 502 .boxitem{
503   - height:283px;
  503 + height:318px;
504 504 }
505 505 ul.social {margin-top: 20px;}
506 506 .social{list-style: none;margin: 10px;padding: 0px;height:48px;}
... ... @@ -1613,4 +1613,7 @@ input.custom-radio + label:hover {
1613 1613 background: -ms-linear-gradient(top, rgba(255, 255, 255, 0) 0%, #fff 100%);
1614 1614 background: linear-gradient(top, rgba(255, 255, 255, 0) 0%, #fff 100%);
1615 1615 }
1616   -.special-products{border-bottom:1px solid #d2d2d2}a.link_buy,.checkout_basket button,.submit4{font-size:15px}.cost,.product_read_price #cost{font-size:20px}.cost span,.cost span.valute,.product_read_price .valute{font-size:15px}
1617 1616 \ No newline at end of file
  1617 +.special-products{border-bottom:1px solid #d2d2d2}a.link_buy,.checkout_basket button,.submit4{font-size:15px}.cost,.product_read_price #cost{font-size:20px}.cost span,.cost span.valute,.product_read_price .valute{font-size:15px}
  1618 +.comment_display_block {
  1619 + height: 35px;
  1620 +}
1618 1621 \ No newline at end of file
... ...