Blame view

common/modules/comment/widgets/views/_question_comment_view.php 2.67 KB
b5becf98   Yarik   test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  <?php
      use common\models\User;
      use common\modules\comment\widgets\CommentWidget;
      use yii\helpers\Html;
      use yii\web\View;
  
      /**
       * @var View                                   $this
       * @var \common\modules\comment\models\Comment $model  Current comment model
       * @var integer                                $key    ID of current comment
       * @var integer                                $index  index of current element according
       *      to current page, starting from 0
       * @var \yii\widgets\ListView                  $widget current ListView instance
       * @var User                                   $user
       */
      $user = $model->user;
d7f5a86c   Yarik   test
17
18
19
20
21
      if(empty( $model->comment_pid )) {
          $model->buildButtons([
              'reply',
              'delete',
          ]);
8eab7c9f   Yarik   test
22
      }
b5becf98   Yarik   test
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  ?>
      <div class="comments-name <?= CommentWidget::$baseClass[ 'comment_author' ] ?>">
          <?= $model->getAuthor(' (Гость)') ?>
      </div>
  <?php
      /* == STATUS PRO ==
      ?>
      <div class="comments-status"><span>Pro</span></div>
      <?php
      */
  ?>
      <div class="comments-date"><?= \Yii::$app->formatter->asDate($model->date_add, 'php:d.m.Y') ?></div>
      <div class="comments-content">
          <?= $model->text ?>
      </div>
8eab7c9f   Yarik   test
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  <?php
      if(!empty( $model->child )) {
          echo Html::tag('div', $this->render('@common/modules/comment/widgets/views/_question_comment_view', [
              'model'  => $model->child,
              'key'    => $key,
              'index'  => $index,
              'widget' => $widget,
          ]), [
              'class' => CommentWidget::$baseClass[ 'comment_container' ],
              'data'  => [
                  'key'  => $model->child->comment_id,
                  'form' => $model->formName(),
              ],
          ]);
      }
  ?>
b5becf98   Yarik   test
54
55
56
      <div>
          <?php
              if(!empty( $model->buttons[ 'delete' ] )) {
d7f5a86c   Yarik   test
57
                  echo Html::a(( $model->user_id != NULL && $model->user_id == \Yii::$app->user->id ) ? 'Удалить' : 'Пожаловаться   ', $model->buttons[ 'delete' ], [ 'class' => 'artbox_comment_delete_answer' ]);
b5becf98   Yarik   test
58
59
              }
              if(!empty( $model->buttons[ 'update' ] )) {
8eab7c9f   Yarik   test
60
                  echo Html::a('Редактировать', $model->buttons[ 'update' ], [ 'class' => 'artbox_comment_update_answer' ]);
b5becf98   Yarik   test
61
62
              }
              if(!empty( $model->buttons[ 'reply' ] )) {
d7f5a86c   Yarik   test
63
                  echo Html::a('Ответить', $model->buttons[ 'reply' ], [ 'class' => CommentWidget::$baseClass[ 'comment_reply' ].' artbox_comment_reply_answer' ]);
b5becf98   Yarik   test
64
65
66
67
              }
          ?>
      </div>
  <?php
b5becf98   Yarik   test
68
69
70
71
72
73
      /* == PROJECT INFO ==
      ?>
      <div class="comments-project-link">Проект: <a href="#">Ремонт спальни</a></div>
      <?php
      */
  ?>