isLoggedIn() && $_SESSION['USER']->getType() == 'Staff') { if(isset($path[1])){ switch ($path[1]){ case 'date': if(isset($path[2])){ $dates = []; $reservation = AccomodationReservation::fetchByUserEmail($path[2]); forEach($reservation as $reserv){ $start = date_create($reserv->getStartDate()); $end = date_create($reserv->getEndDate()); $end->add(new DateInterval('P1D')); $period = new DatePeriod( $start, new DateInterval('P1D'), $end ); foreach ($period as $key => $value) { if(!in_array($value->format('Y-m-d'), $dates)){ $dates[] = $value->format('Y-m-d'); } } } echo json_encode($dates); } die(); default: die(); } } $alert = ''; $bornes_date = array_keys(AccomodationLoad::getRange()); $bornes_date = [$bornes_date[0], $bornes_date[count($bornes_date) - 1]]; $vips = User::fetch(array(['UserTypeName', '=', 'VIP'])); require_once(VIEW_PATH . $path[0] . '.php'); } else { redirect('login'); }