Beispiel #1
0
use app\components\grid\SetColumn;
use app\components\grid\LinkColumn;
use kartik\date\DatePicker;
use app\modules\admin\modules\comment\models\Comment;
use app\modules\admin\modules\comment\Module;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\admin\modules\comment\models\CommentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('module', 'ADMIN_COMMENTS');
$this->params['breadcrumbs'][] = ['label' => Module::t('module', 'ADMIN'), 'url' => ['/admin/default/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="admin-comment-default-index">
    <?php 
$gridColumn = [['class' => 'yii\\grid\\SerialColumn'], ['class' => 'kartik\\grid\\ExpandRowColumn', 'width' => '50px', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    return Yii::$app->controller->renderPartial('_expand-row-details', ['model' => $model]);
}, 'headerOptions' => ['class' => 'kartik-sheet-style'], 'expandOneOnly' => true], ['attribute' => 'created_at', 'format' => ['date', 'php:d M Y г., H:i:s']], 'author', ['attribute' => 'material_id', 'contentOptions' => [], 'filter' => false, 'content' => function ($data) {
    $materialModel = new $data->namespace();
    return $materialModel->getModelMaterial($data->material_id)->title;
}], ['attribute' => 'type', 'contentOptions' => ['style' => 'width:100px;'], 'headerOptions' => ['style' => 'width:100px;'], 'filter' => true, 'content' => function ($data) {
    return $data->type;
}], ['class' => SetColumn::className(), 'attribute' => 'moder', 'headerOptions' => ['style' => 'width:100px;'], 'filter' => Comment::getModerationsArray(), 'name' => function ($model) {
    return Comment::getModerTitle($model->moder);
}, 'cssCLasses' => [Comment::COMMENT_MODER_ALLOWED => 'success', Comment::COMMENT_MODER_DISALLOWED => 'danger', Comment::COMMENT_MODER_PENDING => 'warning']], ['class' => ActionColumn::className(), 'header' => Module::t('module', 'GRID_ACTIONS'), 'headerOptions' => ['style' => 'width:100px;']]];
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $gridColumn, 'responsive' => true, 'hover' => true, 'pjax' => false, 'resizableColumns' => true, 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{toggleData}'], 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-comment"></i> ' . Html::encode($this->title) . '</h3>', 'type' => 'primary']]);
?>

</div>
Beispiel #2
0
 /**
  * @return array
  */
 public static function getModerationsArray()
 {
     return [self::COMMENT_MODER_DISALLOWED => Module::t('module', 'MODER_DISALLOWED'), self::COMMENT_MODER_ALLOWED => Module::t('module', 'MODER_ALLOWED'), self::COMMENT_MODER_PENDING => Module::t('module', 'MODER_PENDING')];
 }
Beispiel #3
0
 /**
  * @param $id
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionDisallowed($id)
 {
     $model = $this->findModel($id);
     $model->moder = Comment::COMMENT_MODER_DISALLOWED;
     $success = Module::t('module', 'COMMENT_DISALLOWED_SUCCESS_{id}', ['id' => $id]);
     $error = Module::t('module', 'COMMENT_DISALLOWED_ERROR');
     if (Yii::$app->request->isAjax && $model->save()) {
         /*return $this->render('_expand-row-details', [
               'model' => $model,
               'success' => $success,
           ]);*/
         $searchModel = new CommentSearch();
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
         return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     }
     //Yii::$app->end();
     return $this->render('index', ['dataProvider' => $model]);
 }
Beispiel #4
0
<?php

use yii\helpers\Html;
use yii\widgets\Pjax;
use yii\widgets\DetailView;
use app\modules\admin\modules\comment\Module;
$materialModel = new $model->namespace();
?>
<div class="row">
    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-body">
                <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'parent_id', ['attribute' => 'material_id', 'label' => Module::t('module', 'LABEL_MATERIAL'), 'format' => 'raw', 'value' => Html::a($materialModel->getModelMaterial($model->material_id)->title, ['/admin/blog/post/view', 'id' => $model->material_id], ['target' => '_blank', 'data-pjax' => 0])], 'author', 'email:email', 'site']]);
?>
            </div>
        </div>
    </div>
    <div class="col-md-6">
        <?php 
Pjax::begin(['enablePushState' => false]);
?>
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Комментарий</strong>
            </div>
            <div class="panel-body">
                <p><?php 
echo $model->text;
?>
</p>