Exemple #1
0
          <div class="service-content">
			<table class="table">
				<thead>
					<td>Livre</td>
					<td>Titre</td>
					<td>Début</td>
					<td>Fin</td>
					<td>Jours restants</td>
					<td>Terminé</td>
				</thead>
				<tbody>
              <!-- Start single service -->
			  <?php 
for ($i = 0; $i < count($reservations); $i++) {
    $reservation = $reservations[$i];
    $book = $bookDB->GetBookById($reservation['livre_id']);
    ?>
					<tr>
						<td><img class="image img-thumbnail img-responsive" src="<?php 
    echo $book['Image_url'];
    ?>
"/></td>
						<td><?php 
    echo $book['title'];
    ?>
</td>
						<td><?php 
    echo $reservation['date_start'];
    ?>
</td>
						<td><?php 
Exemple #2
0
include_once 'db/BookReservationDB.php';
$db = new DBHandler();
$bookDB = new BookDB($db);
$reserveDB = new BookReservationDB($db);
$book = NULL;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $title = $_POST['title'];
    $description = $_POST['description'];
    $Image_Url = $_POST['imageUrl'];
    $date_publish = $_POST['date'];
    $count = $_POST['count'];
    $author = $_POST['author'];
    $isbn = $_POST['isbn'];
    if (isset($_POST['bookId'])) {
        $bookDB->UpdateBook($_POST['bookId'], $isbn, $title, $description, $Image_Url, $author, $date_publish, $count);
        $book = $bookDB->GetBookById($_POST['bookId']);
    } else {
        $bookDB->AddBook($isbn, $title, $description, $Image_Url, $author, $date_publish, $count);
        header("Location: viewAllBooks.php");
    }
} else {
    if ($_SERVER['REQUEST_METHOD'] === 'GET') {
        if (isset($_GET['isbn'])) {
            $result = $bookDB->GetBookByISBN($_GET['isbn']);
            if (count($result) > 0) {
                $book = $result;
            }
        }
        if ($book == NULL) {
            if (isset($_SESSION['user']) && $_SESSION['user']['role'] == "admin") {
            } else {