/**
* 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 actionUpdate($id)
{
$model = $this->loadModel($id);
$parent = $model->getParentNode();
//如果ID=1 的时候 就是ROOT的是没有上级分类的 $parent 就是一个空的值
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Tree']))
{
$model->attributes = $_POST['Tree'];
if ($model->save())
$this->redirect(array('view', 'id' => $model->id));
}
$this->render('update', array(
'model' => $model,
'parent' => $parent,
));
}