/** * Aca tenemos que definir todas las rutas que la aplicación va a aceptar. */ public static function init() { // Esta seria la pagina de incio if ($_SERVER['REQUEST_URI'] == '/electiva_php_ude_2015/') { $controller = new HomeController(); $controller->index(); } else { if (strpos($_SERVER['REQUEST_URI'], 'sessions')) { $controller = new SessionsController(); if (strpos($_SERVER['REQUEST_URI'], 'login') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->modal(); } else { if (strpos($_SERVER['REQUEST_URI'], 'login') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->login(); } else { if (strpos($_SERVER['REQUEST_URI'], 'logout') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->logout(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } else { if (strpos($_SERVER['REQUEST_URI'], 'users')) { $controller = new UsersController(); if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->create(); } else { if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->form(); } else { if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->delete(); } else { if (strpos($_SERVER['REQUEST_URI'], 'modify') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->modify(); } else { if (strpos($_SERVER['REQUEST_URI'], 'update') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->update(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } } } else { if (strpos($_SERVER['REQUEST_URI'], 'polyclinics')) { $controller = new PolyclinicsController(); if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->create(); } else { if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->form(); } else { if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->delete(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } else { if (strpos($_SERVER['REQUEST_URI'], 'reports')) { $controller = new ReportsController(); if (strpos($_SERVER['REQUEST_URI'], 'index') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } else { if (strpos($_SERVER['REQUEST_URI'], 'bookings')) { $controller = new BookingsController(); if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->create(); } else { if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->form(); } else { if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->delete(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } else { $controller = new HomeController(); $controller->index(); } } } } } } }