forked from kkaiser1952/NCM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPIO_News.php
288 lines (243 loc) · 8.81 KB
/
PIO_News.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!doctype html>
<?php
ini_set('display_errors',1);
error_reporting (E_ALL ^ E_NOTICE);
require_once "dbConnectDtls.php";
$q = intval( $_GET["NetID"] ); //$q = 2916;
$sql1 = ("SELECT CONCAT(Fname,' ',Lname) as fullname,
callsign,
FROM TimeLog
WHERE netID = $q
");
foreach($db_found->query($sql1) as $row) {
$activity = $row[activity];
$indate = $row[indate]; $outdate = $row[outdate]; $callsign = $row[callsign];
$intime = $row[intime]; $outtime = $row[outtime]; $name = $row[activity];
$parent = $row[subNetOfID]; $freq = $row[frequency];
}
?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PIO News Release</title>
<meta name="Keith Kaiser" content="Graham" />
<link rel="stylesheet" type="text/css" media="all" href="css/ics214.css">
<link href='https://fonts.googleapis.com/css?family=Allerta' rel='stylesheet' type='text/css'>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
}
$(document).ready(function()
{
setInterval('showDTTM()', 1000);
});
function getcomm() {
$.post('fillics214.php', { unitno: findcomm.unitno.value },
function(output) {
$('#comm').html(output).show();
});
}
$.fn.firstword = function() {
var text = this.text().trim().split(" ");
var first = text.shift();
this.html((text.length > 0 ? "<span class='firstword'>" + first + "</span>" : first) + text.join(" "));
}
$("#firstword").firstword();
</script>
<style>
.spread {
float: right;
padding-right: 5px;
}
</style>
</head>
<body>
<p style="text-indent: 0pt; text-align: left;">
<br>
</p>
<table class="table1">
<tr style="height: 29pt">
<td class="box1" colspan="2">
<h3>ICS 214 UNIT LOG</h3>
<br>
<b>1. Incident Name:</b>
<?php echo "
Log:#$q/$activity";
if ($children) {
echo "<li style='color:red;'>Has Sub Nets: $children</li>";
}if ($parent) {
echo "<li style='color:red;'>Sub Net of: $parent</li>";
}
/* if ($subNetOfID) {
echo "<li>Sub Net of: $subNetOfID </li>";
}
*/
?>
</td>
<td class="box2">
<p class="box2s1p1">
<b>2. Operational Period:</b><br><br>
<b>Date From:</b> <?php echo $indate ?> <b>To:</b> <?php echo $outdate ?>
<br>
<b>Time From:</b> <?php echo $intime ?> <b>To:</b> <?php echo $outtime ?>
</p>
</td>
</tr>
<tr style="height: 33pt">
<td class="box3">
<p class="s1">
3. Name:<br><?php echo "$name<br>$freq" ?></p>
</td>
<td class="box4">
<p class="s1">
4. ICS Position:<br><?php echo "$box4" ?></p> <!--<?php echo "$fname $lname, $netcontrol" ?></p> -->
</td>
<td class="box5">
<p class="s1">
5. Home Agency <span class="s2">(and Unit)</span>:<br> <?php echo "$box5" ?></p>
</td>
</tr>
<tr style="height: 17pt">
<td class="box6" colspan="3">
<p class="s1">
6. Resources Assigned:</p>
</td>
</tr>
<tr style="height: 16pt">
<td class="box6name" >
<p class="box6s2p1">
Callsign, Name & email</p>
</td>
<td class="box6position">
<p class="box6s2p2">
Band, ICS Position & Tactical</p>
</td>
<td class="box6agency">
<span class="box6s2p3a">Time On Duty</span>
<span class="box6s2p3b">CREDS, Home Agency (and Unit)</span>
</td>
</tr>
<?php
$sql = ("SELECT COUNT(*) as recCount
FROM NetLog
WHERE netID = $q");
$stmt = $db_found->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
$recCount = $result[0];
$sql = ("SELECT COUNT(*) as actCount
FROM TimeLog
WHERE netID = $q");
$stmt = $db_found->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
$actCount = $result[0];
$rowCount = $recCount + $actCount + 11 + 2;
// break page after rowCount of 36
$ManHours = 0;
$sql = ("SELECT ID, callsign, fname, lname, netcontrol,
TRIM(tactical) as tactical,
TRIM(email) as email,
TRIM(creds) as creds,
TRIM(timeonduty) as tmd,
TRIM(sec_to_time(timeonduty)) as tod,
TRIM(CONCAT_WS(' ', state, county, ' Co., Dist.', district)) as dist,
TRIM(band) as band
FROM NetLog
WHERE netID = $q
AND (timeout <> 0 AND logdate <> 0
OR RIGHT(callsign, 2) = '-U')
ORDER BY logdate");
foreach($db_found->query($sql) as $row) {
$nc = "Operator";
switch($row[netcontrol]) {
case "PRM": $nc = "Primary Net Control";
break;
case "2nd": $nc = "Secondary Net Control";
break;
case "3rd": $nc = "Tertiary Net Control";
break;
case "PIO": $nc = "Public Information Officer";
break;
case "Log": $nc = "Net Logger";
break;
case "LSN": $nc = "Liaison to ...";
break;
case "EM": $nc = "Emergency Manager";
break;
case " ": $nc = "Operator";
break;
}
// fix creds if they exist by adding a comma after its name.
$creds = "$row[creds]";
if ("$row[creds]" <> '') {$creds = "$row[creds],";} // only add the comma for non-blank credentials
else {$creds = '';}
$ManHours = $ManHours + $row[tmd];
echo "<tr style=\"height: 17pt; page-break-inside: avoid;\">
<td class=\"box6td\">$row[callsign] <span class=\"spread\">$row[fname] $row[lname]</span><span><br>$row[email]</span></td>
<td class=\"box6td\">$row[band] $nc <span class=\"spread\">$row[tactical]</span></td>
<td class=\"box6td\">
<span class=\"tod\">$row[tod]</span>
<span class=\"creds\">$creds $row[dist]</span>
</td>
</tr>";
}
$hours = floor($ManHours / 3600);
$mins = floor($ManHours / 60 % 60);
$secs = floor($ManHours % 60);
$timeFormat = sprintf('%02d:%02d:%02d', $hours, $mins, $secs);
echo "<tr style=\"height: 17pt\">
<td>$recCount Stations</td>
<td><b>Total Volunteer Hours</b></td>
<td>$timeFormat</td>
</tr>";
?>
<tr style="height: 17pt">
<td class="box7" colspan="3">
<p class="box7s1p0">
7. Activity Log:
</p>
</td>
</tr>
<tr style="height: 17pt">
<td class="box7date">
<p class="box7s2p1">
Date/Time</p>
</td>
<td class="box7notable" colspan="2">
<p class="box7s2p2">
Notable Activities</p>
</td>
</tr>
<?php
$sql = ("SELECT TIMESTAMP, ID, callsign, comment
FROM TimeLog
WHERE netID = $q
ORDER BY timestamp");
foreach($db_found->query($sql) as $row) {
echo "<tr style=\"height: 17pt\">
<td class=\"box7td1\" >$row[TIMESTAMP]</td>
<td class=\"box7td2\" colspan=\"2\">$row[callsign]: $row[comment]</td>
</tr>";
}
?>
<tr style="height: 20pt">
<td class="box8" colspan="3">
<p class="box8s2p1">
<b>8. Prepared by: </b><?php echo "$fname $lname" ?> , Net Control Operator <u></u>
</p>
</td>
</tr>
<tr style="height: 17pt">
<td class="box8page" colspan="2">
<p class="s1" style="padding-top: 1pt; padding-left: 4pt; text-indent: 0pt; text-align: left;">
ICS 214, Page 1</p>
</td>
<td class="box8date">
<p class="box8s2p3">
Date/Time: <span id="dttm2"></span>
</p>
</td>
</tr>
</table>
</body>
</html>