Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class UpdateAction extends CAction {
- /**
- * Updates a particular model.
- * If update is successful, the browser will be redirected to the 'view' page.
- * @param integer $id the ID of the model to be updated
- */
- public function run($id) {
- $model = $this->loadModel($id);
- // Uncomment the following line if AJAX validation is needed
- // $this->performAjaxValidation($model);
- if (isset($_POST['User'])) {
- $model->attributes = $_POST['User'];
- if ('' == $model->password)
- unset($model->password);
- if ($model->save())
- $this->getController()->redirect(array('view', 'id' => $model->id));
- }
- $this->getController()->render('update', array('model' => $model,));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement