/** * Updates an existing KefuSelfservice model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $categories = KefuSelfserviceCat::find()->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'categories' => $categories]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = KefuSelfserviceCat::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'slug', $this->slug]); return $dataProvider; }
<?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php if (Yii::$app->user->can('administrator')) { ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Kefu Selfservice')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php } ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'sn', ['attribute' => 'game_server', 'value' => function ($model) { return \common\models\GameServer::findOne($model->game_server)['server_name']; }, 'filter' => ArrayHelper::map(\common\models\GameServer::find()->all(), 'id', 'server_name')], 'game_role', ['attribute' => 'category_id', 'value' => function ($model) { return $model->category ? $model->category->title : null; }, 'filter' => ArrayHelper::map(\common\models\KefuSelfserviceCat::find()->all(), 'id', 'title')], 'created_at:datetime', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => KefuSelfservice::getStatus()], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {result} {delete}', 'buttons' => ['result' => function ($url, $model, $key) { if ($model->status == KefuSelfservice::STATUS_YICHULI) { return ""; } return Html::a('<span class="glyphicon glyphicon-check"></span>', ['/kefu-selfservice/result', 'id' => $model->id], ['title' => Yii::t('common', 'check'), 'id' => 'check' . $model->id]); }]]]]); ?> </div>
?> "><h2 class="heading-md">账号修复</h2></a> <p>通过提交申诉表单修复自己的账号</p> </div> </div> <div class="col-md-4 col-sm-12"> <div class="service-block service-block-blue service-or"> <div class="service-bg"></div> <i class="icon-custom icon-color-light rounded-x icon-line fa fa-circle-thin"></i> <h2 class="heading-md">自助服务</h2> <p> <?php foreach (\common\models\KefuSelfserviceCat::find()->all() as $selfservices) { ?> <a href="<?php echo Url::to(['/kefu/' . $selfservices->slug]); ?> "><?php echo $selfservices->title; ?> </a> | <?php } ?> <a href="<?php echo Url::to(['/kefu/selfservice-result']); ?> ">结果</a>