$this->title = Yii::t('app', 'Nodes'); $this->params['breadcrumbs'][] = ['label' => $site->name, 'url' => ['index', 'site_id' => $site->id]]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="node-index"> <form class="form-inline"> <div class="form-group"> <?php echo Html::a(Yii::t('app', 'Create Node'), ['create', 'site_id' => $site->id], ['class' => 'btn btn-success', 'data-pjax' => 0]); ?> <?php echo Html::a(Yii::t('app', 'Sort Move Node'), ['sort', 'site_id' => $site->id], ['class' => 'btn btn-success', 'data-pjax' => 0]); ?> </div> </form> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'rowOptions' => function ($model) { return ['id' => 'row_' . $model->id]; }, 'columns' => ['id', ['attribute' => 'name', 'value' => function ($model) { return str_repeat('━', $model->depth) . $model->name; }], ['attribute' => 'is_real', 'value' => function ($model) { return Node::isReal()[$model->is_real]; }], ['attribute' => 'status', 'value' => function ($model) { return Node::nodeStatus()[$model->status]; }], 'cm.name', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
use yii\helpers\Html; use yii\widgets\DetailView; use backend\models\Node; /* @var $this yii\web\View */ /* @var $model backend\models\Node */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => $site->name, 'url' => ['index', 'site_id' => $site->id]]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="node-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'site.name', 'cm.name', 'name', ['attribute' => 'is_real', 'value' => Node::isReal()[$model->is_real]], 'v_nodes:ntext', ['attribute' => 'parent', 'value' => isset($model->father) ? $model->father->name : ''], 'slug', 'workflow.name', 'tpl_index', 'tpl_detail', ['attribute' => 'status', 'value' => Node::nodeStatus()[$model->status]], 'seo_title', 'seo_keyword', 'seo_description']]); ?> </div>