Example #1
0
 public function actionDeletePlan()
 {
     $plan = new Plan();
     if (\Yii::$app->request->post('plan_id') != '') {
         $plan->deletePlan(\Yii::$app->request->post('plan_id'));
         return $this->redirect(['index']);
     }
 }
Example #2
0
 public function actionIndex()
 {
     $model = new \common\models\SignUp();
     $model->scenario = 'community';
     $plan = \common\models\Plan::findOne(['plan_name' => 'Community Member']);
     $step = 1;
     if (Yii::$app->request->post('type') == 'free') {
         $model->scenario = 'free';
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if (Yii::$app->request->post('type') == 'free') {
             $model->registerFreeMember();
             \Yii::$app->session->setFlash('success', 'Successfully Registered');
             return $this->redirect(['/auth/login']);
         } else {
             $model->scenario = 'community';
             if (isset($_POST['step_1'])) {
                 if ($model->validate()) {
                     $step = 2;
                 } else {
                     $step = 1;
                     return $this->render('signup', ['model' => $model, 'step' => $step, 'plan' => $plan]);
                 }
             }
             // \yii\helpers\VarDumper::dump($model,10,true); die;
         }
     }
     return $this->render('signup', ['model' => $model, 'step' => $step, 'plan' => $plan]);
 }