Blame view

common/modules/comment/views/artbox_comment_item.php 6.35 KB
c05bf005   Yarik   Comment added
1
2
  <?php
      use common\modules\comment\models\CommentModel;
17ca60dd   Yarik   Added comments to...
3
      use yii\helpers\Html;
c05bf005   Yarik   Comment added
4
5
6
7
8
9
10
11
12
13
      use yii\helpers\Url;
      use yii\widgets\ListView;
      
      /**
       * @var CommentModel $model
       * @var mixed        $key
       * @var int          $index
       * @var ListView     $widget
       */
  ?>
17ca60dd   Yarik   Added comments to...
14
15
16
17
18
19
20
  <div class="comments-wr">
      <div class="artbox_item_info">
          <div class="user-ico">
              <?php
                  echo Html::img('/img/user-noimage.png');
              ?>
          </div>
14009e7f   Yarik   Structure data fix
21
          <div class="user_data" itemprop="datePublished">
17ca60dd   Yarik   Added comments to...
22
23
24
25
              <?php
                  echo date('d.m.Y', $model->date_add);
              ?>
          </div>
14009e7f   Yarik   Structure data fix
26
          <div class="user_name" itemprop="author">
c05bf005   Yarik   Comment added
27
28
29
30
              <?php
                  if(!empty( $model->user )) {
                      echo $model->user->username;
                  } else {
17ca60dd   Yarik   Added comments to...
31
                      echo $model->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
c05bf005   Yarik   Comment added
32
33
                  }
              ?>
17ca60dd   Yarik   Added comments to...
34
          </div>
c05bf005   Yarik   Comment added
35
          <?php
17ca60dd   Yarik   Added comments to...
36
37
              if(!empty( $model->rating )) {
                  ?>
8fef08bc   Yarik   Structure data fi...
38
                  <div class="user_rating" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
14009e7f   Yarik   Structure data fix
39
40
41
                      <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>
17ca60dd   Yarik   Added comments to...
42
43
44
45
                      <div class="rateit" data-rateit-value="<?php echo $model->rating->value; ?>" data-rateit-ispreset="true" data-rateit-readonly="true"></div>
                  </div>
                  <?php
              }
c05bf005   Yarik   Comment added
46
          ?>
14009e7f   Yarik   Structure data fix
47
          <div class="user_txt" itemprop="description">
17ca60dd   Yarik   Added comments to...
48
49
50
51
              <?php
                  echo $model->text;
              ?>
          </div>
c05bf005   Yarik   Comment added
52
      </div>
17ca60dd   Yarik   Added comments to...
53
      <div class="artbox_item_tools comment-panel">
c05bf005   Yarik   Comment added
54
55
56
          <?php
              if(!\Yii::$app->user->isGuest) {
                  ?>
17ca60dd   Yarik   Added comments to...
57
                  <a href="" class="btn-comm-answer" data-action="reply">Ответить</a>
c05bf005   Yarik   Comment added
58
59
60
61
                  <?php
              }
              if(!\Yii::$app->user->isGuest && \Yii::$app->user->id == $model->user_id) {
                  ?>
17ca60dd   Yarik   Added comments to...
62
63
64
65
                  <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>
c05bf005   Yarik   Comment added
66
67
68
69
70
                  <?php
              }
              // Like / dislike to be done
              /*
              ?>
17ca60dd   Yarik   Added comments to...
71
              <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
72
73
                      'artbox-comment/default/like',
                      'id' => $model->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
74
75
                  ]); ?>">Like</a>
              <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
76
77
                      'artbox-comment/default/dislike',
                      'id' => $model->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
78
                  ]); ?>">Dislike</a>
c05bf005   Yarik   Comment added
79
80
81
              <?php
              */
          ?>
17ca60dd   Yarik   Added comments to...
82
83
          <div class="artbox_item_reply"></div>
      </div>
c05bf005   Yarik   Comment added
84
85
86
87
88
89
  </div>
  <div class="artbox_children_container">
      <?php
          if(!empty( $model->children )) {
              foreach($model->children as $index => $child) {
                  ?>
17ca60dd   Yarik   Added comments to...
90
                  <div class="artbox_child_container comment-answer">
c05bf005   Yarik   Comment added
91
                      <div class="artbox_child_info">
17ca60dd   Yarik   Added comments to...
92
                          <div class="user-ico">
c05bf005   Yarik   Comment added
93
                              <?php
17ca60dd   Yarik   Added comments to...
94
                                  echo Html::img('/img/user-noimage.png');
c05bf005   Yarik   Comment added
95
                              ?>
c05bf005   Yarik   Comment added
96
                          </div>
17ca60dd   Yarik   Added comments to...
97
                          <div class="user_data">
c05bf005   Yarik   Comment added
98
99
100
                              <?php
                                  echo date('d.m.Y', $child->date_add);
                              ?>
c05bf005   Yarik   Comment added
101
                          </div>
17ca60dd   Yarik   Added comments to...
102
103
104
105
106
107
108
109
110
111
                          <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">
c05bf005   Yarik   Comment added
112
113
114
                              <?php
                                  echo $child->text;
                              ?>
c05bf005   Yarik   Comment added
115
116
                          </div>
                      </div>
17ca60dd   Yarik   Added comments to...
117
                      <div class="artbox_child_tools comment-panel">
c05bf005   Yarik   Comment added
118
119
120
                              <?php
                                  if(!\Yii::$app->user->isGuest) {
                                      ?>
17ca60dd   Yarik   Added comments to...
121
                                      <a href="" class="btn-comm-answer" data-action="reply">Ответить</a>
c05bf005   Yarik   Comment added
122
123
124
125
                                      <?php
                                  }
                                  if(!\Yii::$app->user->isGuest && \Yii::$app->user->id == $child->user_id) {
                                      ?>
17ca60dd   Yarik   Added comments to...
126
                                          <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
127
128
                                              'artbox-comment/default/delete',
                                              'id' => $child->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
129
                                          ]); ?>">Удалить</a>
c05bf005   Yarik   Comment added
130
131
132
133
                                      <?php
                                  }
                                  /* Like /dislike to be done
                                  ?>
17ca60dd   Yarik   Added comments to...
134
                                  <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
135
136
                                          'artbox-comment/default/like',
                                          'id' => $child->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
137
138
                                      ]); ?>">Like</a>
                                  <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
139
140
                                          'artbox-comment/default/dislike',
                                          'id' => $child->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
141
                                      ]); ?>">Dislike</a>
c05bf005   Yarik   Comment added
142
143
144
                                  <?php
                                  */
                              ?>
c05bf005   Yarik   Comment added
145
146
147
148
149
150
151
152
                          <div class="artbox_child_reply"></div>
                      </div>
                  </div>
                  <?php
              }
          }
      ?>
  </div>