Blame view

common/modules/comment/views/artbox_comment_item.php 6.22 KB
d8c1a2e0   Yarik   Big commit artbox
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  <?php
      use common\modules\comment\models\CommentModel;
      use yii\helpers\Html;
      use yii\helpers\Url;
      use yii\widgets\ListView;
      
      /**
       * @var CommentModel $model
       * @var mixed        $key
       * @var int          $index
       * @var ListView     $widget
       */
  ?>
  <div class="comments-wr">
      <div class="artbox_item_info">
          <div class="user-ico">
              <?php
                  echo Html::img('/img/user-noimage.png');
              ?>
          </div>
          <div class="user_data" itemprop="datePublished">
              <?php
                  echo date('d.m.Y', $model->date_add);
              ?>
          </div>
          <div class="user_name" itemprop="author">
              <?php
                  if(!empty( $model->user )) {
                      echo $model->user->username;
                  } else {
                      echo $model->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
                  }
              ?>
          </div>
          <?php
              if(!empty( $model->rating )) {
                  ?>
                  <div class="user_rating" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
                      <span itemprop="worstRating" style="display: none">1</span>
                      <span itemprop="ratingValue" style="display: none"><?php echo $model->rating->value; ?></span>
                      <span itemprop="bestRating" style="display: none">5</span>
                      <div class="rateit" data-rateit-value="<?php echo $model->rating->value; ?>" data-rateit-ispreset="true" data-rateit-readonly="true"></div>
                  </div>
                  <?php
              }
          ?>
          <div class="user_txt" itemprop="description">
              <?php
                  echo $model->text;
              ?>
          </div>
      </div>
      <div class="artbox_item_tools comment-panel">
          <?php
              if(!\Yii::$app->user->isGuest) {
                  ?>
                  <a href="" class="btn-comm-answer" data-action="reply">Ответить</a>
                  <?php
              }
              if(!\Yii::$app->user->isGuest && \Yii::$app->user->id == $model->user_id) {
                  ?>
                  <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to([
                      'artbox-comment/default/delete',
                      'id' => $model->artbox_comment_id,
                  ]); ?>">Удалить</a>
                  <?php
              }
              // Like / dislike to be done
              /*
              ?>
              <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
                      'artbox-comment/default/like',
                      'id' => $model->artbox_comment_id,
                  ]); ?>">Like</a>
              <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
                      'artbox-comment/default/dislike',
                      'id' => $model->artbox_comment_id,
                  ]); ?>">Dislike</a>
              <?php
              */
          ?>
          <div class="artbox_item_reply"></div>
      </div>
  </div>
  <div class="artbox_children_container">
      <?php
          if(!empty( $model->children )) {
              foreach($model->children as $index => $child) {
                  ?>
                  <div class="artbox_child_container comment-answer">
                      <div class="artbox_child_info">
                          <div class="user-ico">
                              <?php
                                  echo Html::img('/img/user-noimage.png');
                              ?>
                          </div>
                          <div class="user_data">
                              <?php
                                  echo date('d.m.Y', $child->date_add);
                              ?>
                          </div>
                          <div class="user_name">
                              <?php
                                  if(!empty( $child->user )) {
                                      echo $child->user->username;
                                  } else {
                                      echo $child->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
                                  }
                              ?>
                          </div>
                          <div class="user_txt">
                              <?php
                                  echo $child->text;
                              ?>
                          </div>
                      </div>
                      <div class="artbox_child_tools comment-panel">
5c2eb7c8   Yarik   Big commit almost...
118
119
                          <?php
                              if(!\Yii::$app->user->isGuest) {
d8c1a2e0   Yarik   Big commit artbox
120
                                  ?>
5c2eb7c8   Yarik   Big commit almost...
121
                                  <a href="" class="btn-comm-answer" data-action="reply">Ответить</a>
d8c1a2e0   Yarik   Big commit artbox
122
                                  <?php
5c2eb7c8   Yarik   Big commit almost...
123
124
125
126
127
128
129
130
131
132
                              }
                              if(!\Yii::$app->user->isGuest && \Yii::$app->user->id == $child->user_id) {
                                  ?>
                                  <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to([
                                      'artbox-comment/default/delete',
                                      'id' => $child->artbox_comment_id,
                                  ]); ?>">Удалить</a>
                                  <?php
                              }
                              /* Like /dislike to be done
d8c1a2e0   Yarik   Big commit artbox
133
                              ?>
5c2eb7c8   Yarik   Big commit almost...
134
135
136
137
138
139
140
141
142
143
144
                              <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
                                      'artbox-comment/default/like',
                                      'id' => $child->artbox_comment_id,
                                  ]); ?>">Like</a>
                              <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
                                      'artbox-comment/default/dislike',
                                      'id' => $child->artbox_comment_id,
                                  ]); ?>">Dislike</a>
                              <?php
                              */
                          ?>
d8c1a2e0   Yarik   Big commit artbox
145
146
147
148
149
150
151
152
                          <div class="artbox_child_reply"></div>
                      </div>
                  </div>
                  <?php
              }
          }
      ?>
  </div>