public function actionIndex() { if (O::app()->user->isGuest) { if (isset($this->actionParams['next'])) { $next = $this->getURL($this->actionParams['next']); } else { $next = $this->getURL('index', array('just_login' => 1)); } $regModel = new UserRegisterForm(); $regForm = $regModel->createForm(); $loginModel = new UserLoginForm(); $loginForm = $loginModel->createForm(); $regForm->action['nexturl'] = $loginForm->action['nexturl'] = $next; $this->render('index', array('regForm' => $regForm, 'loginForm' => $loginForm)); return; } elseif (isset($this->actionParams['just_login'])) { $div_count = O::app()->db->createCommand()->select('COUNT(dc.div_id)')->from(TableNames::DIVISION_CHOICE . ' dc')->join(TableNames::DIVISION . ' d', 'd.div_id = dc.div_id AND d.rec_id = :rec_id')->where('dc.user_id = :user_id')->limit(1)->queryScalar(array('rec_id' => $this->rec->id, 'user_id' => O::app()->user->id)); if ($div_count == 0) { $this->redirect($this->getURL('division', array('wiz' => 1))); return; } //$this->render('index'); } //else { $this->render('index'); //} }
public function actionRegister() { if (isset($this->actionParams['nexturl'])) { $nexturl = $this->actionParams['nexturl']; } else { $nexturl = array('/user/profile'); } $model = new UserRegisterForm(); $form = $model->createForm(); $form->action['nexturl'] = CHtml::normalizeUrl($nexturl); //var_dump($this->actionParams); if ($form->submitted('register') && $form->validate() && $model->register()) { $this->redirect($nexturl); } else { $this->render('register', array('form' => $form)); } }