public function actionCreatein($id = null) { $model = new Regions(); $comm = json_decode($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Regions'])) { $model->attributes = $_POST['Regions']; if ($model->save()) { $this->redirect(array('admins')); } } $rec = $this->loadModel($comm->e); if ($comm->a == "ca") { $model->setAttribute('next', $rec->id); $model->setAttribute('region_id', $rec->region_id); } elseif ($comm->a == "cb") { $model->setAttribute('next', $rec->next); $model->setAttribute('region_id', $rec->region_id); } elseif ($comm->a == "ci") { if (!is_null($rec->region_id)) { $this->redirect(array('admins')); } $model->setAttribute('next', null); $model->setAttribute('region_id', $rec->id); } $this->render('create', array('model' => $model)); }