diff --git a/.gitignore b/.gitignore index cc82398..8f6344e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/tests # yii console command /yii diff --git a/common/config/main.php b/common/config/main.php index 3a6bf4e..721a1c5 100755 --- a/common/config/main.php +++ b/common/config/main.php @@ -36,6 +36,9 @@ return [ ] ], ], + 'authManager' => [ + 'class' => 'yii\rbac\DbManager', + ], 'cache' => [ 'class' => 'yii\caching\FileCache', ], diff --git a/common/modules/comment/Controller.php b/common/modules/comment/Controller.php index d0ce56f..d2db544 100755 --- a/common/modules/comment/Controller.php +++ b/common/modules/comment/Controller.php @@ -93,4 +93,5 @@ \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; \Yii::$app->response->send(); } + } \ No newline at end of file diff --git a/common/modules/comment/assets/CommentAsset.php b/common/modules/comment/assets/CommentAsset.php index edf61a8..3db5e5c 100755 --- a/common/modules/comment/assets/CommentAsset.php +++ b/common/modules/comment/assets/CommentAsset.php @@ -3,6 +3,7 @@ class CommentAsset extends \yii\web\AssetBundle { + public $sourcePath = '@common/modules/comment/resources'; public $css = [ @@ -18,4 +19,8 @@ '\yii\web\JqueryAsset', ]; + public $jsOptions = [ + 'position' => \yii\web\View::POS_READY, + ]; + } \ No newline at end of file diff --git a/common/modules/comment/models/Comment.php b/common/modules/comment/models/Comment.php index 8796389..ee0708a 100755 --- a/common/modules/comment/models/Comment.php +++ b/common/modules/comment/models/Comment.php @@ -1,6 +1,7 @@ model == User::className()) { + if($user = User::findOne($this->model_id)) { + /** + * @var User $user + */ + $user->updateRating(); + } + } + parent::afterSave($insert, $changedAttributes); + } + + /** + * @inheritdoc + */ public static function tableName() { return '{{%comment}}'; @@ -157,7 +176,7 @@ 'comment.model' => $model, 'comment.model_id' => $model_id, 'comment.status' => 1, - ]); + ])->with('rating'); } public function postComment() @@ -294,7 +313,7 @@ 'model' => $this->className(), ]) ->one(); - if(!$rating instanceof \common\modules\comment\models\Rating) { + if(!$rating instanceof \common\modules\comment\models\Rating && !empty($this->primaryKey)) { $rating = new \common\modules\comment\models\Rating([ 'model' => $this->className(), 'model_id' => $this->comment_id, @@ -331,4 +350,9 @@ } } + public function getUser() + { + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); + } + } diff --git a/common/modules/comment/models/CommentProject.php b/common/modules/comment/models/CommentProject.php index 7cc3793..173e2d8 100755 --- a/common/modules/comment/models/CommentProject.php +++ b/common/modules/comment/models/CommentProject.php @@ -3,26 +3,32 @@ use common\models\Currency; use common\models\File; + use common\models\Project; + use common\models\User; use yii\db\ActiveQuery; + use yii\db\ActiveRecord; use yii\web\UploadedFile; /** * Class Comment - * @property bool $guestComment - * @property integer $comment_id - * @property string $text - * @property int $user_id - * @property int $status - * @property string $date_add - * @property string $date_update - * @property string $date_delete - * @property string $model - * @property int $model_id - * @property string $files - * @property float $budget_from - * @property float $budget_to - * @property int $term_from - * @property int $term_to + * @property bool $guestComment + * @property integer $comment_id + * @property string $text + * @property int $user_id + * @property int $status + * @property string $date_add + * @property string $date_update + * @property string $date_delete + * @property string $model + * @property int $model_id + * @property string $files + * @property float $budget_from + * @property float $budget_to + * @property int $term_from + * @property int $term_to + * @property int $state + * @property Currency $currency + * @property Project $project * @package common\modules\comment\models */ class CommentProject extends \yii\db\ActiveRecord @@ -35,13 +41,22 @@ const STATUS_PERSONAL = 3; const STATUS_ANONYMOUS = 4; + const STATE_NEW = 1; + const STATE_CANDIDATE = 2; + const STATE_PERFORMER = 3; + const STATE_DENY = 4; + const STATE_TRASH = 5; + const SCENARIO_USER = 'user'; const SCENARIO_GUEST = 'guest'; + const SCENARIO_STATE = 'state'; + const SCENARIO_OWNER = 'owner'; /** * @var bool */ public $guestComment = false; + public $file; public function rules() @@ -84,7 +99,7 @@ [ [ 'budget_currency' ], 'exist', - 'targetClass' => Currency::className(), + 'targetClass' => Currency::className(), 'targetAttribute' => 'currency_id', ], [ @@ -104,6 +119,32 @@ 'default', 'value' => 1, ], + [ + [ 'state' ], + 'integer', + 'max' => 4, + 'min' => 1, + 'on' => self::SCENARIO_STATE, + ], + [ + [ 'state' ], + 'required', + 'on' => self::SCENARIO_STATE, + ], + [ + [ 'state' ], + 'required', + 'on' => self::SCENARIO_OWNER, + ], + [ + [ 'state' ], + 'in', + 'range' => [ + 1, + 5, + ], + 'on' => self::SCENARIO_OWNER, + ], ]; } @@ -118,9 +159,15 @@ 'term_to', 'file', ], - self::SCENARIO_GUEST => [ + self::SCENARIO_GUEST => [ ], + self::SCENARIO_STATE => [ + 'state', + ], + self::SCENARIO_OWNER => [ + 'state', + ], ]; } @@ -150,11 +197,11 @@ public function attributeLabels() { return [ - 'text' => \Yii::t('app', 'Текст ответа'), + 'text' => \Yii::t('app', 'Текст ответа'), 'budget_from' => \Yii::t('app', 'от'), - 'budget_to' => \Yii::t('app', 'до'), - 'term_from' => \Yii::t('app', 'от'), - 'term_to' => \Yii::t('app', 'до'), + 'budget_to' => \Yii::t('app', 'до'), + 'term_from' => \Yii::t('app', 'от'), + 'term_to' => \Yii::t('app', 'до'), ]; } @@ -163,10 +210,10 @@ return $this->guestComment; } -// public function setGuestComment($value) -// { -// $this->guestComment = $value; -// } + // public function setGuestComment($value) + // { + // $this->guestComment = $value; + // } /** * @param string $model @@ -181,27 +228,28 @@ 'comment_project.model' => $model, 'comment_project.model_id' => $model_id, 'comment_project.status' => 1, - ]); + ]) + ->with('currency', 'user', 'user.userInfo', 'user.companyInfo', 'user.comments'); } public function postComment() { if($this->checkCreate()) { - if(!empty(\Yii::$app->request->post($this->formName())['anonymous'])) { + if(!empty( \Yii::$app->request->post($this->formName())[ 'anonymous' ] )) { $this->status = self::STATUS_ANONYMOUS; } $this->file = UploadedFile::getInstances($this, 'file'); - if(!empty($this->file)) { - $file_id = []; - if(is_array($this->file)){ - foreach($this->file as $file){ - if($file instanceof UploadedFile){ + if(!empty( $this->file )) { + $file_id = [ ]; + if(is_array($this->file)) { + foreach($this->file as $file) { + if($file instanceof UploadedFile) { $file_model = new File(); $file_id[] = $file_model->saveFile($file); } } } else { - if($this->file instanceof UploadedFile){ + if($this->file instanceof UploadedFile) { $file_model = new File(); $file_id[] = $file_model->saveFile($this->file); } @@ -325,4 +373,65 @@ // } } + /** + * @return ActiveQuery + */ + public function getCurrency() + { + return $this->hasOne(Currency::className(), [ 'currency_id' => 'budget_currency' ]); + } + + /** + * @return File[] + */ + public function getFilesList() + { + $files = json_decode($this->files); + if(!empty( $files )) { + return File::findAll($files); + } else { + return [ ]; + } + } + + /** + * @return ActiveRecord + * @throws \TypeError + */ + public function getOwner() + { + $model = new $this->model(); + if($model instanceof ActiveRecord) { + return $model->findOne($this->model_id); + } else { + throw new \TypeError('Model must extends Active Record Class'); + } + } + + public function getProject() + { + return $this->hasOne(Project::className(), [ 'project_id' => 'model_id' ]); + } + + /** + * @return User + */ + public function getUser() + { + return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); + } + + public function changeState() + { + if($this->isAttributeChanged('state')) { + if($this->save()) { + return true; + } else { + return false; + } + } else { + return true; + } + } + } diff --git a/common/modules/comment/models/CommentProjectSearch.php b/common/modules/comment/models/CommentProjectSearch.php new file mode 100644 index 0000000..aae75ab --- /dev/null +++ b/common/modules/comment/models/CommentProjectSearch.php @@ -0,0 +1,92 @@ + 5, + 'min' => 1, + ], + [ + [ + 'state', + ], + 'default', + 'value' => self::STATE_NEW, + ], + ]; + } + + public function scenarios() + { + return array_merge(parent::scenarios(), [ + self::SCENARIO_SEARCH => [ + 'state', + ], + ]); + } + + public function search($params) + { + $query = CommentProject::find() + ->with('project') + ->with('project.budgetCurrency') + ->with('project.comments') + ->where([ 'user_id' => \Yii::$app->user->getId() ]); + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + $this->load($params); + + if(!$this->validate()) { + $query->andWhere('0=1'); + return $dataProvider; + } + + $query->andWhere([ 'state' => $this->state ]); + + return $dataProvider; + } + + } diff --git a/common/modules/comment/rbac/ArtboxCommentCreateRule.php b/common/modules/comment/rbac/ArtboxCommentCreateRule.php index 6f481fc..9dbf0a3 100755 --- a/common/modules/comment/rbac/ArtboxCommentCreateRule.php +++ b/common/modules/comment/rbac/ArtboxCommentCreateRule.php @@ -11,7 +11,28 @@ public function execute($user, $item, $params) { + if($params[ 'model' ] == \common\models\Project::className()) { + return $this->checkProject($user, $item, $params); + } return true; } + public function checkProject($user, $item, $params) + { + $project = \common\models\Project::findOne($params['model_id']); + if($project->user_id == $user) { + return false; + } + $comment = \common\modules\comment\models\CommentProject::find() + ->where([ 'model' => $params[ 'model' ], + 'model_id' => $params[ 'model_id' ], + 'user_id' => $user, + ])->one(); + if(empty($comment)) { + return true; + } else { + return false; + } + } + } \ No newline at end of file diff --git a/common/modules/comment/rbac/ArtboxCommentUpdateOwnRule.php b/common/modules/comment/rbac/ArtboxCommentUpdateOwnRule.php index 27d8b11..7d921e3 100755 --- a/common/modules/comment/rbac/ArtboxCommentUpdateOwnRule.php +++ b/common/modules/comment/rbac/ArtboxCommentUpdateOwnRule.php @@ -11,7 +11,7 @@ public function execute($user, $item, $params) { - return true; + return false; } } \ No newline at end of file diff --git a/common/modules/comment/widgets/CommentWidget.php b/common/modules/comment/widgets/CommentWidget.php index 52c316f..9c9dd6e 100755 --- a/common/modules/comment/widgets/CommentWidget.php +++ b/common/modules/comment/widgets/CommentWidget.php @@ -167,7 +167,7 @@ $this->parts[ 'list' ] = Html::tag($tag, $this->renderItems($view), $this->list_options); } - if($this->display_comment_form) { + if($this->display_comment_form && $this->comment_class->checkCreate()) { $tag = ArrayHelper::remove($this->form_options, 'tag', 'div'); $view = ArrayHelper::remove($this->form_options, 'view'); $this->parts[ 'form' ] = Html::tag($tag, $this->renderForm($view), $this->form_options); @@ -197,12 +197,16 @@ if(empty( $view )) { throw new \yii\base\InvalidConfigException("form_options[view] must be set"); } - return $this->render($view, [ - 'model' => $this->comment_class, - 'rating' => $this->rating_class, - 'user' => \Yii::$app->user->identity, - 'dataProvider' => $this->dataProvider, - ]); + if($this->comment_class->guestComment || !empty(\Yii::$app->user->identity)) { + return $this->render($view, [ + 'model' => $this->comment_class, + 'rating' => $this->rating_class, + 'user' => \Yii::$app->user->identity, + 'dataProvider' => $this->dataProvider, + ]); + } else { + return ''; + } } public function renderWidget() @@ -221,8 +225,11 @@ { $data = \Yii::$app->request->post(); if($this->comment_class->load($data) && $this->comment_class->postComment()) { - if(is_object($this->rating_class) && $this->comment_class->rating->load($data) && $this->comment_class->rating->save()) { - $this->isSuccess = true; + if(is_object($this->rating_class)) { + $this->comment_class->checkRating(); + if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) { + $this->isSuccess = true; + } } } } diff --git a/common/modules/comment/widgets/views/_project_comment_view.php b/common/modules/comment/widgets/views/_project_comment_view.php index 8e3c04f..d35e120 100755 --- a/common/modules/comment/widgets/views/_project_comment_view.php +++ b/common/modules/comment/widgets/views/_project_comment_view.php @@ -10,13 +10,7 @@ * @var \yii\widgets\ListView $widget current ListView instance * @var User $user */ - $user = NULL; - if(!empty( $model->user_id )) { - $user = User::find() - ->where([ 'id' => $model->user_id ]) - ->with('userInfo') - ->one(); - } + $user = $model->user; ?>
@@ -28,22 +22,22 @@ @@ -54,60 +48,96 @@
userInfo->view_count ?>
  • -
    Статус: userInfo->busy)?'Свободен':'Занят') ?> +
    + Статус: userInfo->busy ) ? 'Свободен' : 'Занят' ) ?>
  • - На сайте: 1г. 8 мес. + На сайте: liveTime ?>
  • -
    Последний визит:
    2 дня назад +
    Последний визит:
    lastVisit ?>
  • - Посмотреть профиль + link, [ 'class' => 'tender-see-profile style' ]) ?>
    -
    2000 грн
    -
    3 ДНЯ
    +
    + budget_from . '-' . $model->budget_to . ' ' . $model->currency->label ?> +
    +
    + term_from . '-' . $model->term_to ?> ДНЯ
    -
    Петер Цумтор
    +
    name ?>
    - +
    - 30 отзывов + comments) . ' отзывов', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?>
    -

    1.1 Строительная площадка расположена по адресу: г. Киев.

    -

    1.2 Существующий объект представляет собой помещение общей площадью ориентировочно – 140 м2.

    -

    1.3. Цель проекта состоит в проведении внутренних общестроительных и отделочных работ.

    -

    1.4. При разработке методов строительства и выборе материалов, используемых в настоящем проекте, необходимо учитывать климатические условия, характерные для г. Киева.

    -

    1.5. Требования к проектированию и производству работ определяются следующими документами:

    -

    - Техническим заданием.

    -

    - Строительными нормами и правилами.

    -

    Все проектные решения и все разделы рабочего проекта должны быть согласованы с Заказчиком в объеме, необходимом для последующей сдачи инженерных систем и коммуникаций.

    + text ?>
    - Портфолио - Конаткты + getLink('portfolio'), [ 'class' => 'get-project-new' ]) ?> + link, [ 'class' => 'get-list-new' ]) ?>
    + user->getId() == $model->owner->user_id) { + ?> +
    + Отметить как: + $model->owner->project_id, + 'data-comment-id' => $model->comment_id, + 'class' => 'artbox_project_make_new', + ]); + echo Html::a('кандидат', [ '#' ], [ + 'data-project-id' => $model->owner->project_id, + 'data-comment-id' => $model->comment_id, + 'class' => 'artbox_project_make_candidate', + ]); + echo Html::a('исполнитель', [ '#' ], [ + 'data-project-id' => $model->owner->project_id, + 'data-comment-id' => $model->comment_id, + 'class' => 'artbox_project_make_performer', + ]); + echo Html::a('отказать', [ '#' ], [ + 'data-project-id' => $model->owner->project_id, + 'data-comment-id' => $model->comment_id, + 'class' => 'artbox_project_make_deny', + ]); + ?> +
    +
    diff --git a/common/modules/comment/widgets/views/_review_comment_view.php b/common/modules/comment/widgets/views/_review_comment_view.php new file mode 100644 index 0000000..7c186c6 --- /dev/null +++ b/common/modules/comment/widgets/views/_review_comment_view.php @@ -0,0 +1,43 @@ +user; +?> +
    name ?>
    + +
    Pro
    + +
    formatter->asDate($model->date_add, 'php:d.m.Y') ?>
    +rating )) { + ?> +
    + + +
    + +
    + text ?> +
    + + + \ No newline at end of file diff --git a/common/modules/comment/widgets/views/form-comment-review.php b/common/modules/comment/widgets/views/form-comment-review.php new file mode 100644 index 0000000..229286c --- /dev/null +++ b/common/modules/comment/widgets/views/form-comment-review.php @@ -0,0 +1,66 @@ + +
    +

    Мнения о пользователе: totalCount ?>

    +
    + field($rating, 'value') + ->label(false) + ->radioList([ + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + ]); + if($model->scenario == $model::SCENARIO_GUEST) { + echo $form->field($model, 'user_name', [ + 'options' => [ + 'class' => 'input-blocks-comm', + ], + 'inputOptions' => [ + 'class' => 'custom-input-4', + ], + ]) + ->textInput(); + echo $form->field($model, 'user_email', [ + 'options' => [ + 'class' => 'input-blocks-comm', + ], + 'inputOptions' => [ + 'class' => 'custom-input-4', + ], + ]) + ->textInput(); + } + + ?> +
    + field($model, 'text', [ + 'options' => [ + 'class' => 'input-blocks-comm area-comm', + ], + 'inputOptions' => [ + 'class' => 'custom-area-4', + ], + ]) + ->textarea(); + ?> +
    + +
    + end(); + ?> +
    \ No newline at end of file diff --git a/common/modules/comment/widgets/views/form-project-comment.php b/common/modules/comment/widgets/views/form-project-comment.php index 240d241..7cfe6cd 100755 --- a/common/modules/comment/widgets/views/form-project-comment.php +++ b/common/modules/comment/widgets/views/form-project-comment.php @@ -14,7 +14,7 @@
    -
    Добавить ответ
    +
    [ 'class' => 'resformsfile MultiFile-intercepted', 'enctype' => 'multipart/form-data' ] ]); @@ -22,7 +22,7 @@
    - userInfo->image) ?> + userInfo->image)?:'') ?>
    name ?> diff --git a/common/modules/comment/widgets/views/list-comment-review.php b/common/modules/comment/widgets/views/list-comment-review.php new file mode 100644 index 0000000..2e5eccb --- /dev/null +++ b/common/modules/comment/widgets/views/list-comment-review.php @@ -0,0 +1,16 @@ + $dataProvider, + 'itemView' => '_review_comment_view', + 'options' => [ + 'tag' => 'ul', + 'class' => 'proektant-comments style' + ], + 'itemOptions' => [ + 'tag' => 'li', + ], + 'layout' => "{items}\n{pager}", +]); \ No newline at end of file diff --git a/common/modules/comment/widgets/views/list-project-comment.php b/common/modules/comment/widgets/views/list-project-comment.php index f592675..ce045e5 100755 --- a/common/modules/comment/widgets/views/list-project-comment.php +++ b/common/modules/comment/widgets/views/list-project-comment.php @@ -5,7 +5,7 @@ ?>
    -
    Предложения проектантов
    +
    Предложения проектантов (getTotalCount()?>)
    [ + 'class' => Slug::className(), + 'in_attribute' => 'name', + 'out_attribute' => 'alias', + 'translit' => true + ], 'artboxsynonym' => [ 'class' => ArtboxSynonymBehavior::className(), 'keyNameValue' => 'brand_name_id', @@ -35,13 +41,7 @@ class Brand extends \yii\db\ActiveRecord 'valueFields' => [ // postKey => DBFieldName 'name' => 'value' ] - ], - 'slug' => [ - 'class' => Slug::className(), - 'in_attribute' => 'name', - 'out_attribute' => 'alias', - 'translit' => true - ], + ] ]; } diff --git a/common/modules/product/models/ProductVariant.php b/common/modules/product/models/ProductVariant.php index 03e2844..e63190a 100755 --- a/common/modules/product/models/ProductVariant.php +++ b/common/modules/product/models/ProductVariant.php @@ -34,7 +34,7 @@ class ProductVariant extends \yii\db\ActiveRecord public function rules() { return [ - [['product_id', 'sku', 'product_unit_id'], 'required'], + [['product_id', 'name', 'sku', 'product_unit_id'], 'required'], [['product_id', 'product_unit_id'], 'integer'], [['price', 'price_old', 'stock'], 'number'], [['name', 'sku'], 'string', 'max' => 255], diff --git a/common/modules/rubrication/models/TaxGroup.php b/common/modules/rubrication/models/TaxGroup.php index 72bf27b..6be9aac 100755 --- a/common/modules/rubrication/models/TaxGroup.php +++ b/common/modules/rubrication/models/TaxGroup.php @@ -15,7 +15,7 @@ use Yii; * @property string $module * @property boolean $hierarchical * @property string $settings - * @property boolean $is_filter + * @property boolean is_filter * * @property TaxGroupToGroup[] $taxGroupToGroups * @property TaxGroupToGroup[] $taxGroupToGroups0 @@ -62,7 +62,7 @@ class TaxGroup extends \yii\db\ActiveRecord return [ [['name', 'module'], 'required'], [['description', 'settings'], 'string'], - [['hierarchical', 'is_filter'], 'boolean'], + [['hierarchical'], 'boolean'], [['alias', 'module'], 'string', 'max' => 50], [['name'], 'string', 'max' => 255], [['group_to_category'], 'safe'] diff --git a/console/migrations/m160225_143331_comment_test.php b/console/migrations/m160225_143331_comment_test.php new file mode 100644 index 0000000..c186a1b --- /dev/null +++ b/console/migrations/m160225_143331_comment_test.php @@ -0,0 +1,42 @@ +createTable('{{%comment}}', [ + 'comment_id' => $this->primaryKey(), + 'entity' => $this->string()->notNull(), + 'text' => $this->text()->notNull(), + 'user_id' => $this->integer(), + 'user_name' => $this->string(), + 'user_email' => $this->string(), + 'comment_pid' => $this->integer(), + 'status' => $this->integer(), + 'date_add' => $this->timestamp()->notNull()->defaultExpression('NOW()'), + 'date_update' => $this->timestamp()->notNull()->defaultExpression('NOW()'), + 'date_delete' => $this->timestamp(), + ]); + + $this->addForeignKey('comment_user', '{{%comment}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE'); + } + + public function down() + { + $this->dropForeignKey('comment_user', '{{%comment}}'); + $this->dropTable('{{%comment}}'); + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/console/migrations/m160304_081817_rating_table.php b/console/migrations/m160304_081817_rating_table.php new file mode 100644 index 0000000..6e1e9ba --- /dev/null +++ b/console/migrations/m160304_081817_rating_table.php @@ -0,0 +1,27 @@ +createTable('{{%rating}}', [ + 'rating_id' => $this->primaryKey(), + 'date_add' => $this->timestamp()->notNull()->defaultExpression('NOW()'), + 'date_update' => $this->timestamp()->notNull()->defaultExpression('NOW()'), + 'user_id' => $this->integer(), + 'entity' => $this->string(), + 'value' => $this->integer(), + ]); + + $this->addForeignKey('rating_user', '{{%rating}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE'); + } + + public function down() + { + $this->dropForeignKey('rating_user', '{{%rating}}'); + $this->dropTable('{{%rating}}'); + } + +} diff --git a/console/migrations/m160311_132124_rating_comment_restyle.php b/console/migrations/m160311_132124_rating_comment_restyle.php new file mode 100644 index 0000000..7cd0df5 --- /dev/null +++ b/console/migrations/m160311_132124_rating_comment_restyle.php @@ -0,0 +1,31 @@ +truncateTable('{{%comment}}'); + $this->truncateTable('{{%rating}}'); + $this->dropColumn('{{%comment}}', 'entity'); + $this->dropColumn('{{%rating}}', 'entity'); + $this->addColumn('{{%comment}}', 'model', $this->string()->notNull()); + $this->addColumn('{{%comment}}', 'model_id', $this->integer()->notNull()); + $this->addColumn('{{%rating}}', 'model', $this->string()->notNull()); + $this->addColumn('{{%rating}}', 'model_id', $this->integer()->notNull()); + } + + public function down() + { + $this->truncateTable('{{%comment}}'); + $this->truncateTable('{{%rating}}'); + $this->dropColumn('{{%comment}}', 'model'); + $this->dropColumn('{{%rating}}', 'model'); + $this->dropColumn('{{%comment}}', 'model_id'); + $this->dropColumn('{{%rating}}', 'model_id'); + $this->addColumn('{{%comment}}', 'entity', $this->string()->notNull()); + $this->addColumn('{{%rating}}', 'entity', $this->string()->notNull()); + } + +} diff --git a/frontend/views/event/view.php b/frontend/views/event/view.php index 00598d6..fdc644a 100644 --- a/frontend/views/event/view.php +++ b/frontend/views/event/view.php @@ -20,6 +20,31 @@ $this->params['name'] = $this->title;
    body?>
    + $this, + 'model' => $model->className(), + 'model_id' => $model->event_id, + 'comment_class' => \common\modules\comment\models\Comment::className(), + 'rating_class' => \common\modules\comment\models\Rating::className(), + 'class_options' => [ + 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, + 'user_id' => \Yii::$app->user->getId(), + 'guestComment' => true, + 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE, + ], + 'list_options' => [ + 'view' => 'list-comment-review', + ], + 'form_options' => [ + 'view' => 'form-comment-review', + 'tag' => 'span', + ], + 'options' => [ + 'class' => 'proektant-comments-wr style', + ], + ]); + ?>
    'seo_text'])?> diff --git a/frontend/web/css/concat_all.css b/frontend/web/css/concat_all.css index f144155..132890b 100755 --- a/frontend/web/css/concat_all.css +++ b/frontend/web/css/concat_all.css @@ -233,7 +233,6 @@ font-size: 30px; font-weight: bold; padding-bottom: 20px; - line-height: 1em; } .cat_p_catalog_list .sort_price { -- libgit2 0.21.4