<table id="simple-table" class="table table-striped table-bordered table-hover"> <thead> <tr> <th class="center"> <label class="pos-rel"> <!-- <input type="checkbox" class="ace">--> <span class="lbl">ID</span> </label> </th> <th>标题</th> <th> <select id="category" name="category"> <option value="">All</option> <?php foreach (\modules\cms\models\Category::eachCategoryTree()['data'] as $key => $item) { ?> <option value="<?php echo $key; ?> "><?php echo $item; ?> </option> <?php } ?> </select> <script> $(document).ready(function () { var categoryId = '<?php
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model modules\cms\models\Category */ /* @var $form yii\widgets\ActiveForm */ $categorys = \modules\cms\models\Category::eachCategoryTree(); ?> <div class="category-form col-xs-8"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'parent')->dropDownList($categorys['data']); ?> <?php echo $form->field($model, 'status')->dropDownList([\modules\cms\models\Category::STATUS_ACTIVE => "显示", \modules\cms\models\Category::STATUS_DELETED => "隐藏"]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? '保存' : '保存', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
/** * Lists all Category models. * @return mixed */ public function actionIndex() { return Category::eachCategoryTree(); }