<h3><?php echo $i['title']; ?> , <?php echo $author; ?> .</h3> <!--<i>Synopsis</i>--><?php //Print the type of the book echo "<p>Type: " . ucfirst($i['type']) . "</p>"; //Include the list class to get the shelf name include_once ROOT . 'admin/list.class.php'; $lists = new Lists("shelves"); //Include the scan_book class to get the book status include ROOT . 'scan_book.class.php'; $sb = new ScanBook(); // require ROOT . '../../koble_til_database.php'; $get_books = "SELECT * FROM lib_RFID WHERE bookID = '" . $i['bookID'] . "'"; $get_books_qry = $conn->query($get_books); $bookz = array('utlant' => 0, 'pa_biblo' => array()); if ($get_books_qry->num_rows > 0) { while ($book = $get_books_qry->fetch_assoc()) { //Check if book is lended if ($sb->isLended($book['RFID'])) { $bookz['utlant']++; } else { $bookz['pa_biblo'][] = $lists->getShelfName($book['_shelfID']); } } }
j_die($error['no_book_rfid']); } $action = 0; /* Deliver / lend the book */ $date = (new DateTime())->format('Y-m-d H:i:s'); $deliver_deadline = new DateTime(); $deliver_deadline->modify('+1 month'); $deliver_deadline = $deliver_deadline->format('Y-m-d H:i:s'); $deliver_deadline = explode(" ", $deliver_deadline)[0] . " 00:00:00"; $res = array('error' => '', 'type' => 0); $deliver = array(); $lend = array(); require ROOT . 'scan_book.class.php'; $sb = new ScanBook(); for ($i = 0; $i < count($books); $i++) { if ($sb->isLended($books[$i]['rfid'])) { $user = $sb->user; //Book shall be delivered if ($res['type'] !== "lend") { $res['type'] = 'deliver'; require ROOT . 'admin/info.class.php'; $info = new Info("books", $books[$i]['bookID']); $result = $info->getInfo(); $result['RFID'] = $books[$i]['rfid']; $result['shelfID'] = $books[$i]['shelfID']; $deliver[] = $result; } else { j_die($error['only_one_action_allowed']); }