-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlistView.php
More file actions
100 lines (76 loc) · 3.38 KB
/
listView.php
File metadata and controls
100 lines (76 loc) · 3.38 KB
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
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<!-- HEAD -->
<?php include(__DIR__ . "/includes/head.php"); ?>
<?php include(__DIR__ . "/dat/connectDB.php"); ?>
<body>
<?php
include (__DIR__ . "/dat/controller.php");
include (__DIR__ . "/includes/data.php");
include (__DIR__ . "/includes/share.php");
$activePage = 1;
?>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<!-- HEADER -->
<?php include(__DIR__ . "/includes/header.php"); ?>
<!-- NAVIGATION -->
<?php include(__DIR__ . "/includes/navigation.php"); ?>
</div>
</div>
<div class="row clearfix">
<div class="col-md-12 column">
<!-- some introductory text here -->
<!-- construct a query that fetches all upcoming events sorted by start date and then include eventInfo.php for every event -->
<?php
// DELETE THIS AFTERWARDS
function debug_to_console($data) {
if (is_array($data))
$output = "<script>console.log( 'Debug Objects: " . implode(',', $data) . "' );</script>";
else
$output = "<script>console.log( 'Debug Objects: " . $data . "' );</script>";
echo $output;
}
echo("<h2>" . $listview . "</h2>");
$currentdate = time();
$eventsexist = false;
// First we list events with set dates
$listquery = "SELECT * FROM events WHERE (endDate >= '$currentdate' OR (endDate = '' AND startDate >= '$currentdate')) AND status = 'ACTIVE' ORDER BY startDate";
$allresults = dbQuery($listquery);
if (pg_num_rows($allresults) > 0) {
$eventsexist = true;
while ($result = pg_fetch_assoc($allresults)) {
include(__DIR__ . "/includes/eventInfo.php");
}
}
// ... and at the end there are the events with no set date
$listquery = "SELECT * FROM events WHERE startDate = '' AND status = 'ACTIVE'";
$allresults = dbQuery($listquery);
if (pg_num_rows($allresults) > 0) {
$eventsexist = true;
echo("<h3><b>" . $ambiguous . "</b></h3>");
while ($result = pg_fetch_assoc($allresults)) {
include(__DIR__ . "/includes/eventInfo.php");
}
}
if($eventsexist == false){
echo("<p><h3>" . $noevents . "</h3></p>");
}
?>
</div>
</div>
<div class="row clearfix">
<div class="col-md-12 column">
<!-- FOOTER -->
<?php include(__DIR__ . "/includes/footer.php"); ?>
</div>
</div>
</div>
</body>
</html>