Blame view

views/artbox_comment_item.php 6.62 KB
a2cde075   Yarik   first commit
1
  <?php
faff2c48   Yarik   Artbox comment cr...
2
      use artbox\webcomment\models\CommentModel;
a2cde075   Yarik   first commit
3
4
5
6
7
8
9
10
11
      use yii\helpers\Html;
      use yii\helpers\Url;
      use yii\widgets\ListView;
      
      /**
       * @var CommentModel $model
       * @var mixed        $key
       * @var int          $index
       * @var ListView     $widget
b5639b59   Anastasia   comment widget
12
       * @var string       $display_name
3dc17ed6   Anastasia   hidden comment in...
13
       * @var array        $more
a2cde075   Yarik   first commit
14
       */
3dc17ed6   Anastasia   hidden comment in...
15
  
a2cde075   Yarik   first commit
16
  ?>
3dc17ed6   Anastasia   hidden comment in...
17
  
a2cde075   Yarik   first commit
18
  <div class="comments-wr">
faff2c48   Yarik   Artbox comment cr...
19
20
    <div class="artbox_item_info">
      <div class="user-ico">
a2cde075   Yarik   first commit
21
          <?php
7807d05c   Timur Kastemirov   комментарии в бло...
22
23
24
  //            echo Html::img('/img/no-image.png');
            echo !empty($model->customer)?
                mb_substr($model->customer->username, 0,1) : mb_substr($model->username, 0,1);
a2cde075   Yarik   first commit
25
          ?>
a2cde075   Yarik   first commit
26
      </div>
faff2c48   Yarik   Artbox comment cr...
27
      <div class="user_data" itemprop="datePublished">
a2cde075   Yarik   first commit
28
          <?php
faff2c48   Yarik   Artbox comment cr...
29
30
31
32
33
              echo date('d.m.Y', $model->created_at);
          ?>
      </div>
      <div class="user_name" itemprop="author">
          <?php
b5639b59   Anastasia   comment widget
34
            $nameField = $display_name;
faff2c48   Yarik   Artbox comment cr...
35
              if (!empty($model->customer)) {
b5639b59   Anastasia   comment widget
36
                  echo $model->customer->$nameField;
faff2c48   Yarik   Artbox comment cr...
37
38
              } else {
                  echo $model->username . ' (' . Yii::t('artbox-comment', 'Guest') . ')';
a2cde075   Yarik   first commit
39
              }
a2cde075   Yarik   first commit
40
          ?>
a2cde075   Yarik   first commit
41
      </div>
faff2c48   Yarik   Artbox comment cr...
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
        <?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
7cf4c0ee   Anastasia   reply
62
            if (!\Yii::$app->user->isGuest && $reply && \Yii::$app->user->id != $model->customer_id) {
faff2c48   Yarik   Artbox comment cr...
63
64
65
66
67
68
69
                ?>
              <a href="" class="btn-comm-answer" data-action="reply"><?php echo \Yii::t(
                      'artbox-comment',
                      'Ответить'
                  ); ?></a>
                <?php
            }
179a0e00   Anastasia   bug fix artbox-co...
70
            if (!\Yii::$app->user->isGuest && \Yii::$app->user->id == $model->customer_id && $delete) {
faff2c48   Yarik   Artbox comment cr...
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
                ?>
              <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to(
                  [
                      'artbox-comment/default/delete',
                      'id' => $model->id,
                  ]
              ); ?>"><?php echo \Yii::t('artbox-comment', 'Удалить'); ?></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>
a2cde075   Yarik   first commit
96
97
98
  </div>
  <div class="artbox_children_container">
      <?php
faff2c48   Yarik   Artbox comment cr...
99
100
          if (!empty($model->children)) {
              foreach ($model->children as $index => $child) {
a2cde075   Yarik   first commit
101
                  ?>
faff2c48   Yarik   Artbox comment cr...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
                <div class="artbox_child_container comment-answer" data-key="<?php echo $child->id; ?>">
                  <div class="artbox_child_info">
                    <div class="user-ico">
                        <?php
                            echo Html::img('/img/no-image.png');
                        ?>
                    </div>
                    <div class="user_data">
                        <?php
                            echo date('d.m.Y', $child->created_at);
                        ?>
                    </div>
                    <div class="user_name">
                        <?php
39771e4d   Anastasia   reply
116
                            $nameField = $display_name;
faff2c48   Yarik   Artbox comment cr...
117
                            if (!empty($child->customer)) {
39771e4d   Anastasia   reply
118
                                echo $child->customer->$nameField;
faff2c48   Yarik   Artbox comment cr...
119
120
121
122
123
124
125
126
127
128
129
130
131
                            } 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">
                      <?php
26ca15df   Anastasia   bug fix
132
                          if (!\Yii::$app->user->isGuest && $reply && \Yii::$app->user->id != $child->customer_id) {
a2cde075   Yarik   first commit
133
                              ?>
faff2c48   Yarik   Artbox comment cr...
134
135
136
137
                            <a href="" class="btn-comm-answer" data-action="reply"><?php echo \Yii::t(
                                    'artbox-comment',
                                    'Ответить'
                                ); ?></a>
a2cde075   Yarik   first commit
138
                              <?php
faff2c48   Yarik   Artbox comment cr...
139
                          }
179a0e00   Anastasia   bug fix artbox-co...
140
                          if (!\Yii::$app->user->isGuest && \Yii::$app->user->id == $child->customer_id && $delete) {
a2cde075   Yarik   first commit
141
                              ?>
faff2c48   Yarik   Artbox comment cr...
142
143
144
145
146
147
                            <a href="" class="btn-comm-delete" data-action="delete" data-url="<?php echo Url::to(
                                [
                                    'artbox-comment/default/delete',
                                    'id' => $child->id,
                                ]
                            ); ?>"><?php echo \Yii::t('artbox-comment', 'Удалить'); ?></a>
a2cde075   Yarik   first commit
148
                              <?php
faff2c48   Yarik   Artbox comment cr...
149
150
                          }
                          /* Like /dislike to be done
a2cde075   Yarik   first commit
151
                          ?>
faff2c48   Yarik   Artbox comment cr...
152
153
154
155
156
157
158
159
160
161
162
163
                          <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
                          */
                      ?>
                    <div class="artbox_child_reply"></div>
a2cde075   Yarik   first commit
164
                  </div>
faff2c48   Yarik   Artbox comment cr...
165
                </div>
a2cde075   Yarik   first commit
166
167
168
169
170
                  <?php
              }
          }
      ?>
  </div>
3dc17ed6   Anastasia   hidden comment in...