Blame view

views/artbox_comment_form.php 2.38 KB
a2cde075   Yarik   first commit
1
  <?php
faff2c48   Yarik   Artbox comment cr...
2
3
      use artbox\webcomment\models\CommentModel;
      use artbox\webcomment\models\RatingModel;
a2cde075   Yarik   first commit
4
5
6
7
8
9
10
11
12
13
14
15
16
      use yii\base\Model;
      use yii\helpers\Html;
      use yii\helpers\Url;
      use yii\web\View;
      use yii\widgets\ActiveForm;
      
      /**
       * @var CommentModel     $comment_model
       * @var array            $form_params
       * @var Model            $model
       * @var string           $formId
       * @var View             $this
       * @var RatingModel|NULL $rating_model
73983f4d   Anastasia   class for comment...
17
       * @var string           $buttonClass
a2cde075   Yarik   first commit
18
       */
faff2c48   Yarik   Artbox comment cr...
19
20
21
22
23
24
25
26
27
28
29
      $form = ActiveForm::begin(
          [
              'id'     => $formId,
              'action' => Url::to(
                  [
                      'artbox-comment/default/create',
                      'entity' => $comment_model->encryptedEntity,
                  ]
              ),
          ]
      );
a2cde075   Yarik   first commit
30
  ?>
faff2c48   Yarik   Artbox comment cr...
31
32
33
34
35
36
37
38
39
40
41
42
43
    <div class="form-comm-wr">
        <?php
            if (!empty($rating_model)) {
                ?>
              <div class="input_bl stars-wr_">
                  <?php
                      echo $form->field($rating_model, 'value', [ 'enableClientValidation' => false ])
                                ->hiddenInput()
                                ->label(false);
                      echo Html::tag(
                          'div',
                          '',
                          [
a2cde075   Yarik   first commit
44
45
                              'class'                  => 'rateit',
                              'data-rateit-backingfld' => '#' . Html::getInputId($rating_model, 'value'),
faff2c48   Yarik   Artbox comment cr...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
                          ]
                      );
                  ?>
              </div>
                <?php
            }
            if (\Yii::$app->user->isGuest) {
                echo $form->field($comment_model, 'username', [ 'options' => [ 'class' => 'form-group input_bl' ] ])
                          ->textInput();
                echo $form->field($comment_model, 'email', [ 'options' => [ 'class' => 'form-group input_bl' ] ])
                          ->textInput();
            }
            echo $form->field($comment_model, 'text', [ 'options' => [ 'class' => 'form-group input_bl area_bl' ] ])
                      ->textarea();
            echo Html::tag(
                'div',
7807d05c   Timur Kastemirov   комментарии в бло...
62
                Html::submitButton(
73983f4d   Anastasia   class for comment...
63
64
                  Yii::t('app', 'Submit comment'),
                    (!empty($buttonClass) ? ['class' => $buttonClass] : [])
7807d05c   Timur Kastemirov   комментарии в бло...
65
                ),
73983f4d   Anastasia   class for comment...
66
                [ 'class' => 'input_bl submit_btn'  ]
faff2c48   Yarik   Artbox comment cr...
67
68
69
            );
        ?>
    </div>
a2cde075   Yarik   first commit
70
71
72
  <?php
      ActiveForm::end();
  ?>