-
Notifications
You must be signed in to change notification settings - Fork 0
/
cereri.php
167 lines (157 loc) · 6.33 KB
/
cereri.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
<?php
require 'core/init.php';
$general->logged_out_protect();
$user = $users->userdata($_SESSION['id']);
$username = $user['username'];
$company = $user['company'];
$contact = $user['contact'];
$telephone = $user['telephone'];
$code = $user['code'];
$cereri = $requests->get_requests($_SESSION['id'],$user['stat']);
$cereri_count = count($cereri);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bursa energiei</title>
<link href="assets/css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
</head>
<body>
<div id="top_bar">
<div class="wrapper">
<?php include("assets/includes/top_bar_nav.php"); ?>
<?php include("assets/includes/social_sprites.php"); ?>
</div>
</div>
<div id="header">
<div class="wrapper">
<?php include("assets/includes/header.php"); ?>
</div>
</div>
<div id="navigation_bar">
<div class="wrapper">
<?php include("assets/includes/navigation_bar.php"); ?>
</div>
</div>
<div class="dotted_separator"></div>
<div id="main">
<div class="wrapper">
<div id="sidebar">
<div id="account">
<h3 class="align-center">Contul meu</h3>
<?php
if(isset($_SESSION['id'])){
$stat = $user['stat'];
if($stat == 0){include("assets/includes/user_menu.php");}
if($stat == 1){include("assets/includes/furnizor_menu.php");}
if($stat == 9){include("assets/includes/admin_menu.php");}
}
?>
</div>
<div>
<?php include("assets/includes/facebook_plugin.php"); ?>
</div>
</div>
<!-- CONTENT BEGIN -->
<div id="content">
<h3>Cereri de oferte</h3>
<div class="span-23 span-container">
<h4>Filtrare cereri:</h4>
<form method="post" action="">
Consum mediu anual minim:<br />
<input type="text" name="cmin" value="<?php if(isset($_POST['cmin'])) echo htmlentities($_POST['cmin']); ?>" />
<input class="button" type="submit" name="submit" value="Cauta!"/>
</form>
<p>Dati click pe cerere pentru mai multe detalii.</p>
<table id="cereri">
<thead>
<tr class="align-center">
<th>Id</th>
<th>Nume solicitant</th>
<th>Nume societate</th>
<th>Consum mediu anual</th>
<th>Tensiune de alimentare</th>
<th>Data transmiterii</th>
<th>Oferte primite</th>
</tr>
</thead>
<tbody>
<?php
foreach ($cereri as $cerere) {
if(isset($_POST['cmin'])){
if($_POST['cmin'] > $cerere['consum_total_anual']){ continue; }
}
$user_req = $users->userdata($cerere['user_id']);
$oferte = $db->prepare("SELECT * FROM `offers` WHERE `request_id`= ?");
$oferte->bindValue(1, $cerere['id']);
$oferte->execute();
$oferte = $oferte->fetchAll();
$oferte_acceptate = $db->prepare("SELECT * FROM `offers` WHERE `request_id`= ? AND `status`= 1");
$oferte_acceptate->bindValue(1, $cerere['id']);
$oferte_acceptate->execute();
$oferte_acceptate = $oferte_acceptate->fetchAll();
$count_oferte_acceptate = count($oferte_acceptate);
?>
<tr class="align-center">
<td><a href="request.php?id=<?php echo $cerere['id']; ?>"><?php echo $cerere['id'];?></a></td>
<td><a href="request.php?id=<?php echo $cerere['id']; ?>"><?php echo $user_req['contact'];?></a></td>
<td><a href="request.php?id=<?php echo $cerere['id']; ?>"><?php echo $user_req['company'];?></a></td>
<td><a href="request.php?id=<?php echo $cerere['id']; ?>"><?php echo $cerere['consum_total_anual'];?> kWh</a></td>
<td><a href="request.php?id=<?php echo $cerere['id']; ?>"><?php echo $cerere['alimentare'];?> kV</a></td>
<td><a href="request.php?id=<?php echo $cerere['id']; ?>"><?php echo date('d/m/y', $cerere['time']);?></a></td>
<td><a href="request.php?id=<?php echo $cerere['id']; ?>">
<?php
if($count_oferte_acceptate > 0) { echo '<h4 class="green">OFETA ACCEPTATA</h4>'; }
else echo count($oferte);
?>
</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<!-- CONTENT END -->
<div class="clear-both"></div>
</div>
<div class="waves-graph-separator"></div>
</div>
<div id="main-second">
<div class="wrapper">
<h3 class="title">Furnizori</h3>
<div id="furnizori_container">
<?php include("assets/includes/furnizori.php"); ?>
<div class="clear-both"></div>
</div>
</div>
</div>
<div id="footer">
<div class="wrapper">
<?php include("assets/includes/footer.php"); ?>
</div>
</div>
<div id="newsletter">
<div class="wrapper">
<div class="float-left"><img src="assets/images/icons/thunderbird_icon.png" /></div>
<div class="form float-left">
<h3 class="title">Abonati-va la newsletter!</h3>
<form action="newsletter_subscribe.php" method="post">
<input class="float-left" type="text" name="email" value="Introduceti adresa de e-mail." onblur="if (this.value == '') {this.value = 'Introduceti adresa de e-mail.';}" onfocus="if (this.value == 'Introduceti adresa de e-mail.') {this.value = '';}" />
<input class="button float-left" type="submit" name="subscribe" value="Aboneaza-te!"/>
</form>
</div>
<div class="clear-both"></div>
</div>
</div>
<div id="bottom_bar">
<div class="wrapper">
<?php include("assets/includes/bottom_bar.php"); ?>
</div>
</div>
</body>
</html>