示例#1
0
 */
$this->title = Yii::t('gromver.platform', 'Select Menu Item');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="menu-index">

	<?php 
/*<h1><?= Html::encode($this->title) ?></h1>*/
?>

	<?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

	<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'grid', 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => [['attribute' => 'id', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px'], ['attribute' => 'menu_type_id', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '120px', 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return $model->menuType->title;
}, 'filter' => \yii\helpers\ArrayHelper::map(\gromver\platform\core\modules\menu\models\MenuType::find()->all(), 'id', 'title')], ['attribute' => 'title', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return str_repeat(" • ", max($model->level - 2, 0)) . $model->title . '<br/>' . Html::tag('small', $model->path, ['class' => 'text-muted']);
}, 'format' => 'html'], ['attribute' => 'status', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return $model->getStatusLabel();
}, 'width' => '150px', 'filter' => \gromver\platform\core\modules\menu\models\MenuItem::statusLabels()], ['header' => Yii::t('gromver.platform', 'Action'), 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return Html::a(Yii::t('gromver.platform', 'Select'), '#', ['class' => 'btn btn-primary btn-xs', 'onclick' => \gromver\widgets\ModalIFrame::postDataJs(['id' => $model->id, 'title' => $model->title, 'description' => Yii::t('gromver.platform', 'Menu Item: {title}', ['title' => $model->title]), 'route' => Yii::$app->urlManager->createUrl($model->getFrontendViewLink()), 'link' => Yii::$app->urlManager->createUrl($model->getFrontendViewLink()), 'value' => $model->id . ':' . $model->alias])]);
}, 'width' => '80px', 'mergeHeader' => true, 'format' => 'raw']], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'floatHeaderOptions' => ['scrollingTop' => 0], 'bordered' => false, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . '</h3>', 'type' => 'info', 'after' => Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . Yii::t('gromver.platform', 'Reset List'), [null], ['class' => 'btn btn-info']), 'showFooter' => false]]);
?>

</div>
示例#2
0
    'modelClass' => 'Menu',
]), ['create'], ['class' => 'btn btn-success']) ?>
    </p>*/
?>

    <?php 
echo GridView::widget(['id' => 'table-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => [['class' => '\\kartik\\grid\\CheckboxColumn'], ['attribute' => 'id', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px'], ['attribute' => 'menu_type_id', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '100px', 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return $model->menuType->title;
}, 'filter' => \yii\helpers\ArrayHelper::map(\gromver\platform\core\modules\menu\models\MenuType::find()->all(), 'id', 'title')], ['attribute' => 'title', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return str_repeat(" • ", max($model->level - 2, 0)) . $model->title . '<br/>' . Html::tag('small', $model->path);
}, 'format' => 'html'], ['attribute' => 'link', 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'status', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return Html::beginTag('div', ['class' => 'btn-group']) . Html::a('<i class="glyphicon glyphicon-star"></i>', \yii\helpers\Url::to(['status', 'id' => $model->id, 'status' => $model::STATUS_MAIN_PAGE]), ['class' => 'btn btn-xs' . ($model::STATUS_MAIN_PAGE == $model->status ? ' btn-success active' : ' btn-default'), 'data-pjax' => 0, 'data-method' => 'post']) . Html::a('<i class="glyphicon glyphicon-ok-circle"></i>', \yii\helpers\Url::to(['status', 'id' => $model->id, 'status' => $model::STATUS_PUBLISHED]), ['class' => 'btn btn-xs' . ($model::STATUS_PUBLISHED == $model->status ? ' btn-primary active' : ' btn-default'), 'data-pjax' => 0, 'data-method' => 'post']) . Html::a('<i class="glyphicon glyphicon-remove-circle"></i>', \yii\helpers\Url::to(['status', 'id' => $model->id, 'status' => $model::STATUS_UNPUBLISHED]), ['class' => 'btn btn-xs' . ($model::STATUS_UNPUBLISHED == $model->status ? ' btn-default active' : ' btn-default'), 'data-pjax' => 0, 'data-method' => 'post']) . Html::endTag('div');
}, 'filter' => \gromver\platform\core\modules\menu\models\MenuItem::statusLabels(), 'width' => '100px', 'format' => 'raw'], ['attribute' => 'ordering', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\core\modules\menu\models\MenuItem */
    return Html::input('text', 'order', $model->ordering, ['class' => 'form-control']);
}, 'format' => 'raw', 'width' => '50px'], ['class' => 'kartik\\grid\\ActionColumn', 'deleteOptions' => ['data-method' => 'delete']]], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'bordered' => false, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . ' </h3>', 'type' => 'info', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('gromver.platform', 'Add'), ['create', 'menuTypeId' => $searchModel->menu_type_id], ['class' => 'btn btn-success', 'data-pjax' => '0']), 'after' => Html::a('<i class="glyphicon glyphicon-sort-by-attributes"></i> ' . Yii::t('gromver.platform', 'Ordering'), ['ordering'], ['class' => 'btn btn-default', 'data-pjax' => '0', 'onclick' => 'processOrdering(this); return false']) . ' ' . Html::a('<i class="glyphicon glyphicon-trash"></i> ' . Yii::t('gromver.platform', 'Delete'), ['bulk-delete'], ['class' => 'btn btn-danger', 'data-pjax' => '0', 'onclick' => 'processAction(this); return false']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . Yii::t('gromver.platform', 'Reset List'), ['index'], ['class' => 'btn btn-info']), 'showFooter' => false]]);
?>

</div>

<script>
    function processOrdering(el) {
        var $el = $(el),
            $grid = $('#table-grid'),
            selection = $grid.yiiGridView('getSelectedRows'),
            data = {}
        if(!selection.length) {
            alert(<?php