/** * 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); } } } } } }