コード例 #1
0
ファイル: Reservation.php プロジェクト: vrajau/Covoiturage
 private function updatePlace($idt, $nbplace)
 {
     $infos_trajet = Trajet::getInformationTrajet($idt)[0];
     $database = UsineBDD::getUsine()->connection();
     $nbplace_reste = $infos_trajet['nb_place'] - $nbplace;
     $sql_update_trajet = "UPDATE trajet SET nb_place = :nbr WHERE id=:id";
     $requete_update = $database->prepare($sql_update_trajet);
     $requete_update->execute(array(':id' => $infos_trajet['id'], ':nbr' => $nbplace_reste));
 }
コード例 #2
0
ファイル: Messagerie.php プロジェクト: vrajau/Covoiturage
 public static function envoyerMessageA($id_trajet)
 {
     $database = UsineBDD::getUsine()->connection();
     $passagers = Reservation::getUtilisateurReservation($id_trajet);
     $info = Trajet::getInformationTrajet($id_trajet)[0];
     $date = date('d-n-Y H:i', $info['timestamp_trajet']);
     $message = "Le trajet " . $info['ville_depart'] . '-' . $info['ville_arrive'] . 'du ' . $date . 'a été annulé ! Vous avez recu 10€ en dédomagement';
     foreach ($passagers as $array => $passager) {
         $sql_message = "INSERT INTO messagerie VALUES('',:ide,:idd,:c,:t,'')";
         $requete = $database->prepare($sql_message);
         $requete->execute(array(':ide' => Utilisateur::getUtilisateurId(), ':idd' => $passager['id_membre'], ':c' => $message, ':t' => time()));
     }
 }
