form-comment-review.php 3.28 KB
<?php
    /**
     * @var View                                       $this
     * @var \common\modules\comment\models\Comment     $model
     * @var \common\models\User                        $user
     * @var \yii\data\ActiveDataProvider               $dataProvider
     * @var null|\common\modules\comment\models\Rating $rating
     */
    use common\modules\comment\widgets\CommentWidget;
    use kartik\rating\StarRating;
    use yii\bootstrap\BootstrapAsset;
    use yii\bootstrap\BootstrapPluginAsset;
    use yii\web\View;
    use yii\widgets\ActiveForm;
    use yii\helpers\Html;
    $this->registerLinkTag(['rel' => 'stylesheet', 'href' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css']);
?>
<?php
    if(!empty( $dataProvider )) {
        ?>
        <div class="workplace-title style">
            <p>Мнения о пользователе: <?= $dataProvider->totalCount ?></p>
        </div>
        <?php
    }
?>
<div class="new-portf-add-comm style">
    <?php
        $form = ActiveForm::begin();
        if(!$model->isNewRecord) {
            echo $form->field($model, 'comment_id')
                      ->hiddenInput()
                      ->label(false)
                      ->error(false);
        }
        echo $form->field(( !empty( $model->rating ) ? $model->rating : $rating ), 'value')
                  ->label(false)
                  ->widget(StarRating::className(), ['pluginOptions' => ['size'=>'xxs', 'step' => 1, 'value' => 2, 'showCaption' => false]]);
        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();
        }
        if(!empty( $model->comment_pid )) {
            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' ] ]);
        } else {
            echo Html::tag('div', '', [ 'class' => CommentWidget::$baseClass[ 'reply_block' ].' test_class' ]);
        }
        echo $form->field($model, 'text', [
            'options'      => [
                'class' => 'input-blocks-comm area-comm',
            ],
            'inputOptions' => [
                'class' => 'custom-area-4',
            ],
        ])
                  ->textarea();
    ?>
    <div class="input-blocks-comm-button style">
        <?php
            if($model->isNewRecord) {
                echo Html::submitButton('Добавить комментарий');
            } else {
                echo Html::submitButton('Обновить комментарий', [ 'class' => CommentWidget::$baseClass[ 'comment_update_submit' ] ]);
            }
        ?>
    </div>
    <?php
        $form->end();
    ?>
</div>