/** * Lists all models. */ public function actionIndex() { $model = new Plan(); $modelPlanLimit = new PlanLimit(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); // manage plan if (isset($_POST['Plan'])) { $model->attributes = $_POST['Plan']; $model->wlabel_id = Yii::app()->user->getWhiteLabelId(); $model->type = $this->planType; if ($model->save()) { $this->redirect(array('index')); } } if (isset($_GET['Plan'])) { $model->attributes = $_GET['Plan']; } // manage plan limit if (isset($_POST['PlanLimit'])) { $modelPlanLimit->attributes = $_POST['PlanLimit']; if ($modelPlanLimit->save()) { $this->redirect(array('index')); } } if (isset($_GET['PlanLimit'])) { $modelPlanLimit->attributes = $_GET['PlanLimit']; } $this->render('index', array('model' => $model, 'modelPlanLimit' => $modelPlanLimit)); }