public function logout() { $user = $this->sessionModel->GetUser(); $this->sessionModel->logOut(); $this->cookieView->deleteCookie(); NavView::redirectHome($user); }
/** * @param SessionModel $sessionModel * @return string */ public function showMemberView($sessionModel) { // Get agent from session and set to view. $this->memberView->SetUser($sessionModel->GetUser()); // If user created cookie,logged in or registered, show messages. $cookieView = new CookieView(); if ($cookieView->cookieExist()) { $this->memberView->cookieWelcome(); } $this->memberView->loginWelcome(); $this->memberView->registerWelcome(); $this->memberView->exampleSubmitUml(); try { //TODO Break out userSaveToZip to own function to remove nested IF. if ($this->memberView->userSubmitUml()) { $this->memberView->handleInput(); } else { if ($this->memberView->userSaveToServer()) { $this->saveUML(); } else { if ($umlPost = $this->memberView->userSaveToZip()) { $classArray = $this->interpretModel->validate($umlPost); if (count($classArray) === 0) { $this->memberView->canNotIntepretMSG(); } else { if ($classArray === null) { $this->guestView->toLongInputMSG(); } else { new SaveToZipView($classArray); } } } } } } catch (UmlStringToShortException $e) { $this->memberView->umlToShortMSG(); } catch (NoHTMLAllowedException $e) { $this->memberView->noHTMLMSG(); } return $this->memberView->showMemberContents(); }