project_comment_view.php
4.16 KB
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
<?php
use common\models\User;
use common\modules\comment\widgets\CommentWidget;
use kartik\rating\StarRating;
use yii\helpers\Html;
/**
* @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 = NULL;
if(!empty( $model->user_id )) {
$user = User::find()
->where([ 'id' => $model->user_id ])
->with('userInfo')
->one();
}
$model->buildButtons(['delete']);
?>
<div class="new-portf-comm-read artbox_comment_container" data-key="<?= $model->comment_id ?>" data-form="<?= $model->formName() ?>">
<div class="style">
<div class="header-cabinet-foto">
<?php
if(!empty( $user ) && !empty( $user->userInfo->image )) {
echo "<img src='{$user->userInfo->image}' alt=''>";
} else {
echo "<img src='/images/ico-profile.png' alt=''>";
}
?>
</div>
<div style="width: 500px; float: left; margin-left: 12px;">
<div class="comments-name style artbox_comment_author">
<?php
if(!empty( $user )) {
echo Html::a('<span class="artbox_comment_author">' . $user->firstname . ' ' . $user->lastname . '</span>', [
'performer/common',
'performer_id' => $user->id,
]);
} else {
echo '<span class="artbox_comment_author">' . $model->user_name . '</span>' . '(Гость)';
}
?>
</div>
<div class="new-portf-comm-read-rating">
<?php
if($rating = $model->hasRating()) {
echo StarRating::widget([
'name' => 'rating_project_comment',
'value' => $rating->value,
'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs']
]);
}
?>
</div>
<div class="blog-post-date style">
<span></span>
<p><?= date('d.m.Y', strtotime($model->date_add)) ?></p>
</div>
</div>
<div class="new-portf-answer artbox_comment_text">
<?= Html::encode($model->text) ?>
</div>
<div style="clear:both"></div>
<div>
<?php
if(!empty( $model->buttons[ 'delete' ] )) {
echo Html::a(($model->user_id != NULL && $model->user_id == \Yii::$app->user->id)?'Удалить':'Пожаловаться ', $model->buttons[ 'delete' ], [ 'class' => CommentWidget::$baseClass[ 'comment_delete' ] ]);
}
if(!empty( $model->buttons[ 'update' ] )) {
echo Html::a('Редактировать', $model->buttons[ 'update' ], [ 'class' => CommentWidget::$baseClass[ 'comment_update' ] ]);
}
if(!empty( $model->buttons[ 'reply' ] )) {
echo Html::a('Ответить', $model->buttons[ 'reply' ], [ 'class' => CommentWidget::$baseClass[ 'comment_reply' ] ]);
}
?>
</div>
<?php
/*
?>
<div class="action_panel">
<ul>
<li style="display:inline-block" class="artbox_comment_reply">Ответить</li>
<li style="display:inline-block" class="artbox_comment_update">Редактировать</li>
<li style="display:inline-block" class="artbox_comment_delete">Удалить</li>
</ul>
</div>
<?php
*/
?>
</div>
<div class="style"></div>
</div>