/** * Handles input, by calling according controller, * an sets view depending on url. * @return void */ public function handleInput() { //Create database, get content catalog $db = new Database(); $contentDAL = new contentDAL($db); $Catalog = new contentCatalog(); $contentController = new ContentController($contentDAL, $Catalog); $contentCatalog = $contentController->getContent(); //Handle login if ($this->navigationView->wantsToLogin()) { $login = new LoginController($this->users, $this->navigationView); $this->IsLoggedIn = $login->doLogin(); if ($this->IsLoggedIn) { $this->navigationView->redirToAdmin(); } else { $this->view = $login->getOutPut(); } } else { if ($this->navigationView->wantsToUpload() && isset($_SESSION['user'])) { $this->view = new AdminView(); $uploadController = new uploadController($this->view, $contentDAL, $this->users); $uploadController->doUpload(); } else { if ($this->navigationView->wantsToReg()) { $model = new RegFacade($this->userDAL); $this->view = new RegView($this->navigationView); $regControl = new RegisterController($model, $this->view); $regControl->addUser(); $this->view = new RegView($this->navigationView); } else { if ($this->navigationView->wantsToViewImage()) { $this->view = new ImageView(); $imgController = new ImageController($this->view, $contentCatalog); $imgController->getImage(); } else { if ($this->navigationView->wantsToViewContent()) { $commentView = new commentView(); $this->view = new ContentView($commentView); $id = $this->view->getID(); $commentDAL = new commentDAL($db); $commentController = new CommentController($commentView, $commentDAL); $comments = $commentController->doComment($id); $content = $contentController->getContentByID($id); $this->view->createHTML($content, $comments); } else { $this->view = new galleryView(); $galController = new GalleryController($this->view); $galController->doGallery($contentCatalog); } } } } } }
/** * Handles input, by calling according controller, * an sets view depending on url. * @return void */ public function handleInput() { if ($this->navigationView->wantsToReg()) { //Create new controller, and handle login $login = new LoginController($this->userDAL->getUsers(), $this->navigationView); $login->doLogin(); //Set the view to LoginView $this->view = $login->getOutPut(); //Tell the view to output HTML for login/logout $this->view->response = isset($_SESSION['user']) ? $this->view->generateLogoutButtonHTML() : $this->view->generateLoginFormHTML(); } else { //Create controller and set view, add user. $model = new RegFacade($this->userDAL); $this->view = new RegView($this->navigationView); $regControl = new RegisterController($model, $this->view); $regControl->addUser(); //Set view $this->view->response = $this->view->getHTML(); } $this->mysqli->close(); }