public function actionBook() { $model = new Books(); $book = $model->getBookByID($_GET['id']); $this->render('book', array('book' => $book)); }
$book['publisher'] = $_POST['publisher']; $book['published_year'] = $_POST['published_year']; $book['subjects'] = $_POST['subjects']; $book['lang'] = $_POST['lang']; $book['series'] = $_POST['series']; $book['pages'] = $_POST['pages']; $bks->updateBook($book); } } // DELETE Book if(isset($_POST['BtnDeleteBook'])){ $bid = $_POST['bid']; $book = $bks->getBookByID($bid); $bks->deleteBook($book); } // Update book ///////////////////////////////////////////////////// if(isset($_POST['BtnUpdateBook'])){ $book['bid'] = $_POST['bid']; $book['isbn'] = $_POST['isbn']; $book['class'] = $_POST['class']; $book['location'] = $_POST['location']; $book['title'] = $_POST['title']; $book['authors'] = $_POST['authors']; $book['edition'] = $_POST['edition']; $book['publisher'] = $_POST['publisher']; $book['published_year'] = $_POST['published_year']; $book['subjects'] = $_POST['subjects'];
$msg = "The barcode must start with the letter 'A'<hr>" . $bks->toStringCopy($copy) . '<hr>' . "<a href='book_copy_edit.php?ID=$cid'>Edit This Copy Again</a> | <a href='book_edit.php?ID=$bid'>Edit the Associated Book</a> | <a href='book_search.php'>Browse Books</a>"; $title = 'No Changes Made'; displayMsg($msg, $title); } $bks->changeBarcode($copy, $barcode1); } /// Get copy details into $row2 //////////////////////////////////////////// $id = $_REQUEST['ID']; $row2 = $bks->getCopyByID($id); /// Get book details into $row //////////////////////////////////////////// $row = $bks->getBookByID($row2['bid']); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>ULMS: Update Copy</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css/styles.css" rel="stylesheet" type="text/css"> <script language="JavaScript" src="js/gen_validatorv2.js" type="text/javascript"></script> </head> <body> <?php include("../inc/top.php"); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="margin"><table width="100%" border="0">
function CancelReservation($rid){ // returns a status message $sql = sprintf("UPDATE reservation SET status='Cancelled' WHERE rid=%d",$rid); $a = executeSqlNonQuery($sql); $rows_updated = $a['rows']; if($rows_updated != 1){ return "ERROR: couldn't cancel reservation"; } else{ // Cancelled, update other reservations $reservation = $this->GetByID($rid); require_once('Members.php'); $clsM = new Members; $rowMember = $clsM->getByID($reservation['mid']); require_once('Books.php'); $clsB = new Books; $rowBook = $clsB->getBookByID($reservation['bid']); $des = '[' . $rowBook['title'] . ' by ' . $rowBook['authors'] . ']' . ' <== [' . $rowMember['mid'] . '] ' . $rowMember['title'] . ' ' . $rowMember['firstnames'] . ' ' . $rowMember['surname']; logEvent('RESERVATION_CANCELLED', $_SESSION['CurrentUser']['mid'], $rowMember['mid'], addslashes($des)); $sql = "SELECT * FROM reservation WHERE rid=" . $rid; $rs = executeSqlQuery($sql); $r = mysql_fetch_assoc($rs); $cid = $r['cid']; if($cid>0){ $sql = sprintf("select c.*, b.* FROM (copy c LEFT JOIN book b ON c.bid = b.bid) WHERE c.cid=%d", $cid); $rs = executeSqlQuery($sql); $rowCopy = mysql_fetch_assoc($rs); return $this->updateReservations($rowCopy); } return "Reservation cancelled"; } }