public function RunProgram() { //databas $db = new \model\UsersDAL(); //modell $l = new \model\Login($db); //view $dtv = new \view\DateTimeView(); $rv = new \view\RegisterView(); $v = new \view\LoginView($l->getIsLoggedIn()); $urlLoginOrRegister = false; //login or register $navigation = $rv->checkURL(); if ($navigation === 'register') { $r = new \model\Registration($db); $rc = new RegisterController($rv, $r); $rc->startRegistration(); } else { $lc = new LoginController($l, $v); $lc->startLogin(); $urlLoginOrRegister = true; } $lv = new \view\LayoutView($l->getIsLoggedIn(), $v->LoginResponse(), $dtv, $rv->generateRegistrationHTML()); ///skcika med tre eller false istället för $lv->render($urlLoginOrRegister); }
public function runProgram() { $sessions = new \view\Sessions(); $show = ''; //kolla om inlogg i url if ($this->Navigation->checkLogin()) { $loginView = new \view\LoginView($sessions); $loginModel = new \model\LoginModel($this->DB); new \controller\LoginController($loginModel, $loginView); $show = $loginView->LoginResponse(); } else { if ($this->Navigation->checkChangeGallery() && $sessions->checkSessionLoggedIn()) { $changeGalleryView = new \view\ChangeGalleryView($this->DB); $changeGalleryController = new \controller\ChangeGalleryController($this->DB, $changeGalleryView); $show = $changeGalleryView->changeGalleryResponse(); } else { if ($this->Navigation->checkNewCategory() && $sessions->checkSessionLoggedIn()) { $newCategoryView = new \view\NewCategoryView($this->DB); $newCategoryController = new \controller\NewCategoryController($this->DB, $newCategoryView); $show = $newCategoryView->newCategoryResponse(); } else { if ($this->Navigation->checkContactPage()) { $contactView = new \view\ContactView(); $contactModel = new \model\ContactModel(); $contactController = new \controller\ContactController($contactModel, $contactView); $show = $contactView->contactRender(); } else { if ($this->Navigation->checkInfoPage()) { $informationView = new \view\InformationPageView(); $show = $informationView->informationPageHTML(); } else { if ($this->Navigation->checkLogout()) { $sessions->setLogoutDestroy(); header('Location: http://188.166.116.158/1dv608/Project-Gallery/?'); } else { $galleryView = new \view\GalleryView($this->DB); $show = $galleryView->GalleryHTML(); } } } } } } $start = new \view\StartView($sessions->checkSessionLoggedIn()); $start->renderLayout($show); }