= $this->render('/widgets/_ibox-title') ?>
= Bar::widget() ?>
=$this->render('_search', ['model' => $searchModel]); ?>
'pjax']); ?>
= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'class' => CheckboxColumn::className(),
],
[
'attribute' => 'id',
],
[
'attribute' => 'cid',
'label' => Yii::t('app', 'Category'),
'value' => function ($model) {
return $model->category ? $model->category->name : Yii::t('app', 'UnClassified');
},
'filter' => $categories,
],
[
'attribute' => 'title',
'width' => '170',
'format' => 'raw',
'value' => function($model, $key, $index, $column) use($frontendURLManager) {
/** @var common\models\Article $model */
$scriptName = "";
if( $frontendURLManager->showScriptName ){
$scriptName = "index.php/";
}
$url = $frontendURLManager->enablePrettyUrl ? Yii::$app->params['site']['url'] . $scriptName . 'view/' . $model->id . $frontendURLManager->suffix : Yii::$app->params['site']['url'] . 'index.php?r=article/view&id=' . $model->id . $frontendURLManager->suffix;
return Html::a($model->title, $url, ['target' => '_blank', 'data-pjax' => 0]);
}
],
[
'attribute' => 'sort',
'class' => SortColumn::className(),
],
[
'attribute' => 'author_name',
],
[
'attribute' => 'thumb',
'format' => 'raw',
'value' => function ($model, $key, $index, $column) {
if ($model->thumb == '') {
$num = Constants::YesNo_No;
} else {
$num = Constants::YesNo_Yes;
}
return Html::a(Constants::getYesNoItems($num), $model->thumb ? $model->thumb : 'javascript:void(0)', [
'img' => $model->thumb ? $model->thumb : '',
'class' => 'thumbImg',
'target' => '_blank',
'data-pjax' => 0
]);
},
'filter' => Constants::getYesNoItems(),
],
[
'class' => StatusColumn::className(),
'attribute' => 'flag_headline',
'filter' => Constants::getYesNoItems(),
],
[
'class' =>StatusColumn::className(),
'attribute' => 'flag_recommend',
'filter' => Constants::getYesNoItems(),
],
[
'class' =>StatusColumn::className(),
'attribute' => 'flag_slide_show',
'filter' => Constants::getYesNoItems(),
],
[
'class' =>StatusColumn::className(),
'attribute' => 'flag_special_recommend',
'filter' => Constants::getYesNoItems(),
],
[
'class' =>StatusColumn::className(),
'attribute' => 'flag_roll',
'filter' => Constants::getYesNoItems(),
],
[
'class' =>StatusColumn::className(),
'attribute' => 'flag_bold',
'filter' => Constants::getYesNoItems(),
],
[
'class' =>StatusColumn::className(),
'attribute' => 'flag_picture',
'filter' => Constants::getYesNoItems(),
],
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model, $key, $index, $column) {
/* @var $model common\models\Article */
return Html::a(Constants::getArticleStatus($model['status']), ['update', 'id' => $model['id']], [
'class' => 'btn btn-xs btn-rounded ' . ( $model['status'] == Constants::YesNo_Yes ? 'btn-info' : 'btn-default' ),
'data-confirm' => $model['status'] == Constants::YesNo_Yes ? Yii::t('app', 'Are you sure you want to cancel release?') : Yii::t('app', 'Are you sure you want to publish?'),
'data-method' => 'post',
'data-pjax' => '0',
'data-params' => [
$model->formName() . '[status]' => $model['status'] == Constants::YesNo_Yes ? Constants::YesNo_No : Constants::YesNo_Yes
]
]);
},
'filter' => Constants::getArticleStatus(),
],
[
'class' => DateColumn::className(),
'attribute' => 'created_at',
],
[
'class' => DateColumn::className(),
'attribute' => 'updated_at',
],
[
'class' => ActionColumn::className(),
'buttons' => [
'comment' => function ($url, $model, $key) {
return Html::a(' ', Url::to([
'comment/index',
'CommentSearch[aid]' => $model->id
]), [
'title' => Yii::t('app', 'Comments'),
'data-pjax' => '0',
'class' => 'btn-sm openContab',
]);
}
],
'template' => '{view-layer} {update} {delete} {comment}',
],
]
]); ?>