-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
220 lines (196 loc) · 9.74 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
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
<?php
require_once('common.php');
template('header');
$events = getListOfEvents("DESC");
$count_events = count($events);
$numbers = $numberTypes[rand(0,3)];
?>
<script>
var nanobar = new Nanobar();
nanobar.go(5);
</script>
<div class="album py-5 bg-light">
<div class="container">
<?php $minutes = calculateTotalWatchtime(); ?>
<p class="display-6 text-center">"I'm not a nerd, you're a nerd."</p>
<p class="text-center mb-5">Over <?php echo number_format($minutes); ?> minutes of "entertainment." (Or <?php echo round(($minutes/60), 2);?> hours.) (Or <?php echo round(($minutes/60)/24, 2);?> days.)</p>
<div class="row g-3 mb-3">
<?php $counter_1 = 0; ?>
<?php foreach($events as $event): ?>
<?php
$eventDate = new DateTime($event['date']);
$winning_wedge = $event['winning_wedge'];
$winning_moviegoer = $event['moviegoer_'.$winning_wedge];
$counter_1++;
$total_events = count($events);
?>
<?php if(count($events) == $count_events):
?>
<script>nanobar.go(<?php echo floor(($counter_1/$total_events)*100)-1;?>);</script>
<div class=" col-lg-2">
<button id="btn-expand-all" class="btn btn-sm btn-outline-primary mb-3 col-8" onclick="$('.collapse').collapse('show'); $('#btn-expand-all').hide(); $('#btn-collapse-all').show();">
<i class="fa-solid fa-angles-down"></i> Expand ALL
</button>
<button id="btn-collapse-all" class="btn btn-sm btn-outline-primary mb-3 col-8" onclick="$('.collapse').collapse('hide'); $('#btn-expand-all').show(); $('#btn-collapse-all').hide();" style="display:none">
<i class="fa-solid fa-angles-up"></i> Collapse ALL
</button>
<a href="event_table.php" class="btn btn-sm btn-outline-dark mb-3 col-8"><i class="fa-solid fa-table"></i> Table View</a>
<a href="event_rows.php" class="btn btn-sm btn-outline-dark mb-3 col-8"><i class="fa-solid fa-images"></i> Poster View</a>
<a href="event_posters.php" class="btn btn-sm btn-outline-dark mb-3 col-8"><i class="fa-solid fa-image-portrait"></i> Winning Poster</a>
</div>
<div class="card col-lg-8 p-0" >
<div class="card-header pt-2 pb-1 text-center text-white lead" style="background-color:#<?php echo getMoviegoerColorById($winning_moviegoer); ?>">
<h3>Event <?php echo displayNumbers($count_events--, $numbers);?></h3>
<small><em><?php echo $eventDate->format('l, F j, Y'); ?></em></small>
</div>
<div class="row g-0">
<div class="col-md-5">
<div class="card-body text-center justify-content-center">
<img src="<?php echo get_movie_poster($pdo, $event['winning_film']); ?>" class="img-fluid poster" alt="winning movie poster">
</div>
</div>
<div class="col-md-7">
<div class="card-body">
<table class="table homepage">
<tbody>
<?php
$movie_freshness = Array();
$movie_years = Array();
for($i = 1; $i <= 12; $i++):
?>
<?php $movie_years[] = get_movie_year($pdo,$event['wheel_'.$i]); ?>
<?php if($event['winning_wedge'] == $i): ?>
<tr class="bold text-white homepage" style="background-color:#<?php echo getMoviegoerColorById($winning_moviegoer); ?>">
<?php else: ?>
<tr class="homepage">
<?php endif; ?>
<td class="number homepage"><?php echo $i; ?></td>
<td class="viewer-name text-center homepage" ><?php echo getMoviegoerById($event['moviegoer_'.$i]); ?></td>
<td class="movie-title homepage"><?php echo get_movie_by_id($pdo,$event['wheel_'.$i]); ?></td>
<?php if($event['wheel_'.$i] != 0):
?>
<td class="homepage"><?php $movie_freshness[] = get_movie_avg_rating($pdo, $event['wheel_'.$i]);?></td>
<?php else: ?>
<td class="homepage"></td>
<?php endif; ?>
</tr>
<?php endfor;?>
</tbody>
</table>
</div>
</div>
<p class="text-center">
<a data-bs-toggle="collapse" href="#collapseExample_<?php echo $count_events; ?>" aria-expanded="false" aria-controls="collapseExample_<?php echo $count_events; ?>">
More Details...
</a>
</p>
<div class="collapse" id="collapseExample_<?php echo $count_events; ?>">
<div class="row justify-content-center">
<div class="card col-6 m-3 p-3">
<div class="card-body ">
<?php
$movie_years = array_filter($movie_years);
$attendees = explode(",", $event['attendees']);
$viewers = Array();
foreach($attendees as $person){
$viewers[] = getMoviegoerById($person);
}
?>
<ul>
<li><strong>Attendees:</strong> <?php echo implode(", ", $viewers);?>
<li><strong>Scribe:</strong> <?php echo getViewerName($event['scribe']); ?></li>
<li><strong>Spinner:</strong> <?php echo getViewerName($event['spinner']); ?></li>
<li><strong>Bad Spin #s:</strong> <?php echo $event['error_spin']; ?></li>
<li><strong>Theme/Comment:</strong> <?php echo $event['theme']; ?></li>
<li><strong>Movie Format:</strong> <?php echo $event['format']; ?></li>
<li><strong>Selection Tool:</strong> <?php echo $event['selection_method']; ?></li>
<li><strong>Runtime:</strong> <?php echo $event['runtime']; ?> minutes</li>
<li><strong>MPAA:</strong> <?php echo get_MPAA($pdo, $event['winning_film']); ?></li>
<li><strong>Collective Movie Score:</strong> <?php echo get_freshness($movie_freshness); ?>%</li>
<li><strong>Winning Movie Score:</strong> <?php echo get_movie_avg_rating($pdo, $event['winning_film']); ?></li>
<li><strong>Average Movie Year:</strong> <?php echo round(array_sum($movie_years)/count($movie_years)); ?></li>
<li><strong>Winning Movie Year:</strong> <?php echo get_movie_year($pdo,$event['winning_film']);?></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row g-3">
<?php else:?>
<div class="col-12 col-sm-12 col-md-6 col-lg-4 col-lx-4 col-xxl-4">
<div class="card">
<div class="card-header pt-2 pb-1 text-center text-white lead" style="background-color:#<?php echo getMoviegoerColorById($winning_moviegoer); ?>">
<h3>Event <?php echo displayNumbers($count_events--, $numbers);?></h3>
<small><em><?php echo $eventDate->format('l, F j, Y'); ?></em></small>
</div>
<div class="card-body">
<table class="table homepage">
<tbody>
<?php
$movie_freshness = Array();
$movie_years = Array();
for($i = 1; $i <= 12; $i++):
?>
<?php $movie_years[] = get_movie_year($pdo,$event['wheel_'.$i]); ?>
<?php if($event['winning_wedge'] == $i): ?>
<tr class="bold text-white homepage" style="background-color:#<?php echo getMoviegoerColorById($winning_moviegoer); ?>">
<?php else: ?>
<tr class="homepage">
<?php endif; ?>
<td class="number homepage"><?php echo $i; ?></td>
<td class="viewer-name text-center homepage" ><?php echo getMoviegoerById($event['moviegoer_'.$i]); ?></td>
<td class="movie-title homepage"><?php echo get_movie_by_id($pdo,$event['wheel_'.$i]); ?></td>
<?php if($event['wheel_'.$i] != 0):
?>
<td class="homepage"><?php $movie_freshness[] = get_movie_avg_rating($pdo, $event['wheel_'.$i]);?></td>
<?php else: ?>
<td class="homepage"></td>
<?php endif; ?>
</tr>
<?php endfor;?>
</tbody>
</table>
<p class="text-center">
<a data-bs-toggle="collapse" href="#collapseExample_<?php echo $count_events; ?>" aria-expanded="false" aria-controls="collapseExample_<?php echo $count_events; ?>">
More Details...
</a>
</p>
<div class="collapse" id="collapseExample_<?php echo $count_events; ?>">
<div class="card card-body">
<?php
$movie_years = array_filter($movie_years);
$attendees = explode(",", $event['attendees']);
$viewers = Array();
foreach($attendees as $person){
$viewers[] = getMoviegoerById($person);
}
?>
<ul>
<li><strong>Attendees:</strong> <?php echo implode(", ", $viewers);?>
<li><strong>Scribe:</strong> <?php echo getViewerName($event['scribe']); ?></li>
<li><strong>Spinner:</strong> <?php echo getViewerName($event['spinner']); ?></li>
<li><strong>Bad Spin #s:</strong> <?php echo $event['error_spin']; ?></li>
<li><strong>Theme/Comment:</strong> <?php echo $event['theme']; ?></li>
<li><strong>Movie Format:</strong> <?php echo $event['format']; ?></li>
<li><strong>Selection Tool:</strong> <?php echo $event['selection_method']; ?></li>
<li><strong>Runtime:</strong> <?php echo $event['runtime']; ?> minutes</li>
<li><strong>MPAA:</strong> <?php echo get_MPAA($pdo,$event['winning_film']); ?></li>
<li><strong>Collective Movie Score:</strong> <?php echo get_freshness($movie_freshness); ?>%</li>
<li><strong>Winning Movie Score:</strong> <?php echo get_movie_avg_rating($pdo,$event['winning_film']); ?></li>
<li><strong>Average Movie Year:</strong> <?php echo round(array_sum($movie_years)/count($movie_years)); ?></li>
<li><strong>Winning Movie Year:</strong> <?php echo get_movie_year($pdo,$event['winning_film']);?></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php endif;?>
<?php endforeach;?>
<script>nanobar.go(100);</script>
</div>
</div>
</div>
<?php template('footer'); ?>