forked from sarahdoi/Oun-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckbsreview.php
209 lines (152 loc) · 5.34 KB
/
checkbsreview.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
<?php
session_start();
include("connection.php");
include("functions.php");
$user_data = check_loginParent($con);
$parentId= $user_data['parent_id'];
$parentName= $user_data['name'];
$BabytId=$_GET['national_ID'];
/*function getBookings(){
global $con;
$query = "SELECT bookings.booking_id, bookings.review , bookings.rating , request.* , offer.offer_id , offer.babysitter_id , offer.price , offer.status
FROM bookings
INNER JOIN request ON request.request_id = bookings.request_id
INNER JOIN offer ON request.request_id = offer.request_id";
return mysqli_query( $con , $query);
} */
//change it to PrevgetPrevBookings()
//$booking = getPrevBookingsforID();
//babysitter_id
?>
<!DOCTYPE html>
<html>
<head>
<title> <?php ?> Reviews </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="imaages/png" href="images/logo.png" >
<!--import google fonts & stars-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="styleB.css" >
<link rel="stylesheet" href="footer.css" >
<link rel="stylesheet" href="myReviews.css">
</head>
<body>
<!-- HEADER CODE -->
<header>
<a href="#" class="logo"><img src="images/logo.png" alt="logo icon"></a>
<nav class="navbar">
<ul>
<li> <a onclick="window.history.back()" style="pointer:cursor;"> < Back </a> </li>
<li><a href="mprofile.html"> Home </a></li>
<li> <a href="ViewOffer.html"> Bookings </a>
<li> <a href="#"> Settings </a>
<ul class="inner">
<li class="first"><a href="parentprofile.html"> view profile</a></li>
<li><a href="signout.php"> Sign out </a></li>
</ul>
</li>
</ul>
</nav>
</header>
<!-- FOOTER CODE -->
<footer class="footer-distributed">
<div class="footer-left">
<img class="logo" src="images/logo.png" alt="Oun">
<p class="footer-links">
<a href="currentBaby.html" class="link-1">Home</a>
<!--<a href="#">About</a>-->
<a href="mailto:support@Ouun.com">Contact</a>
</p>
<p class="footer-company-name">Oun © 2022</p>
</div>
<div class="footer-center">
<div>
<i class="fa fa-map-marker"></i>
<p><span>12534 AlOlaya st.</span> Riyadh , Saudi Arabia</p>
</div>
<div>
<i class="fa fa-phone"></i>
<p>+9669200000834</p>
</div>
<div>
<i class="fa fa-envelope"></i>
<p><a href="mailto:support@Ouun.com">support@Oun.com</a></p>
</div>
</div>
<div class="footer-right">
<p class="footer-company-about">
<span>About us</span>
Oun is an online platform that helps mothers find babysitters anytime and anywhere.
</p>
</div>
</footer>
<!-- STARS RATING CODE
<h1 class="mytitle"> My rating </h1>
<div class = "stars">
<center>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star"></span>
</center>
</div>
-->
<?php $bookings = getPrevBookingsforID($BabytId);
/*$query = "SELECT parent.parent_id , parent_image , parent.name
FROM offer
INNER JOIN babysitter ON babysitter.national_id = offer.babysitter_id
INNER JOIN request ON offer.request_id = request.request_id
INNER JOIN parent ON request.parent_id = parent.parent_id
WHERE "
$parentInfo = mysqli_query( $con , $query); */
if ( mysqli_num_rows($bookings) > 0 ) {
$count=0;
$tot_rating=0;
$ave_rating=0;
$num =mysqli_num_rows($bookings);
if ( mysqli_num_rows($bookings) > 0 ) {
foreach( $bookings as $element ) {
$tot_rating += $element['rating'] ;
$count++;
}}
$ave_rating = $tot_rating / $num;
echo "<h1 class='mytitle'> My Rating <br>".$ave_rating."/5 </h1>" ;
} else{
echo "<h1 class='mytitle'> My Rating </h1> <br> <h2 style='text-align:center' > No rating yet </h2> " ;
}?>
<h1 class="mytitle2"> My Reviews </h1>
<div>
<?php
$bookings = getPrevBookingsforID($BabytId);
/*$query = "SELECT parent.parent_id , parent_image , parent.name
FROM offer
INNER JOIN babysitter ON babysitter.national_id = offer.babysitter_id
INNER JOIN request ON offer.request_id = request.request_id
INNER JOIN parent ON request.parent_id = parent.parent_id
WHERE "
$parentInfo = mysqli_query( $con , $query); */
///echo "average =". $ave_rating ;
if ( mysqli_num_rows($bookings) > 0 ) {
foreach( $bookings as $element ) {
echo "<div>
<figure class='review'>
<blockquote>". $element['review']."</blockquote>
<div class='author'>
<img src='images/". $element['parent_image']."' alt='sq-sample1'/>
<br>
<h4>". $element['name'] ."</h4>
</div>
</figure>
</div>"
?>
<?php }
}
else {
echo "<h2> There are no reviews yet </h2>";
}
?>
</div>
</body>
</html>