Ejemplo n.º 1
0
 private function callLoginAction($module = 'default')
 {
     Session::delete('user');
     require_once MODULE_PATH . $module . DS . 'controllers' . DS . 'LoginController.php';
     $indexController = new LoginController($this->_params);
     $indexController->indexAction();
 }
Ejemplo n.º 2
0
 /**
  * Checks with the view what the user wants to do and dispatches actions to model, view and controllers
  *
  * Should be called from index to start app
  *
  * @return  string or redirect to self// Is this relly good structure?
  */
 public function indexAction()
 {
     $message = null;
     $view = null;
     $dtv = new \view\DateTimeView();
     if ($this->navigationView->doesUserWantToSeeRegPage()) {
         $view = new \view\RegistrationView();
         $regController = new RegistrationController($this->userCollection, $view);
         $message = $regController->indexAction();
         if ($this->userCollection->getRegistrationSucceeded()) {
             $this->navigationView->redirectTo($message, '');
         }
     } else {
         if ($this->navigationView->doesUserWantToSeeLoginPage()) {
             $view = new \view\LoginView($this->loginModel);
             $loginController = new LoginController($this->loginModel, $view);
             $message = $loginController->indexAction();
             if ($this->loginModel->checkLoginStatus() && isset($message)) {
                 $this->navigationView->redirectTo($message);
             }
         }
     }
     if (!isset($message)) {
         $message = $this->navigationView->getSessionMessage();
     }
     return $this->layoutView->render($view, $dtv, $this->navigationView, $message);
 }