public function bookdel()
 {
     $this->allowTo('admin');
     $id = $_POST['id_book'];
     $user = new \Manager\BookingManager();
     if ($user->delete($id)) {
         $string = "La reservation vient d'être supprimé avec succès.";
     } else {
         $string = "Impossible de supprimé cette reservation.";
     }
     $this->show("status/sender", ["string" => $string, "nb" => 3, "link" => "setting_book"]);
 }
 public function bill($clientId, $BookingId)
 {
     //je n'autorise cette fonction que si un utilisateur avec le role user est connecté
     echo 'arg 1 ' . $clientId . 'arg 2:' . $BookingId . '<br>';
     if (isset($_SESSION['user'])) {
         //echo "argument clientId de la fonction bill: $clientId<br>";
         $newbm = new \Manager\BookingManager();
         //recupère les infos d'un client par son id dans un tableau
         $ClientInfo = $newbm->getClientInfoByClientId($clientId);
         if ($ClientInfo === false) {
             // théoriquement on arrive jamais ici
             echo 'aucune info pour cet id client';
             die;
         }
         //recupère les infos booking d'un client par son id dans un tableau
         $BookingInfo = $newbm->getBookingInfoByBookingId($BookingId);
         if ($BookingInfo === false) {
             echo 'aucun info booking pour cet id booking ';
             die;
         }
         /*Je fusionne les 2 tableaux pour en faire un seul pour le passer a la méthode show pour générer le pdf
         		attention si j'ai 2 colonnes id qui portent le meme nom id je n'aurais que le premier champ id, donc
         		mettre un nom différent pour un des deux, donc j'ai id_booking au lieu de id*/
         $ClientInfoAll = array_merge($ClientInfo, $BookingInfo);
         $bookingDays = $this->CalcBookingDuration($ClientInfoAll['begin'], $ClientInfoAll['end']);
         if ($bookingDays < 1) {
             echo 'nombre de jour incohérent!';
             die;
         }
         //je rajoute un élement nombre jour booking a la fin de mon tableau
         $ClientInfoAll['bookingDays'] = $bookingDays;
         $ClientInfoAll['id_room'] = $_SESSION['user']['booked_room'];
         var_dump($ClientInfoAll);
         echo '<script>alert("Réservation enregistrée correctement. Cliquez sur OK pour voir votre facture")</script>';
         //je passe en paramètre au template un tableau qui contient les données clients pour construction du pdf
         $this->show("booking/facture_hotel", $ClientInfoAll);
     } else {
         $this->showForbidden();
     }
 }
示例#3
0
 public function bookdel($id)
 {
     $deleteBook = new \Manager\BookingManager();
     if ($deleteBook->deleteBooking($id)) {
         $string = "Votre réservation à bien été supprimé.";
         $this->show('status/sender', ['string' => $string, 'link' => 'log_userconfig', 'nb' => 3]);
     } else {
         $string = "Erreur de suppression, votre réservation est toujours effective.";
         $this->show('status/sender', ['string' => $string, 'link' => 'log_userconfig', 'nb' => 3]);
     }
 }