= $this->render('/widgets/_ibox-title') ?>
= Bar::widget() ?>
= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'class' => CheckboxColumn::className(),
],
[
'attribute' => 'id',
],
[
'class' => SortColumn::className()
],
[
'attribute' => 'title',
],
[
'attribute' => 'sub_title',
'label' => Yii::t("app", "Page Sign"),
'format' => 'raw',
'value' => function($model)use($frontendURLManager){
/** @var common\models\Article $model */
$scriptName = "";
if( $frontendURLManager->showScriptName ){
$scriptName = "index.php/";
}
$url = $frontendURLManager->enablePrettyUrl ? Yii::$app->params['site']['url'] . $scriptName . 'page/' . $model->sub_title . $frontendURLManager->suffix : Yii::$app->params['site']['url'] . 'index.php?r=page/' . $model->sub_title . $frontendURLManager->suffix;
return Html::a($model->sub_title, $url, ["target" => "_blank"]);
},
],
[
'attribute' => 'author_name',
],
[
'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',
]);
}
],
'width' => '135',
'template' => '{view-layer} {update} {delete} {comment}',
],
]
]); ?>