-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproduct_favs.php
executable file
·223 lines (186 loc) · 8.21 KB
/
product_favs.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
error_reporting( ~E_NOTICE ); // avoid notice
session_start();
require_once 'class.farmer.php';
require_once 'consultants/class.consultant.php';
$farmer_home = new FARMER();
if($farmer_home->is_logged_in()){
$stmt = $farmer_home->runQuery("SELECT * FROM tbl_farmers WHERE email=:email_id");
$stmt->execute(array(":email_id"=>$_SESSION['farmerSession']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row['photo']=="") {
$pic = "<img class='img-circle ' src='img/user.png' style='' height=50px width=50px />";
}
}
$farmer_home_post = new Database();
if($farmer_home_post->dbConnection())
{
include_once 'class.profav.php';
$paginate = new paginate();
}
$admin_home = new CONSULTANT();
if($admin_home->is_logged_in()){
$stmt = $admin_home->runQuery("SELECT * FROM tbl_consultants WHERE email=:email_id");
$stmt->execute(array(":email_id"=>$_SESSION['consultantSession']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row['photo']=="") {
$pic = "<img class='img-circle ' src='img/user.png' style='' height=50px width=50px />";
}
}
if(!$farmer_home->is_logged_in() AND !$admin_home->is_logged_in() )
{
$_SESSION['redirect_url'] = $_SERVER['PHP_SELF'];
$farmer_home->redirect('index');
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="#SSS" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="font/css/font-awesome.css" rel="stylesheet" />
<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300' rel='stylesheet' type='text/css'>
<!-- <link rel="shortcut icon" href="images/asawa.jpg"> -->
<title>Farmer | Home</title>
</head>
<body>
<section>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index">FarmBase</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index">Home</a></li>
<li ><a href="blog">Blog</a></li>
<!-- <li><a href="#">Tenders</a></li> -->
<li><a href="about">About Farmbase</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
if($farmer_home->is_logged_in()) {
?>
<li id="header_inbox_bar" class="dropdown">
<!-- messages in inbox here -->
</li>
<!-- inbox dropdown end -->
<li><a href="farmer_post"><span class="glyphicon glyphicon"></span> Post Produce Ad</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<?php
if(isset($pic)){
echo $pic;
} else { ?>
<img class="img-circle " src="farmer_images/<?php echo $row['photo']; ?>" style=" padding:0px;" height=50px />
<?php
}?>
<span class=""></span> <?php echo $row['name']; ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="farmer_profile"><span class="glyphicon glyphicon-user"></span> Edit Profile</a></li>
<li class="active"><a href="message_favs"><span class="glyphicon glyphicon-star"></span> Favourites</a></li>
<li><a href="logout"><span class="glyphicon glyphicon-log-out"></span> Sign Out</a></li>
</ul>
</li><?php } ?>
<?php if(!$farmer_home->is_logged_in() AND !$admin_home->is_logged_in() ) {
?>
<li><a href="farmer_signin" title="login">Login</a></li> <?php }
?>
<?php
if($admin_home->is_logged_in() ) {
?>
<li id="header_inbox" class="dropdown">
<!-- messages in inbox here -->
</li>
<!-- inbox dropdown end -->
<li><a href="consultants/home"><span class="glyphicon glyphicon"></span> Post Message</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<?php
if(isset($pic)){
echo $pic;
} else { ?>
<img class="img-circle " src="consultants/consult_images/<?php echo $row['photo']; ?>" style=" padding:0px;" height=50px />
<?php
}?>
<span class=""></span> <?php echo $row['email']; ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="consultants/consultant_profile"><span class="glyphicon glyphicon-user"></span> Edit Profile</a></li>
<li><a href="consultants/logout"><span class="glyphicon glyphicon-log-out"></span> Sign Out</a></li>
</ul>
</li><?php } ?>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="clearfix"></div>
<div class="col-lg-2 col-lg-offset-5">
<br style="margin: 30px;">
</div>
<section>
<div class="container" id="panel_post">
<div class="how-works-area col-md-12">
<div class="how-works">
<h3 class="h3 favis">Favourites</h3>
<span class="pull-left">
<a href="message_favs" class="btn btn-default"> Blog Posts</a>
<a href="product_favs" class="btn btn-primary">Products</a>
</span>
<!-- <div class="col-md-3 card">
<ul class="nav nav-tabs " id="myTab">
<li class="active"><a href="#feeds" data-toggle="tab">Feeds, Suppliments and Seeds</a></li>
<li><a href="#tools" data-toggle="tab">Farm Machinery and Tools</a></li>
<li><a href="#livestock" data-toggle="tab">Livestock, Poultry and Fish</a></li>
<li><a href="#farm" data-toggle="tab">Farm Produce</a></li>
</ul>
</div> -->
<!-- Tab panes -->
<div class="tab-content clearfix col-md-10 col-md-offset-1 ">
<div class="tab-pane fade in active" id="feeds">
<div class="col-md-12 row-eq-height">
<?php
$stmt = $farmer_home->runQuery("SELECT * FROM product_fav WHERE favourite = 1 AND email=:email_id");
$stmt->execute(array(":email_id"=>$row['email']));
while($list = $stmt->fetch(PDO::FETCH_ASSOC)){
$query = "SELECT * FROM farmer_posts WHERE ID = '$list[postID]' ORDER BY timer DESC";
$records_per_page=6;
$newquery = $paginate->paging($query,$records_per_page);
$paginate->dataview($newquery);
}
?>
<div class=" col-md-10 col-xs-12 col-md-offset-1">
<ul class="pagination">
<?php
$paginate->paginglink($query,$records_per_page);
?>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
//footer
include 'footer.php';
?>
</body>
<script type="text/javascript" src="js/jquery2.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- <script type="text/javascript" src="js/main.js"></script> -->
<script type="text/javascript" src="js/jquery.validate.min.js" ></script>
<script type="text/javascript" src="js/validation.min.js"></script>
<script type="text/javascript" src="js/register.js"></script>
<script type="text/javascript" src="js/notifications.js"> </script>
</html>