Example #1
0
 public function run()
 {
     // echo "sign up model";
     $user = $this->propareVO();
     // if Email not exists, continue to create
     if (!UserDAOImpl::findByEmail($user->getEmail())) {
         $result = UserDAOImpl::doCreate($user);
         // create user in db
         if ($result) {
             // send mail
             $iEmailService = new EmailService();
             $iEmailService->setReceiver($user);
             $msg = $iEmailService->sendEmail();
             // header('location: ../login');
         } else {
             $msg = SQL_EXCEPTION_CREATE_USER;
             // show error prompt
         }
     } else {
         $msg = SIGN_UP_DUPLICATE_REGISTER;
     }
     $controller = new Prompt();
     $controller->index($msg);
 }