/** * 所有菜单tree */ public function treeList() { $list = $this->find()->where(['status' => 1])->orderBy('sort')->asArray()->all(); return \common\helpers\Functions::list_to_tree_menu($list); }
<thead> <tr> <th colspan="4">系统信息</th> </tr> </thead> <tbody> <tr> <td width="20%">服务器操作系统:</td> <td width="30%"><?php echo PHP_OS; ?> </td> <td width="20%">Web 服务器:</td> <td width="30%"><span title="<?php echo $_SERVER['SERVER_SOFTWARE']; ?> "><?php echo Functions::truncate_utf8_string($_SERVER['SERVER_SOFTWARE'], 20); ?> </span></td> </tr> <tr> <td width="20%">PHP 版本:</td> <td width="30%"><?php echo PHP_VERSION; ?> </td> <td width="20%">MySQL 版本:</td> <td width="30%"><?php $result = Yii::$app->db->createCommand('select version() as v')->queryAll(); echo $result[0]['v']; ?> </td> </tr> <tr>
echo Yii::$app->urlManager->createUrl(['goods/index']); ?> ')" value=" 搜索 " class="button"> </form> </div> <!-- 搜索 end --> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'name' => 'id'], ['attribute' => 'goods_id', 'value' => function ($model) { return $model->goods_id; }, 'options' => ['width' => 20]], ['attribute' => 'goods_name', 'value' => function ($model) { return Functions::truncate_utf8_string($model->goods_name, 20); }], ['attribute' => 'goods_sn', 'value' => function ($model) { return $model->goods_sn; }, 'options' => ['width' => 100]], ['attribute' => 'shop_price', 'value' => function ($model) { return $model->shop_price; }, 'options' => ['width' => 100]], ['header' => Html::a('上架', 'javascript:;'), 'content' => function ($model) { if ($model->is_on_sale == 1) { return Html::img('@web/image/yes.gif', ['onclick' => "setOnSale(this, {$model->goods_id})", 'data-status' => 0]); } return Html::img('@web/image/no.gif', ['onclick' => "setOnSale(this, {$model->goods_id})", 'data-status' => 1]); }], ['header' => Html::a('精品', 'javascript:;'), 'content' => function ($model) { if ($model->is_best == 1) { return Html::img('@web/image/yes.gif', ['onclick' => "setBest(this, {$model->goods_id})", 'data-status' => 0]); } return Html::img('@web/image/no.gif', ['onclick' => "setBest(this, {$model->goods_id})", 'data-status' => 1]); }], ['header' => Html::a('新品', 'javascript:;'), 'content' => function ($model) {
/** * Updates an existing Member model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { if (!$this->is_access('member/update')) { Yii::$app->session->setFlash('error', $this->errorInfo); return $this->redirect($this->redirectUrl); } $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { if ($model->editData()) { Yii::$app->session->setFlash('success', '编辑成功'); } else { Yii::$app->session->setFlash('error', '编辑失败'); } } else { $error = \common\helpers\Functions::getErrors($model->errors); Yii::$app->session->setFlash('error', $error); } return $this->redirect(['index']); } else { Yii::$app->view->params['meta_title'] = '编辑会员'; return $this->render('update', ['model' => $model]); } }
<?php echo Html::beginForm(['deleteall']); ?> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'showFooter' => true, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'name' => 'id', 'footer' => Html::button('批量删除', ['class' => 'btn btn-danger', 'onclick' => 'submits()']), 'options' => ['width' => 70]], 'attr_id', ['header' => Html::a('商品类型', 'javascript:;'), 'content' => function ($model) { return GoodsType::findOne($model->cat_id)->cat_name; }], 'attr_name', ['header' => Html::a('录入方式', 'javascript:;'), 'content' => function ($model) { $typeList = ['0' => '手工录入', '1' => '从列表中选择', '2' => '多行文本框']; return $typeList[$model->attr_input_type]; }], ['attribute' => 'attr_values', 'value' => function ($model) { $content = str_replace("\r\n", ', ', $model->attr_values); return Functions::truncate_utf8_string($content, 28); }, 'options' => ['width' => 430]], ['attribute' => 'sort_order', 'value' => function ($model) { return $model->sort_order; }, 'options' => ['width' => 70]], ['class' => 'yii\\grid\\ActionColumn', 'header' => Html::a('操作', 'javascript:void(0);'), 'template' => '{update} {delete} {deletes}']]]); ?> <?php Pjax::end(); ?> <?php echo Html::endForm(); ?> </div> <script> function submits(){ if (confirm('您确定要删除选中项吗?')) {
<input type="submit" onclick="query('<?php echo Yii::$app->urlManager->createUrl(['brand/index']); ?> ')" value=" 搜索 " class="button"> </form> </div> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['brand_name', 'site_url', ['header' => Html::a('品牌描述', 'javascript:void(0);'), 'content' => function ($model) { return Functions::truncate_utf8_string($model->brand_desc, 25); }], 'sort', ['header' => Html::a('是否热销', 'javascript:void(0);'), 'content' => function ($model) { if ($model->is_hot == 1) { return Html::img('@web/image/yes.gif', ['onclick' => "setHot(this, {$model->brand_id})", 'data-status' => 0]); } return Html::img('@web/image/no.gif', ['onclick' => "setHot(this, {$model->brand_id})", 'data-status' => 1]); }], ['header' => Html::a('是否显示', 'javascript:void(0);'), 'content' => function ($model) { if ($model->status == 1) { return Html::img('@web/image/yes.gif', ['onclick' => "setStatus(this, {$model->brand_id})", 'data-status' => 0]); } return Html::img('@web/image/no.gif', ['onclick' => "setStatus(this, {$model->brand_id})", 'data-status' => 1]); }], ['class' => 'yii\\grid\\ActionColumn', 'header' => Html::a('操作', 'javascript:void(0);'), 'template' => '{update} {delete}']]]); ?> <?php Pjax::end(); ?>
</form> </div> <?php Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'name' => 'id'], ['attribute' => 'aid', 'label' => '文章id'], ['header' => Html::a('评论人', 'javascript:void(0);'), 'content' => function ($model) { if ($model->uid) { return Member::findOne($model->uid)->username; } return ''; }], ['attribute' => 'content', 'value' => function ($model) { return Functions::truncate_utf8_string($model->content, 30); }], 'add_time:datetime', ['header' => Html::a('状态', 'javascript:void(0);'), 'content' => function ($model) { if ($model->status == 1) { return Html::img('@web/image/yes.gif', ['onclick' => "setStatus(this, {$model->id})", 'data-status' => 0]); } return Html::img('@web/image/no.gif', ['onclick' => "setStatus(this, {$model->id})", 'data-status' => 1]); }], ['class' => 'yii\\grid\\ActionColumn', 'header' => Html::a('操作', 'javascript:void(0);'), 'template' => '{update} {delete}']]]); ?> <?php Pjax::end(); ?> </div> <?php $this->beginBlock('js_end');