-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·83 lines (79 loc) · 3.51 KB
/
index.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
<?php
require_once 'config.php';
require_once UTILS.'DbManager.php';
require_once UTILS.'functions.php';
require_once UTILS.'queries.php';
session_start();
?>
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/navbar.css">
<link rel="stylesheet" href="css/form.css">
<title>Cinemino</title>
</head>
<body>
<?php
include "php/navbar.php";
?>
<section class="movies">
<div class="movie-grid">
<?php
$movies = get_onair();
while($row = $movies->fetch_assoc()) {
$screenings = get_screenings_by_movie($row['id']);
?>
<div class="movie-item">
<div class="image-box">
<img src="<?php echo get_movie_cover($row['cover'])?>" alt="movie-poster">
</div>
<div class="descr-box">
<h2><?php echo $row['title'] ?></h2>
<p class="movie-genre"><?php echo $row['genre'] ?></p>
<hr class="movie-line">
<p class="movie-descr"><?php echo $row['description'] ?></p>
<form action="user/selection.php" method="post">
<div class="screenings">
<table>
<?php
$data = [];
while ($row = $screenings->fetch_assoc()) {
$day = date('Y-m-d', strtotime($row['screening_start']));
$time = date('H:i', strtotime($row['screening_start']));
$data[$day][$time][] = $row['id'];
}
foreach ($data as $day => $times) {
$date = date('l, j', strtotime($day));
?>
<tr>
<td><?php echo $date ?></td>
<?php foreach ($times as $time => $id) { ?>
<td>
<?php foreach ($id as $id) { ?>
<button type="submit" name="selected_screening" value="<?php echo $id ?>">
<?php }
echo $time ?></button>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
</div>
</form>
</div>
</div>
<?php
}
?>
</div>
</section>
</body>
</html>