$this->title = Yii::t('frontend-site', 'Posts'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="articles-admin"> <h1> <?php echo Html::encode($this->title); ?> <span class="pull-right"><?php echo Html::a('<i class="fa fa-plus"></i> ' . Yii::t('frontend-site', 'New Post'), ['create'], ['class' => 'btn btn-success']); ?> </span> </h1> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => SerialColumn::className()], ['attribute' => 'user_id', 'value' => function ($data) { return $data->getAuthorName(); }], ['attribute' => 'title'], ['attribute' => 'status', 'filter' => $searchModel->statusList, 'filterInputOptions' => ['class' => 'form-control chosen-select', 'id' => null, 'prompt' => ' All '], 'value' => function ($data) { return $data->getStatusName($data->status); }, 'contentOptions' => function ($model, $key, $index, $column) { return ['class' => CssHelper::articleStatusCss($model->statusName)]; }], ['attribute' => 'category', 'filter' => $searchModel->categoryList, 'filterInputOptions' => ['class' => 'form-control chosen-select', 'id' => null, 'prompt' => ' All '], 'value' => function ($data) { return $data->getCategoryName($data->category); }, 'contentOptions' => function ($model, $key, $index, $column) { return ['class' => CssHelper::articleCategoryCss($model->categoryName)]; }], ['class' => ActionColumn::className(), 'buttons' => ['update' => function ($url, $model, $key) { return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['class' => 'btn btn-xs btn-default', 'title' => Yii::t('common', 'Edit'), 'data-pjax' => '0']); }]]]]); ?> </div>
echo GridView::widget(['dataProvider' => $dataProvider, 'id' => 'dblog-panel-detailed-grid', 'options' => ['class' => 'detail-grid-view table-responsive'], 'filterModel' => $searchModel, 'filterUrl' => $panel->getUrl(), 'columns' => [['class' => SerialColumn::className()], ['attribute' => 'timestamp', 'value' => function ($data) { if (isset($data['time'])) { $timeInSeconds = $data['time'] / 1000; $millisecondsDiff = (int) (($timeInSeconds - (int) $timeInSeconds) * 1000); return date('H:i:s.', $timeInSeconds) . sprintf('%03d', $millisecondsDiff); } else { return $data['timestamp']; } }, 'headerOptions' => ['class' => 'sort-numerical text-align-center'], 'footerOptions' => ['class' => 'sort-numerical text-align-center font-weight-bold th'], 'contentOptions' => ['class' => 'nowrap font-size-10px text-align-center']], ['attribute' => 'level', 'value' => function ($data) { switch ($data['level']) { case Logger::LEVEL_ERROR: $class = 'label label-danger'; break; case Logger::LEVEL_WARNING: $class = 'label label-warning'; break; case Logger::LEVEL_INFO: $class = 'label label-primary'; break; default: $class = 'label label-default'; break; } return Html::tag('span', Logger::getLevelName($data['level']), ['class' => $class]); }, 'format' => 'html', 'filter' => [Logger::LEVEL_TRACE => ' Trace ', Logger::LEVEL_INFO => ' Info ', Logger::LEVEL_WARNING => ' Warning ', Logger::LEVEL_ERROR => ' Error '], 'filterInputOptions' => ['class' => 'form-control chosen-select', 'id' => null, 'prompt' => ' All '], 'headerOptions' => ['class' => 'text-align-center'], 'footerOptions' => ['class' => 'text-align-center font-weight-bold th'], 'contentOptions' => ['class' => 'text-align-center']], ['attribute' => 'category', 'headerOptions' => ['class' => 'text-align-center'], 'footerOptions' => ['class' => 'text-align-center font-weight-bold th'], 'contentOptions' => ['class' => 'font-size-10px']], ['attribute' => 'message', 'value' => function ($data) { $description = Html::encode(is_string($data['message']) ? $data['message'] : VarDumper::export($data['message'])); $message = '<a href="javascript:;" class="spoiler-title" data-title="" data-content="' . $description . '">' . Stringy::substr(Stringy::collapseWhitespace($description), 0, 60, 'UTF-8') . '...' . '</a>'; $trace = ''; if (!empty($data['trace'])) { $trace .= Html::ul($data['trace'], ['class' => 'trace', 'item' => function ($trace) { return "<li>{$trace['file']} ({$trace['line']})</li>"; }]); } $message .= '<div class="spoiler-content"><strong>Message: </strong><br /><pre>' . $description . '</pre>' . (!empty($trace) ? '<br /><p><strong>Trace: </strong>' . $trace . '</p>' : '') . '</div>'; return $message; }, 'format' => 'html', 'options' => ['width' => '50%'], 'contentOptions' => ['class' => 'spoiler']]]]);
$this->title = Yii::t('backend', 'Users'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="backend-user-index"> <h1><?php echo Html::encode($this->title); ?> <span class="pull-right"> <?php echo Html::a(Yii::t('backend', 'Create User'), ['create'], ['class' => 'btn btn-success']); ?> </span> </h1> <?php echo GridView::widget(['dataProvider' => $searchModel->search(Yii::$app->request->queryParams), 'filterModel' => $searchModel, 'summary' => false, 'columns' => [['class' => SerialColumn::className()], ['attribute' => 'username'], ['attribute' => 'email'], ['attribute' => 'status', 'filter' => $searchModel->statusList, 'filterInputOptions' => DataColumn::$filterOptionsForChosenSelect, 'value' => function ($data) { return '<span class="' . CssHelper::statusCssLabel($data->statusName) . '">' . $data->statusName . '</span>'; }, 'format' => 'html', 'contentOptions' => ['class' => 'text-align-center']], ['attribute' => 'item_name', 'filter' => $searchModel->rolesList, 'filterInputOptions' => DataColumn::$filterOptionsForChosenSelect, 'value' => function ($data) { return $data->roleName; }, 'contentOptions' => function ($model, $key, $index, $column) { return ['class' => 'text-align-center ' . CssHelper::roleCss($model->roleName)]; }], ['class' => ActionColumn::className(), 'template' => '{view} {update} {delete}', 'buttons' => ['view' => function ($url, $model, $key) { return Html::a('', $url, ['title' => Yii::t('backend', 'View user'), 'class' => 'glyphicon glyphicon-eye-open']); }, 'update' => function ($url, $model, $key) { return Html::a('', $url, ['title' => Yii::t('backend', 'Manage user'), 'class' => 'glyphicon glyphicon-user']); }, 'delete' => function ($url, $model, $key) { return Html::a('', $url, ['title' => Yii::t('backend', 'Delete user'), 'class' => 'glyphicon glyphicon-trash text-danger margin-left-10px', 'data' => ['confirm' => Yii::t('backend', 'Are you sure you want to delete this user?'), 'method' => 'post']]); }]]]]); ?> </div>