forked from kkaiser1952/NCM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildPreambleListing.php
100 lines (77 loc) · 2.96 KB
/
buildPreambleListing.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
<!doctype html>
<html lang="en">
<head>
<title>Preamble</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='https://fonts.googleapis.com/css?family=Allerta' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/NetManager.css" />
<link rel="stylesheet" type="text/css" href="css/preamble.css" />
<script>
function closeWin() {
close(); // Closes the new window
}
</script>
</head>
<body>
<?php
ini_set('display_errors',1);
error_reporting (E_ALL ^ E_NOTICE);
require_once "dbConnectDtls.php";
$activity = $_GET["activity"];
// echo "incoming activity = $activity";
// incoming activity = Fresno County EmComm
$domain = $_GET["domain"]; //echo("<br>1 domain= $domain");
$domain = preg_replace('/\W\w+\s*(\W*)$/', '$1', $domain); //echo("<br>2 domain= $domain<br>");
$domain = preg_replace('!\s+!', ' ', $domain); // replace multiple spaces with a single space
$domain = trim($domain," ");
$domain = explode(" ",$domain)[0];
//echo("domain= $domain");
if ($domain == 'ALL') {
$thewhere = "WHERE NOW() <= end AND docType LIKE '%preamble%'";
$domain = "<p style='font-size:18pt; color:red';>Examples</p>";
}
else { $thewhere = "WHERE docType LIKE '%preamble%'
AND domain like '%$domain%'
AND (subdomain like '%$activity%' OR subdomain = '')
AND NOW() <= end
";
}
$sql = ("SELECT description, contact, callsign, id, dttm, start, end
FROM events
$thewhere
ORDER BY dttm DESC
LIMIT 1
");
/*
SELECT description, contact, callsign, id, dttm, start, end
FROM events
WHERE docType LIKE '%preamble%'
AND domain like '%W0KCN%'
AND (subdomain like '%W0KCN Weekly2MeterVoice%' OR subdomain = '')
AND NOW() <= end ORDER BY dttm DESC LIMIT 1
*/
//echo("<br><br>$sql<br><br>");
$num_rows = 0; // Counter to color row backgrounds in loop below
foreach($db_found->query($sql) as $row) {
++$num_rows; // Increment row counter for coloring background of rows
echo("<div>$domain Net</div>");
echo("<div id=\"subby\">Submitted by: $row[contact],$row[callsign]</div>");
echo("<br>");
echo("<div id=\"whatitis\">$row[description]</div>");
echo("<br><br>");
echo("<button onclick=\"closeWin()\">Close Window</button>");
echo("<br><br>");
echo("<br><br>");
echo("<span id=\"edit\">Something wrong? Click <a href=\"buildEvents.php?id=$row[id]\" target=\"_blank\"> here </a> to edit</span>");
echo("<br>");
echo("****************************************************************");
echo("<br>$row[id]");
echo("<br><br>");
echo("Created: $row[dttm]<br>");
echo("Start: $row[start]<br>");
echo("End: $row[end]");
}
?>
</body>
</html>