-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbookListings.php
More file actions
125 lines (121 loc) · 5.69 KB
/
bookListings.php
File metadata and controls
125 lines (121 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
require_once("resources/functions/dbconnection.function.php");
require_once("resources/functions/bookListings/bookListingsArray.class.php");
$isbn ="";
if (empty($_GET["isbn"]) || !is_numeric($_GET["isbn"])) {
die("Error: invalid isbn.");
}
$isbn = $_GET["isbn"];
$book = dbconnection("spSelectSingleBook( \"{$isbn}\")");
if (count($book) != 1) {
die("Error: invalid isbn.");
}
$book = $book[0];
$array = new bookListingsArray($isbn);
?>
<!doctype html>
<html lang="en">
<head>
<title>Book Listings</title>
<?php include("resources/includes/head.inc.php"); ?>
<script src="resources/js/listingsFilter.js"></script>
</head>
<body>
<?php include("resources/includes/header.inc.php"); ?>
<main class= "container mt-4">
<div class="row">
<div class="col">
<h1 class="mt-2"><?php echo $book['title'];?></h1>
<h2>Author</h2>
<h4><?php echo $book['author'];?></h4>
<h2>ISBN</h2>
<h4><?php echo $book['isbn'];?></h4>
<h2>Edition</h2>
<h4><?php echo $book['edition'];?></h4>
<?php if (isset($_SESSION['user']['email'])) {?>
<a role="button" href="postABook.php?title=<?php echo $book['title'];?>&author=<?php echo $book['author'];?>&isbn=<?php echo $book['isbn'];?>&edition=<?php echo $book['edition'];?>" class="btn bg-orange">Sell Book</a>
<?php }else{?>
<button class="btn bg-orange disabled">Log In</button>
<?php }?>
</div>
</div>
<div class="row mt-4">
<div class="col-sm-3 mb-4">
<form>
<h2>Filters</h2>
<h4>Show Condition</h4>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="conditionMint" checked>
<label class="form-check-label" for="conditionMint">
Mint
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="conditionGood" checked>
<label class="form-check-label" for="conditionGood">
Good
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="conditionFair" checked>
<label class="form-check-label" for="conditionFair">
Fair
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="conditionBad" checked>
<label class="form-check-label" for="conditionBad">
Bad
</label>
</div>
<h4>Price</h4>
<div class="form-row">
<div class="col">
<input class="form-control" type="number" id="minPrice" min="0" value="0">
</div>
<div class="col-auto">
to
</div>
<div class="col">
<input class="form-control" type="number" id="maxPrice" min="0" value="1000">
</div>
</div>
<h4>Sort by</h4>
<div class="form-check">
<input class="form-check-input" name="sortPrice" type="radio" id="sortPriceLowHigh" checked>
<label class="form-check-label" for="sortPriceLowHigh">
Price (lowest)
</label>
</div>
<div class="form-check">
<input class="form-check-input" name="sortPrice" type="radio" id="sortPriceHighLow">
<label class="form-check-label" for="sortPriceHighLow">
Price (highest)
</label>
</div>
</form>
</div>
<div class="col mb-4">
<h4><?php echo $array->getCount();?> Listings Found ($<?php echo $array->getMinPrice();?> - $<?php echo $array->getMaxPrice();?>)</h4>
<table class="table table-hover border">
<thead class="bg-blue text-light">
<tr>
<th scope="col">Seller</th>
<th scope="col">Condition</th>
<th scope="col">List Date</th>
<th scope="col">Price</th>
<th scope="col">View Listing</th>
</tr>
</thead>
<tbody>
<?php
$array->print();
?>
</tbody>
</table>
</div>
</div>
</main>
<?php include('resources/includes/footer.inc.php'); ?>
</body>
</html>