for ($i = ($page - 1) * BOOKSPERPAGE; $i < $page * BOOKSPERPAGE && $i < count($results); $i++) { $ref = bookIdToRef($results[$i]['BookId'], $dbconn); $des = substr($results[$i]["Description"], 0, 50); echo ' <div class="col-lg-4"> <div class="thumbnail"> <img src="core/getTextbookImage.php?ref=' . $ref . '" alt="Book" width="100px" height="100px"> <div class="caption"> <h3>' . $results[$i]['Title'] . '</h3> <p>' . $des . '</p> <p><a href="' . buildTextbookLink($ref, "singlebook.php") . '" class="btn btn-primary" role="button">View!</a><h4><p>' . $categories[$results[$i]['CategoryId']]['CategoryName'] . '</p></h4></p> <!-- href button to individual book page--> </div> </div> </div>'; } echo ' </div> </div> <footer class ="footer"> <ul class="pager">'; if ($page > 1) {
} elseif ($result[$i]['State'] != 'Hidden') { $action = generateLink("UnBorrow", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=unborrow"); } } elseif ($result[$i]['Category'] == "Swap") { if ($result[$i]['State'] == "Active") { $action = generateLink("Swaped", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=swapped"); } elseif ($result[$i]['State'] != 'Hidden') { $action = generateLink("UnSwap", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=unswap"); } } elseif ($result[$i]['Category'] == "Sale") { if ($result[$i]['State'] == "Active") { $action = generateLink("Sold", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=sold"); } elseif ($result[$i]['State'] != 'Hidden') { $action = generateLink("UnSell", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=unsell"); } } if ($result[$i]['State'] == "Active") { $hide = generateLink("Hide", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=hide"); } elseif ($result[$i]['State'] == "Hidden") { $hide = generateLink("Activate", buildTextbookLink($result[$i]['Id'], "core/updateState.php") . "&action=active"); } else { $hide = ""; } echo '<tr><td>' . $result[$i]['Id'] . '</td><td>' . $result[$i]['Title'] . '</td><td>' . $result[$i]['ISBN'] . '</td><td>' . $result[$i]['Subject'] . '</td><td>' . $result[$i]['Edition'] . '</td><td>' . $result[$i]['Cond'] . '</td><td>' . $result[$i]['Category'] . '</td><td>' . $result[$i]['State'] . '</td> <td>' . $view . ' ' . $remove . ' <br></br> ' . $action . ' ' . $hide . '</td></tr>'; } ?> </tr> </table> </body> </html>
$remove = generateLink("Remove", buildTextbookLink($bookRef, "core/remove.php")); $action = ''; //Chooses what action to display and links them correctly if ($result[$i]['CategoryId'] == "2") { if ($result[$i]['State'] == "Active") { $action = generateLink("Borrowed", buildTextbookLink($bookRef, "core/updateState.php") . "&action=borrowed"); } elseif ($result[$i]['State'] != 'Hidden') { $action = generateLink("UnBorrow", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unborrow"); } } elseif ($result[$i]['CategoryId'] == "1") { if ($result[$i]['State'] == "Active") { $action = generateLink("Swaped", buildTextbookLink($bookRef, "core/updateState.php") . "&action=swapped"); } elseif ($result[$i]['State'] != 'Hidden') { $action = generateLink("UnSwap", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unswap"); } } elseif ($result[$i]['CategoryId'] == "0") { if ($result[$i]['State'] == "Active") { $action = generateLink("Sold", buildTextbookLink($bookRef, "core/updateState.php") . "&action=sold"); } elseif ($result[$i]['State'] != 'Hidden') { $action = generateLink("UnSell", buildTextbookLink($bookRef, "core/updateState.php") . "&action=unsell"); } } if ($result[$i]['State'] == "Active") { $hide = generateLink("Hide", buildTextbookLink($bookRef, "core/updateState.php") . "&action=hide"); } elseif ($result[$i]['State'] == "Hidden") { $hide = generateLink("Activate", buildTextbookLink($bookRef, "core/updateState.php") . "&action=active"); } else { $hide = ""; } echo '<tr><td>' . $bookRef . '</td><td>' . $result[$i]['Title'] . '</td><td>' . $result[$i]['ISBN'] . '</td><td>' . $result[$i]['Subject'] . '</td><td>' . $result[$i]['Edition'] . '</td><td>' . $conditions[$result[$i]['CondId']]['Condname'] . '</td><td>' . $categories[$result[$i]['CategoryId']]['CategoryName'] . '</td><td>' . $result[$i]['State'] . '</td><td>' . $view . ' ' . $remove . ' ' . $action . ' ' . $hide . '</td></tr>'; }