= Html::encode($this->title) ?>
= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ [ 'class' => 'yii\grid\ActionColumn', 'template' => '{approve} {update} {delete}', 'buttons' => [ 'approve' => function($url, $model, $key) { /** * @var Comment $model */ $options = array_merge([ 'title' => "Подтвердить", 'aria-label' => "Подтвердить", 'data-confirm' => "Комментарий и оценка отобразится на публичной части сайта, подтвердить?", 'data-method' => 'post', 'data-pjax' => '0', ]); $glyphicon = 'glyphicon-ok'; if($model->status == $model::STATUS_ACTIVE) { $url = Url::to(['comment/disapprove', 'id' => $model->comment_id]); $glyphicon = 'glyphicon-remove'; } return Html::a('', $url, $options); } ] ], 'comment_id', [ 'attribute' => 'rating.value', 'label' => 'Оценка', ], 'text:ntext', [ 'content' => function($model) { /** * @var Comment $model */ if(!empty( $model->user )) { return $model->user->username . " (ID: " . $model->user->id . ")"; } else { return $model->user_name . " (Гость: " . $model->user_email . ")"; } }, 'label' => 'Пользователь', ], [ 'attribute' => 'status', 'value' => function($model) { /** * @var Comment $model */ $status = ''; switch($model->status) { case Comment::STATUS_ACTIVE: $status = 'Активный'; break; case Comment::STATUS_HIDDEN: $status = 'Новый'; break; case Comment::STATUS_DELETED: $status = 'Удаленный'; break; default: $status = 'Неизвестно'; }; return $status; }, ], 'date_add', [ 'attribute' => 'model', 'value' => function($model) { /** * @var Comment $model */ return $model->model . " (ID: " . $model->model_id . ")"; }, ], ], ]); ?>