Exemplo n.º 1
0
 public function indexAction()
 {
     $formularioRegistro = new Application_Form_FormularioRegistro();
     $params = $this->_getAllParams();
     $entityUsuario = new Application_Entity_Usuario();
     if ($this->_request->isPost()) {
         if ($formularioRegistro->isValid($params)) {
             try {
                 $data['_correo'] = $params['Correo'];
                 $data['_password'] = $params['Password'];
                 $data['_nombreUsuario'] = $params['Nombres'];
                 $data['_apellidosUsuario'] = $params['Apellidos'];
                 $data['_genero'] = $params['Genero'];
                 $data['_telefono'] = $params['Telefono'];
                 $data['_estado'] = 1;
                 $entityUsuario->setProperties($data);
                 if ($entityUsuario->crearUsuario()) {
                     if ($this->autentificateUser($params['Correo'], $params['Password'])) {
                         if (isset($this->_session->urlRedirec) && $this->_session->urlRedirec != '') {
                             $this->_redirect($this->_session->urlRedirec);
                         } else {
                             $this->_redirect('/');
                         }
                     }
                 } else {
                     echo 'problemas de registro';
                 }
             } catch (Exception $exc) {
                 echo $exc->getTraceAsString();
             }
         }
     }
     $this->view->formularioRegistro = $formularioRegistro;
 }