Blame view

common/modules/comment/views/artbox_comment_form.php 1.45 KB
c05bf005   Yarik   Comment added
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  <?php
      use common\modules\comment\models\CommentModel;
      use common\modules\comment\models\RatingModel;
      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
       */
      $form = ActiveForm::begin([
          'id'     => $formId,
          'action' => Url::to([
              'artbox-comment/default/create',
              'entity' => $comment_model->encryptedEntity,
          ]),
      ]);
      if(!empty( $rating_model )) {
          echo $form->field($rating_model, 'value', [ 'enableClientValidation' => false ])
                    ->hiddenInput()
                    ->label(false);
          echo Html::tag('div', '', [
              'class'                  => 'rateit',
              'data-rateit-backingfld' => '#' . Html::getInputId($rating_model, 'value'),
          ]);
      }
      if(\Yii::$app->user->isGuest) {
          echo $form->field($comment_model, 'username')
                    ->textInput();
          echo $form->field($comment_model, 'email')
                    ->textInput();
      }
      echo $form->field($comment_model, 'text')
                ->textarea();
      echo Html::submitButton(/*Yii::t('artbox-comment', 'Submit')*/
          'Submit');
      ActiveForm::end();