<?php echo Html::a('创建菜单', ['create', 'pid' => isset($_GET['pid']) ? $_GET['pid'] : 0], ['class' => 'btn btn-success']); ?> <?php if (Yii::$app->request->get('pid', 0) > 0) { echo Html::a('返回列表', ['index'], ['class' => 'btn btn-warning']); } ?> </p> </div> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'name' => 'menu_id'], 'menu_id', 'title', ['header' => Html::a('子菜单', 'javascript:void(0);'), 'content' => function ($model) { $Menu = new Menu(); $count = $Menu->itemMenu($model->menu_id); if ($count > 0) { return Html::a($count, ['index', 'pid' => $model->menu_id]); } return Html::a($count, 'javascript:void(0);'); }], 'url', 'sort', ['header' => Html::a('状态', 'javascript:void(0);'), 'content' => function ($model) { if ($model->status == 1) { return Html::img('@web/image/yes.gif', ['onclick' => "setStatus(this, {$model->menu_id})", 'data-status' => 0]); } return Html::img('@web/image/no.gif', ['onclick' => "setStatus(this, {$model->menu_id})", 'data-status' => 1]); }], ['class' => 'yii\\grid\\ActionColumn', 'header' => Html::a('操作', 'javascript:void(0);'), 'template' => '{update} {delete}']]]); ?> <?php Pjax::end(); ?> </div>