/** * Updates an existing Show model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $arrTpl = F::getAllTemplates(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'arrTpl' => $arrTpl]); } }
?> <?php echo $form->field($model, 'template_page')->dropDownList($arrTpl['page']); ?> <?php echo $form->field($model, 'redirect_url')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'click')->textInput(['maxlength' => 10]); ?> <?php echo $form->field($model, 'status')->dropDownList(F::getStatus2()); ?> <div class="form-group"> <div class="col-lg-offset-1 col-lg-11"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> </div> <?php ActiveForm::end(); ?> </div>
?> </td> <td><?php echo $item['sort_order']; ?> </td> <td><?php echo F::getPageType($item['page_type']); ?> </td> <td><?php echo F::getYesNo($item['is_nav']); ?> </td> <td><?php echo F::getStatus2($item['status']); ?> </td> <td> <a href="<?php echo \Yii::$app->getUrlManager()->createUrl(['catalog/create', 'parent_id' => $item['id']]); ?> " title="增加子栏目" data-pjax="0"><span class="glyphicon glyphicon-plus-sign"></span></a> <a href="<?php echo \Yii::$app->getUrlManager()->createUrl(['catalog/view', 'id' => $item['id']]); ?> "" title="查看" data-pjax="0"><span class="glyphicon glyphicon-eye-open"></span></a> <a href="<?php echo \Yii::$app->getUrlManager()->createUrl(['catalog/update', 'id' => $item['id']]); ?> "" title="更新" data-pjax="0"><span class="glyphicon glyphicon-pencil"></span></a>