/
product.php
198 lines (159 loc) · 8.48 KB
/
product.php
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
/**
* Created by PhpStorm.
* User: Garrett
* Date: 3/7/2015
* Time: 00:14
*/
require_once("classes/Donorbid.php");
$id = $_GET['id'];
$product = $db -> getProduct($id);
if(is_null($product)){
$product = new Item();
}
if(is_null($product -> getSeller())){
$product -> seller = new User();
}
$charity = $db -> getCharity($product -> getCharity());
if(is_null($charity)){
$charity = new Charity();
}
$seller = $product -> getSeller();
if(is_null($seller)){
$seller = new User();
}
//Error here... these aren't able to get charities from seller for some reason....
//$top_charity1 = $db -> $seller -> getCharities()[0];
//$top_charity2 = $db -> $seller -> getCharities()[1];
//$top_charity3 = $db -> $seller -> getCharities()[2];
//temp
$top_charity1 = new Charity();
$top_charity2 = new Charity();
$top_charity3 = new Charity();
if(is_null($top_charity1)){
$top_charity1 = new Charity();
$top_charity1 -> name = "";
}
if(is_null($top_charity2)){
$top_charity2 = new Charity();
$top_charity2 -> name = "";
}
if(is_null($top_charity3)){
$top_charity3 = new Charity();
$top_charity3 -> name = "";
}
?>
<!DOCTYPE HTML>
<HTML>
<HEAD>
<title>DonorBid.com</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="sweetalert/dist/sweetalert.css">
<script type="text/javascript" src="sweetalert/dist/sweetalert.min.js"></script>
<link rel="stylesheet" href="css/donorbid.css">
<script type="text/javascript" src="js/userFunctions.js"></script>
<script type="text/javascript" src="js/product.js"></script>
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
</HEAD>
<BODY>
<?php require("dry/header.php"); ?>
<div id="search_content">
<div class="row">
<div id="causes" class="col-lg-2">
<!-- Causes/Items Here -->
<h3 style="text-align:center;margin-top:0;text-decoration:underline;">Causes</h3>
<ul style="margin-left:-1em;">
<li><a href="#">Hunger <span style="font-size:.8em;" class="glyphicon glyphicon-play" aria-hidden="true"></span></a></li>
<li><ul style="margin-left:-1.5em;">
<li><a href="#">Feeding America</a></li>
<li><a href="#">Freestore Foodbank</a></li>
<li><a href="#">Shared Harvest Foodbank</a></li>
</ul></li>
<li><a href="#">Environment <span style="font-size:.8em;" class="glyphicon glyphicon-play" aria-hidden="true"></span></a></li>
<li><ul style="margin-left:-1.5em;">
<li><a href="#">Sierra Club</a></li>
<li><a href="#">GreenPeace</a></li>
<li><a href="#">Wildlife Conservation Society</a></li>
</ul></li>
<li><a href="#">Animal Welfare <span style="font-size:.8em;" class="glyphicon glyphicon-play" aria-hidden="true"></span></a></li>
<li><ul style="margin-left:-1.5em;">
<li><a href="#">USPCA</a></li>
<li><a href="#">Cincinnati Zoo</a></li>
<li><a href="#">Save the Animals Foundation</a></li>
</ul></li>
</ul>
</div>
<div class="col-lg-10">
<div class="row" style="margin-left:2em;margin-top:3em;">
<div class="col-lg-4" id="product">
<div style="text-align:center;">
<img style="width:350px;height:250px;" src="<?php echo $product -> getImage();?>" alt="Donate_Image"/>
<span style="font-size:1.5em;display:block;"><?php echo $product -> getName();?></span>
<span style="display:block;">Current Bidding Price: $<span style="color:red;"><?php echo $product -> amt;?></span></span>
<span style="display:block;"><?php echo $product -> getShortDesc(); ?></span>
<span style="font-weight:bold;font-size:1.2em;">Benefits: <a href="viewcharity.php?id=<?php echo $charity -> getId();?>"><?php echo $charity -> getName(); ?></a></span>
</div>
</div>
<div class="col-lg-7" style="margin-left:6em;">
<div class="row">
<div id="user_descrip" style=float:left;">
<div style="text-align:center;">
<div id="img_round" >
<a href="profile.php?id=<?php echo $seller -> getId();?>"><img width="100px" height="100px" src="<?php echo $seller -> getImage(); ?>"/></a>
<br/>
<span style="text-align:center;margin-left:-1.5em;">
<span id="username"><a href="profile.php?id=<?php echo $seller -> getId(); ?>"><?php echo $seller -> getUsername(); ?></a></span>
</span>
</div>
</div>
</div>
<div style="margin-top:.5em;float:left;margin-left:2em;">
<span style="font-size:1.5em;font-weight:bold;margin-left:-1em;">I Support...</span>
<ul style="display:inline;margin-left:-.5em;margin-top:-1em;">
<li style="margin-bottom:.5em;"><a href="viewcharity.php?id=<?php echo $top_charity1 -> getId();?>"><?php echo $top_charity1 -> getName(); ?></a></li>
<li style="margin-bottom:.5em;"><a href="viewcharity.php?id=<?php echo $top_charity2 -> getId();?>"><?php echo $top_charity2 -> getName(); ?></a></li>
<li><a href="viewcharity.php?id=<?php echo $top_charity3 -> getId();?>"><?php echo $top_charity3 -> getName(); ?></a></li>
</ul>
</div>
</div>
<div class="row">
<div id="non_profit_descrip">
<span style="display:block;font-size:2em;"><?php echo $charity -> getName();?></span>
<p><a href='viewcharity.php?id=<?php echo $charity -> getId();?>'><?php echo $charity -> getName()?></a>: <?php echo $charity -> getDesc(); ?></p>
<div class="input-group" id="pay" style="max-width:150px;">
<input id="donate_amt" type="text" class="form-control" placeholder="$0.00" min="<?php echo $product -> getAmt(); ?>">
<div class="input-group-btn">
<button id="bid_button" type="button" class="btn btn-large btn-primary">Bid!</button>
</div>
</div>
</div>
</div>
</div>
</div>
<hr/>
<div id="product_description">
<h3>Description</h3>
<p><?php echo $product -> getLongDesc(); ?></p>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#bid_button").click(function(){
var price = $("#donate_amt").val();
swal({ title: "Are you sure?", text: "Are you sure you want to bid on this for $" + price + "?", type: "warning", showCancelButton: true,
confirmButtonColor: "#AEDEF4", confirmButtonText: "Yes, buy it!", closeOnConfirm: false },
function(){ swal("Purchased!", "You will now be redirected!", "success");
window.location.href = "winner.php?id=<?php echo $id;?>&amt=" + price;
});
});
});
</script>
</BODY>
</HTML>