public function signupAction()
 {
     $this->view->title = "User Registration.";
     $this->view->headTitle($this->view->title, 'PREPEND');
     $form = new Form_Signup();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $formvalues = $form->getValues();
             $user = new Model_User();
             $db = $user->getAdapter();
             $db->beginTransaction();
             try {
                 $user->fill($formvalues);
                 $user->eStatus = 1;
                 $user->eAlerts = 1;
                 $user->eRights = 1;
                 $user->dRegDate = time();
                 // $user->sendActivationEmail();
                 $user->save();
                 $group = new Model_SubGroup();
                 $group->find('vGroupCodeId', $formvalues['iSGroupCode']);
                 $assign = new Model_SubGroupUserAssign();
                 $assign->iSGroupId = $group->iSGroupId;
                 $assign->iUserId = $user->iUserId;
                 $assign->save();
                 $db->commit();
             } catch (Exception $e) {
                 $db->rollBack();
                 echo $e->getMessage();
             }
             $this->_helper->redirector('login');
         }
     }
     $this->view->form = $form;
 }
Exemplo n.º 2
0
 public function signupedAction()
 {
     //global $testvar;
     global $mySession;
     $launch = $this->getRequest()->getParam('l');
     $this->view->l = $launch;
     $this->_helper->layout->setLayout('myaccount');
     $db = new Db();
     $testvar = 'abctestvar';
     $this->view->testing = $testvar;
     $myform = new Form_Login();
     $this->view->myform = $myform;
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myformsignup = new Form_Signup();
         if ($myformsignup->isValid($request->getPost())) {
             $dataForm = $myformsignup->getValues();
             $pass = $dataForm['signuppass'];
             $cnfrm = $dataForm['signupcnfrmpass'];
             if ($pass == $cnfrm) {
                 $myObj = new Myaccountdb();
                 // call to model
                 $data = $myObj->signupdb($dataForm);
                 if ($data == 0) {
                     $mySession->errorMsg = "Email already Exisis. Enter Valid Email Address";
                     $this->view->myformsignup = $myformsignup;
                     $this->render('index');
                 } else {
                     $mySession->errorMsg = "An Activation link sent to your email address. Please follow the link in the email to verify your email address and activate your account.";
                     //if($launch!="")
                     //							{
                     //								$this->_redirect('login/index/l/launch');
                     //							}
                     $this->_redirect('login/index');
                     //$this->_redirect('myaccount/activecampaign');
                 }
             } else {
                 $mySession->errorMsg = "Password not identical";
                 $this->view->myformsignup = $myformsignup;
                 $this->render('index');
             }
         } else {
             $this->view->myformsignup = $myformsignup;
             $this->render('index');
         }
     } else {
         $this->_redirect('login/index');
     }
 }