function get_book_info($book, $deliver_deadline) { include 'admin/list.class.php'; $list = new Lists("shelves"); $shelf_name = $list->getShelfName($book['shelfID']); return array('title' => mb_convert_encoding($book['title'], "UTF-8", 'HTML-ENTITIES'), 'author' => mb_convert_encoding($book['author'], "UTF-8", 'HTML-ENTITIES'), 'ISBN10' => $book['ISBN10'], 'ISBN13' => $book['ISBN13'], 'delivery_date' => explode(" ", $deliver_deadline)[0], 'shelf' => mb_convert_encoding($shelf_name, "UTF-8", 'HTML-ENTITIES'), 'rfid' => $book['RFID']); }
$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']); } } } if ($bookz['utlant'] != 0 || count($bookz['pa_biblo']) > 0) { echo '<p>På Biblo: ' . count($bookz['pa_biblo']) . '</p>'; if (count($bookz['pa_biblo']) > 1) { echo '<p>Hyller: '; } else { echo '<p>Hylle: '; } $hyller = ""; foreach ($bookz['pa_biblo'] as $hylle) { $hyller .= $hylle . ', '; } $hyller = rtrim($hylle, ', ');
function getRFID() { $res = array(); $get_rfid = "SELECT * FROM lib_RFID WHERE " . $this->id_field . " = '" . $this->id . "'"; $get_rfid_qry = $this->conn->query($get_rfid); if ($get_rfid_qry->num_rows > 0) { while ($rfid = $get_rfid_qry->fetch_assoc()) { if ($rfid['bookID'] == 0) { $res[] = array($rfid['RFID']); } else { require ROOT . 'admin/list.class.php'; $list = new Lists("shelves"); $res[] = array($rfid['RFID'], $list->getShelfName($rfid['_shelfID']), $rfid['_shelfID']); } } } return $res; }