/** * Switch subscription * * @param unknown $id */ public function actionSubscription($id) { LBApplication::setCurrentlySelectedSubscription($id); $this->redirect(Yii::app()->baseUrl . "/" . $id . "/lbInvoice/dashboard"); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AccountSubscription(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['AccountSubscription'])) { // $model->attributes=$_POST['AccountSubscription']; // if($model->save()) // $this->redirect(array('view','id'=>$model->account_subscription_id)); // if (isset($_GET['package_id'])) // { $package_id = 4; // check if this user is already subscribe to this package // if (AccountSubscription::model()->isAlreadySubscribedToPackage($package_id)) // { // $this->redirect(array('accountTeamMember/admin')); // } // add subscription $accountSubscription = new AccountSubscription(); $accountSubscription->account_id = Yii::app()->user->id; $accountSubscription->account_subscription_package_id = $package_id; $accountSubscription->account_subscription_start_date = date('Y-m-d H:i:s'); $accountSubscription->account_subscription_status_id = ACCOUNT_SUBSCRIPTION_STATUS_ACTIVE; $accountSubscription->subscription_name = $_POST['AccountSubscription']['subscription_name']; if ($accountSubscription->save()) { LBApplication::setCurrentlySelectedSubscription($accountSubscription->account_subscription_id); } $this->redirect(array('accountTeamMember/admin')); // } // // no package id, go to home // $this->redirect(array('project/index')); } $this->render('create', array('model' => $model)); }