Blame view

common/modules/comment/views/artbox_comment_item.php 5.95 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
21
22
23
24
25
26
  <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">
              <?php
                  echo date('d.m.Y', $model->date_add);
              ?>
          </div>
          <div class="user_name">
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
38
39
40
41
42
              if(!empty( $model->rating )) {
                  ?>
                  <div class="user_rating">
                      <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
43
          ?>
17ca60dd   Yarik   Added comments to...
44
45
46
47
48
          <div class="user_txt">
              <?php
                  echo $model->text;
              ?>
          </div>
c05bf005   Yarik   Comment added
49
      </div>
17ca60dd   Yarik   Added comments to...
50
      <div class="artbox_item_tools comment-panel">
c05bf005   Yarik   Comment added
51
52
53
          <?php
              if(!\Yii::$app->user->isGuest) {
                  ?>
17ca60dd   Yarik   Added comments to...
54
                  <a href="" class="btn-comm-answer" data-action="reply">Ответить</a>
c05bf005   Yarik   Comment added
55
56
57
58
                  <?php
              }
              if(!\Yii::$app->user->isGuest && \Yii::$app->user->id == $model->user_id) {
                  ?>
17ca60dd   Yarik   Added comments to...
59
60
61
62
                  <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
63
64
65
66
67
                  <?php
              }
              // Like / dislike to be done
              /*
              ?>
17ca60dd   Yarik   Added comments to...
68
              <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
69
70
                      'artbox-comment/default/like',
                      'id' => $model->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
71
72
                  ]); ?>">Like</a>
              <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
73
74
                      'artbox-comment/default/dislike',
                      'id' => $model->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
75
                  ]); ?>">Dislike</a>
c05bf005   Yarik   Comment added
76
77
78
              <?php
              */
          ?>
17ca60dd   Yarik   Added comments to...
79
80
          <div class="artbox_item_reply"></div>
      </div>
c05bf005   Yarik   Comment added
81
82
83
84
85
86
  </div>
  <div class="artbox_children_container">
      <?php
          if(!empty( $model->children )) {
              foreach($model->children as $index => $child) {
                  ?>
17ca60dd   Yarik   Added comments to...
87
                  <div class="artbox_child_container comment-answer">
c05bf005   Yarik   Comment added
88
                      <div class="artbox_child_info">
17ca60dd   Yarik   Added comments to...
89
                          <div class="user-ico">
c05bf005   Yarik   Comment added
90
                              <?php
17ca60dd   Yarik   Added comments to...
91
                                  echo Html::img('/img/user-noimage.png');
c05bf005   Yarik   Comment added
92
                              ?>
c05bf005   Yarik   Comment added
93
                          </div>
17ca60dd   Yarik   Added comments to...
94
                          <div class="user_data">
c05bf005   Yarik   Comment added
95
96
97
                              <?php
                                  echo date('d.m.Y', $child->date_add);
                              ?>
c05bf005   Yarik   Comment added
98
                          </div>
17ca60dd   Yarik   Added comments to...
99
100
101
102
103
104
105
106
107
108
                          <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
109
110
111
                              <?php
                                  echo $child->text;
                              ?>
c05bf005   Yarik   Comment added
112
113
                          </div>
                      </div>
17ca60dd   Yarik   Added comments to...
114
                      <div class="artbox_child_tools comment-panel">
c05bf005   Yarik   Comment added
115
116
117
                              <?php
                                  if(!\Yii::$app->user->isGuest) {
                                      ?>
17ca60dd   Yarik   Added comments to...
118
                                      <a href="" class="btn-comm-answer" data-action="reply">Ответить</a>
c05bf005   Yarik   Comment added
119
120
121
122
                                      <?php
                                  }
                                  if(!\Yii::$app->user->isGuest && \Yii::$app->user->id == $child->user_id) {
                                      ?>
17ca60dd   Yarik   Added comments to...
123
                                          <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
124
125
                                              'artbox-comment/default/delete',
                                              'id' => $child->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
126
                                          ]); ?>">Удалить</a>
c05bf005   Yarik   Comment added
127
128
129
130
                                      <?php
                                  }
                                  /* Like /dislike to be done
                                  ?>
17ca60dd   Yarik   Added comments to...
131
                                  <a href="" class="btn-comm-like" data-action="like" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
132
133
                                          'artbox-comment/default/like',
                                          'id' => $child->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
134
135
                                      ]); ?>">Like</a>
                                  <a href="" class="btn-comm-dislike" data-action="dislike" data-url="<?php echo Url::to([
c05bf005   Yarik   Comment added
136
137
                                          'artbox-comment/default/dislike',
                                          'id' => $child->artbox_comment_id,
17ca60dd   Yarik   Added comments to...
138
                                      ]); ?>">Dislike</a>
c05bf005   Yarik   Comment added
139
140
141
                                  <?php
                                  */
                              ?>
c05bf005   Yarik   Comment added
142
143
144
145
146
147
148
149
                          <div class="artbox_child_reply"></div>
                      </div>
                  </div>
                  <?php
              }
          }
      ?>
  </div>