This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CustomerMovies.php
213 lines (187 loc) · 5.7 KB
/
CustomerMovies.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
<!DOCTYPE html>
<html lang="en">
<?php
session_start();
include('header.php');
$username = "";
$privilege = "";
if (isset($_SESSION["username"]))
{
$username = $_SESSION["username"];
// Use the $username variable as needed
}
if (isset($_SESSION["privilege"]))
{
$privilege = $_SESSION["privilege"];
// Use the $username variable as needed
}
?>
<nav class="navbar navbar-expand-sm">
<div class="container">
<a class="navbar-brand" href="index.php">
<h1 style="width:25px; margin-bottom: 5px"> HOTDOG CINEMAS</h1>
</a>
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link" href="Customer.php">Home</a>
</li>
 
<li class="nav-item">
<a class="nav-link active bg-danger" href="CustomerMovies.php">Movies</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Booking.php">Book a Movie</a>
</li>
 
<li class="nav-item">
<a class="nav-link" href="OrderHistory.php">My Bookings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="CustAccountDetails.php">My Account</a>
</li>
 <li class="nav-item">
<a class="nav-link" href="CustomerReview.php">Customer Review</a>
</li>
<form method = "get" class="d-flex">
<a class="btn btn-outline-danger" href="logout.php">Log Out</a>
</form>
</ul>
</div>
</nav>
<body>
<div class="container-fluid p-5 bg-danger text-white text-center">
<h1>Movies</h1>
<p>Username: <?php echo $username; ?></p>
</div>
<div class="container mt-3 center movies-container">
<div class="input-group mb-3" style="width: 40%; margin: auto;">
<span class="input-group-text" id="searchLbl">Search:</span>
<input type="text" class="form-control" id="searchBox" onkeyup="tableSearch()">
</div>
<table id="moviesTable" class="table text-white" style="margin: auto; width: 100%; table-layout: fixed">
<thead>
<tr>
<th>Movie Title</th>
<th>Movie Description</th>
<th>Genre</th>
<th>Poster</th>
</tr>
</thead>
<tbody>
<?php
$moviesDetailsCh = curl_init();
curl_setopt($moviesDetailsCh, CURLOPT_URL, "http://localhost:8000/api/customer/movie/read/active");
curl_setopt($moviesDetailsCh, CURLOPT_RETURNTRANSFER, 1);
$moviesDetails = curl_exec($moviesDetailsCh);
$moviesDetails = json_decode($moviesDetails, true);
curl_close($moviesDetailsCh);
foreach ($moviesDetails as $movie)
{
$title = $movie['title'];
$description = $movie['description'];
$genre = $movie['genre'];
$poster = $movie['imageUrl'];
$CR = $movie['contentRating'];
?>
<tr>
<td class="movie-title text-white"><?php echo $title ." (" .$CR .")"; ?></td>
<td class="movie-description text-white"><?php echo $description; ?></td>
<td class="movie-genre text-white"><?php echo $genre; ?></td>
<td>
<img class="movie-poster" src="<?php echo $poster; ?>">
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</body>
<style>
.movie-title {
font-size: 20px;
font-weight: bold;
}
.movie-description {
font-size: 18px;
font-family: "Arial", sans-serif;
color: #555555;
}
.movie-genre {
font-size: 16px;
font-family: "Arial", sans-serif;
color: #888888;
text-transform: uppercase;
}
.movie-poster {
width: 200px;
height: 300px;
}
.movie-poster-title {
font-weight: bold;
}
.fixed-forms-container {
position: fixed;
top: 16%;
left: 0;
width: 20%;
height: 100vh; /* Use 100vh for full screen height */
display: flex;
flex-direction: column;
justify-content: flex-start; /* Align forms to the top */
align-items: center;
padding: 20px;
background-color: rgba(255, 255, 255, 0);
z-index: 999;
}
.movies-container
{
margin-left: 25%;
width: 75%;
}
.navbar .nav-link
{
color: white;
}
.navbar .nav-link:hover
{
transform: scale(1.1);
}
.navbar-brand
{
font-family: Cinzel, Arial, sans-serif;
font-size: 36px;
color: #e50914;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
</style>
<script>
function tableSearch()
{
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("searchBox");
filter = input.value.toUpperCase();
table = document.getElementById("moviesTable");
tr = table.getElementsByTagName("tr"),
th = table.getElementsByTagName("th");
// Loop through all table rows, and hide those who don't match the search query
for (i = 1; i < tr.length; i++)
{
tr[i].style.display = "none";
for (var j = 0; j < th.length; j++)
{
td = tr[i].getElementsByTagName("td")[j];
if (td)
{
if (td.innerHTML.toUpperCase().indexOf(filter.toUpperCase()) > -1)
{
tr[i].style.display = "";
break;
}
}
}
}
}
</script>
<?php include('footer.php') ?>
</html>