コード例 #3
0
ファイル: mytrajet.php プロジェクト: vrajau/Covoiturage
            $html .= '<tr> <td colspan="4"> <a class="button-warning pure-button" href="/Controller/ProfilController.php?context=trajets&id_trajet=' . $info_trajet['id'] . '&annulation_trajet=1"> Annuler le trajet </a></tr>';
        } else {
            $html .= '<tr> <td colspan="4"> Trajet Validé </td></tr>';
        }
        $html .= '</tbody></table> </div>';
    } elseif (count($reservations) == 0 && count($info_trajet) != 0) {
        $html .= '<div class="erreur"><p> Il n\' y a aucune réservation sur ce trajet </p></div>';
    }
} elseif (isset($_GET['id_trajet']) && !empty(trim($_GET['id_trajet'])) && !Trajet::trajetExiste($_GET['id_trajet'])) {
    $html .= "<p> Ce trajet n'existe plus !</p>";
} else {
    $trajets = Trajet::getAllTrajetConducteur();
    if (count($trajets) != 0) {
        foreach ($trajets as $array => $trajet) {
            $html .= '<div class="liste_reservation">';
            $infos_trajet = Trajet::getInformationTrajet($trajet['id'])[0];
            $tmp = $infos_trajet['timestamp_trajet'];
            $jour = date('d', $tmp);
            $mois = moisFrancais(date('n', $tmp));
            $annee = date('Y', $tmp);
            $heure = date('H : i', $tmp);
            $date_depart = $jour . ' ' . $mois . ' ' . $annee . ' ' . $heure;
            $html .= '<table class="pure-table pure-table-bordered"><thead>';
            $html .= '<tr > <th colspan="2"> Trajet : ' . ucfirst($infos_trajet['ville_depart']) . '-' . ucfirst($infos_trajet['ville_arrive']) . '</th></tr></thead>';
            $html .= '<tbody><tr> <td> Date : </td><td>' . $date_depart . '</td></tr>';
            $html .= '<tr> <td> Places restante : </td><td>' . $infos_trajet['nb_place'] . '</td></tr>';
            $html .= '<tr> <td> Prix Place : </td><td> ' . $infos_trajet['prix'] . '&#8364;</td></tr>';
            $html .= '<tr> <td colspan="2"> <a class="pure-button pure-button-primary" href="/Controller/ProfilController.php?context=trajets&id_trajet=' . $infos_trajet['id'] . '"> Préparation trajet </a></tr>';
            $html .= '</tbody></table> </div>';
        }
    } else {
コード例 #4
0
ファイル: Note.php プロジェクト: vrajau/Covoiturage
 public static function isNoteExisteU($id_trajet, $utilisateur)
 {
     $database = UsineBDD::getUsine()->connection();
     $info_t = Trajet::getInformationTrajet($id_trajet)[0];
     $sql = "SELECT id FROM note WHERE id_trajet=:idt AND id_membre=:idm AND id_membre_note=:idn";
     $requete = $database->prepare($sql);
     $requete->execute(array(':idt' => $info_t['id'], ':idm' => Utilisateur::getUtilisateurId(), ':idn' => $utilisateur));
     $res = $requete->fetchAll();
     if (count($res) != 0) {
         return true;
     } else {
         return false;
     }
 }
コード例 #5
0
ファイル: trajet.php プロジェクト: vrajau/Covoiturage
<?php

$reservation = new Reservation();
$infos_trajet = Trajet::getInformationTrajet($_GET['id_trajet_r'])[0];
$tmp = $infos_trajet['timestamp_trajet'];
$jour = date('d', $tmp);
$mois = moisFrancais(date('n', $tmp));
$annee = date('Y', $tmp);
$heure = date('H : i', $tmp);
$date_depart = $jour . ' ' . $mois . ' ' . $annee . ' ' . $heure;
if ($infos_trajet['nb_place'] == 0) {
    $reservation = "Complet";
} else {
    $reservation = '<select name="nb_place_reserver">';
    for ($i = 1; $i <= $infos_trajet['nb_place']; $i++) {
        $reservation .= '<option value="' . $i . '">' . $i . ' place(s)</option>';
    }
    $reservation .= '</select>';
}
$html = '<div class="reservation">';
$html .= '<form method="POST" action="/Controller/ReservationController.php"> <table class="pure-table pure-table-bordered">';
$html .= '<thead><tr > <th colspan="2"> Trajet : ' . ucfirst($infos_trajet['ville_depart']) . '-' . ucfirst($infos_trajet['ville_arrive']) . '</th></tr></thead>';
$html .= '<tbody><tr> <td>Conducteur : </td><td><a title="Voir Profil" href="/Controller/ProfilController.php?context=profil&id_membre=' . $infos_trajet['id_conducteur'] . '">' . Utilisateur::getUsername($infos_trajet['id_conducteur']) . '</a></td></tr>';
$html .= '<tr> <td> Date : </td><td>' . $date_depart . '</td></tr>';
$html .= '<tr> <td> Places restante : </td><td>' . $infos_trajet['nb_place'] . '</td></tr>';
$html .= '<tr> <td> Prix Place : </td><td> ' . $infos_trajet['prix'] . '&#8364;</td></tr>';
$html .= '<tr><td> Réserver : </td> <td>' . $reservation . '</td></tr>';
$html .= '</tbody></table> <button type="submit" class="button-success pure-button"><i class="fa fa-car"></i> Réserver vos places </button><input type="hidden" name="id_trajet" value="' . $infos_trajet['id'] . '"></form></div>';
echo $html;
コード例 #6
0
ファイル: myreservation.php プロジェクト: vrajau/Covoiturage
include '../Vue/formulaire_note.php';
$reservations = Reservation::getAllReservation();
$n = new Note();
if (isset($n)) {
    if ($n->_erreurs) {
        foreach ($n->_erreurs as $error) {
            echo $error;
        }
    }
}
$html = '<div class="liste_reservation_L">';
if (count($reservations) != 0) {
    $html .= '<table class="pure-table pure-table-bordered"><thead><tr><th> Conducteur </th> <th> Trajet </th> <th> Date </th> <th>Prix </th> <th> Nombre de place prise </th> <th> Note </th></tr></thead><tbody>';
    foreach ($reservations as $array => $reservation) {
        $info_trajet = Trajet::getInformationTrajet($reservation['id_trajet'])[0];
        $notation = array(5 => 'Amazing!', 4 => 'Super bon', 3 => 'Ca peut aller', 2 => 'Peut mieux faire', 1 => 'Ca fait mal');
        $notation_select = '<form method="POST" action="/Controller/ProfilController.php?context=reservations&id_trajet=' . $info_trajet['id'] . '"><select name="note">';
        foreach ($notation as $note => $description) {
            $notation_select .= '<option value="' . $note . '">' . $note . '-' . $description . '</option>';
        }
        $notation_select .= '</select> <button type="submit" class="button-success pure-button" name="confirmation_note"><i class="fa fa-thumbs-up"></i> Note</button></form>';
        $notation_r = Trajet::isTrajetValide($reservation['id_trajet']) ? $notation_select : 'Vous ne pouvez pas noter un trajet non valide';
        $notation_r = Note::isNoteExiste($info_trajet['id']) ? 'Vous avez noté cette personne' : $notation_r;
        $date = date('d-n-Y H:i', $info_trajet['timestamp_trajet']);
        $html .= '<tr><td><a href="/Controller/ProfilController.php?context=profil&id_membre=' . $info_trajet['id_conducteur'] . '">' . Utilisateur::getUsername($info_trajet['id_conducteur']) . '<a href="/Controller/MessageController.php?context=envoie&id_membre=' . $info_trajet['id_conducteur'] . '"><img src="/image/mail.png" alt="Message"/></a></td>';
        $html .= '<td>' . ucfirst($info_trajet['ville_depart']) . ' - ' . ucfirst($info_trajet['ville_arrive']) . '</td>';
        $html .= '<td>' . $date . '</td>';
        $html .= '<td>' . $info_trajet['prix'] . '</td>';
        $html .= '<td>' . $reservation['nb_place'] . '</td>';
        $html .= '<td>' . $notation_r . '</td></tr>';
コード例 #7
0
<div class="reservation_c">
	<p> Réservation de <?php 
echo $_POST['nb_place_reserver'];
?>
 place(s) pour <span class="price"><?php 
echo $_POST['nb_place_reserver'] * Trajet::getInformationTrajet($_POST['id_trajet'])[0]['prix'];
?>
&#8364;</span></p>
	<form action="/Controller/ReservationController.php" method="POST">
		
		<input type="hidden" name="confirmation_trajet_id" value="<?php 
echo $_POST['id_trajet'];
?>
">
		<input type="hidden" name="confirmation_trajet_place" value="<?php 
echo $_POST['nb_place_reserver'];
?>
">
		<button type="submit" class="button-success pure-button" name="reservation_confirmation"><i class="fa fa-car"></i> Réserver vos places </button>
	</form>

	
</div>