-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
556 lines (399 loc) · 18.2 KB
/
index.php
File metadata and controls
556 lines (399 loc) · 18.2 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
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
<html>
<head><TITLE>Garbe Calendar</TITLE>
<script type="text/javascript">
function reload_page()
{
window.location.reload(true);
}
$(document).ready(function(){
//reload the page every hour
setInterval(function(){ reload_page(); },60*60000);
});
function rstFrm_Cal(){
<!-- This Year -->
<?php
print("var Year = \"".date("Y")."\";");
?>
if (document.calchoice.reset.value=="Reset") {
return Year; }
}
</script>
<style>
* {
box-sizing: border-box;
}
.table {
padding: 10px;
}
/* Create three equal columns that floats next to each other */
.column {
float: left;
//width: 50%;
padding: 10px;
//height: 300px; /* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
</style>
</head>
<body onload="startTime()">
<!-- Sliding Time -->
<script>
function getShift(d){ //Get the colors for the nine day rotation
//0 Red-Blue-Red
// 1 Blue-Red-Blue
// 2 Red-Blue-Green
// 3 Blue-Green-Blue
// 4 Green-Blue-Green
// 5 Blue-Green-Red
// 6 Green-Red-Green
// 7 Red-Green-Red
// 8 Green-Red-Blue
//var priors;
var priorsColor;
//var percentage;
var wcolor;
//var nexts;
var nextsColor;
switch ( d % 9 ) {
case 0:
priorsColor = "red";
wcolor = "blue";
nextsColor = "red";
return [priorsColor, wcolor, nextsColor];
break;
case 2:
priorsColor = "red";
wcolor = "blue";
nextsColor = "green";
return [priorsColor, wcolor, nextsColor];
break;
case 4:
priorsColor = "green";
wcolor = "blue";
nextsColor = "green";
return [priorsColor, wcolor, nextsColor];
break;
case 3:
priorsColor = "blue";
wcolor = "green";
nextsColor = "blue";
return [priorsColor, wcolor, nextsColor];
break;
case 5:
priorsColor = "blue";
wcolor = "green";
nextsColor = "red";
return [priorsColor, wcolor, nextsColor];
break;
case 7:
priorsColor = "red";
wcolor = "green";
nextsColor = "red";
return [priorsColor, wcolor, nextsColor];
break;
case 1:
priorsColor = "blue";
wcolor = "red";
nextsColor = "blue";
return [priorsColor, wcolor, nextsColor];
break;
case 6:
priorsColor = "green";
wcolor = "red";
nextsColor = "green";
return [priorsColor, wcolor, nextsColor];
break;
case 8:
priorsColor = "green";
wcolor = "red";
nextsColor = "blue";
return [priorsColor, wcolor, nextsColor];
break;
}
}
function startTime() {
const today = new Date(); //String for current date
const cShift = new Date("2007-12-30T08:00:00"); //Start of C-Shift rotation -- our two week beginning
let now = new Date();
let mn = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime(); // Milliseconds since Jan 1, 1970, 00:00:00.000 GMT for now year, now month, and day at 0hrs
const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds for a day
const diffDays = Math.round(Math.abs((cShift - today) / oneDay)); // Math.round = rounded to the nearest integer, Math.abs= absolute no. How many days since beginning of two week rotation?
const eightToday = 8 * 60 * 60 * 1000; //in milliseconds
const eightDSTToday = 7 * 60 * 60 * 1000; //in milliseconds
let numpercentDay = now.getTime()-(mn + eightToday); // NOW in Milliseconds - (0000hrs today + 8hrs) OR (How many millisecs since 0800hrs?)
//if (numpercentDay < 0) {numpercentDay = now.getTime()-(mn + eightDSTToday)}; // NOW in Milliseconds - (0000hrs today + 7hrs (DST))
let percentDay = numpercentDay/oneDay*50;// Half of "how many millis since 0800hrs divided by a WHOLE DAY of millis" in percent.
let npercentDay = 50 - percentDay ; //The other half of the millis since 0800hrs in percent.
let eShift = getShift(diffDays); //Get the colors of today's shift
let h = today.getHours();
let m = today.getMinutes();
let s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById('txt').innerHTML = h + ":" + m + ":" + s;
document.getElementById('timer').innerHTML = "<caption style=background-color:#322010;color:white;><strong>|</strong></caption><tr style=width:100%;><td style=height:40px;width:" + npercentDay + "%;background-color:" + eShift[0] + ";></td><td style=height:40px;width:50%;background-color:" + eShift[1] + ";color:white;font-size:2em;><strong>" + h + ":" + m + ":" + s + "</strong></td><td class=column style=height:40px;width:100%;background-color:" + eShift[2] + ";></td></tr>";
//document.getElementById('epoch').innerHTML = "<div>" + percentDay + "</div>";
// document.getElementById('epoch2').innerHTML = "<div>" + eShift + "</div>";
setTimeout(startTime, 1000);
}
function getEndDate(date, days) {
var result = new Date(date);
result.setDate(result.getDate() + days);
return result;
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
</script>
<div id="txt"></div>
<div id="epoch"></div>
<div id="epoch2"></div>
<table style="position:relative;width:100%;height:40px;text-align: center;" id="timer"></table>
<!------------------------------End of Sliding Time------------------------------------->
<?php
/*************************************************************************************************
*
*
* 1st Calendar
*
* ******************************************************************************************************/
?>
<div style="background-color : #004040; background-image: url(); font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; color : white; margin: 0px;width:100%;">
<?php
empty($_POST['Cal'])?$Cal='1':$Cal=$_POST['Cal'];
empty($_POST['Year'])?$Year=date("Y"):$Year=$_POST['Year'];
print("<div style=text-align:left;>");
print ("<FORM method=post name=Cal id=Cal action=$PHP_SELF>\n");
print("<input type=\"radio\" name=\"Cal\" id=\"Cal1\" value=\"1\" onchange=\"javascript:this.form.submit()\">\n");
print("<label for=\"Cal\">D-Shift</label><br/> ");
print("<input type=\"radio\" name=\"Cal\" id=\"Cal2\" value=\"2\" onchange=\"javascript:this.form.submit()\"> \n");
print("<label for=\"Cal\">A-B-C Shifts</label> ");
print("</FORM>\n</center>");
print("</div>");
print("<div style=text-align:center;>");
$This_Year = date("Y");
$Last_Year = $This_Year-1;
$Next_Year = $This_Year+1;
$In_Two_Years = $This_Year+2;
print ("<FORM method=post name=calchoice id=calch action=$PHP_SELF>\n");
print ("<SELECT NAME=Year id=\"year_select\" onchange=\"javascript:this.form.submit()\"> \n");
print (" <OPTION VALUE=".$Year.">".$Year."</OPTION>\n
<OPTION VALUE=".$This_Year.">This Year</OPTION>\n
<OPTION VALUE=".$Last_Year.">".$Last_Year."</OPTION>\n
<OPTION VALUE=".$Next_Year.">".$Next_Year."</OPTION>\n
<OPTION VALUE=".$In_Two_Years.">".$In_Two_Years."</OPTION>\n
</SELECT>\n");
print("</FORM>\n</center>");
print("</div>");
//}
print($bluedate3);
/*********************************************************************************************************************************************
*
*
*
* Function daycolor1(var) gets the color for the days for A, B, C Shifts
*
*
*
* ****************************************************************************************************************************************/
function daycolor1($quest) {
$fouteenDayWeek = 60*60*24*14; //14 days
$nineDayWeek = 60*60*24*9; //9 Days
$bluedate1 = mktime(0,0,0,12,30,2007); // The Beginning date is in format (hour,minute,second,month,day,year).
$bluedate4 = strtotime(date('d M Y ',$bluedate1)."- 1 hour"); //The DST.
$bluedate2 = strtotime(date('d M Y ',$bluedate1)."+ 2 days"); //The second day is two days later.
$bluedate5 = strtotime(date('d M Y ',$bluedate2)."- 1 hour"); //The second day DST
$bluedate3 = strtotime(date('d M Y ',$bluedate2)."+ 2 days"); //The third day is two more days later
$bluedate6 = strtotime(date('d M Y ',$bluedate3)."- 1 hour"); //The third day DST
$reddate1 = mktime(0,0,0,1,5,2008); // The Beginning date is in format (hour,minute,second,month,day,year).
$reddate4 = strtotime(date('d M Y ',$reddate1)."- 1 hour"); //The DST.
$reddate2 = strtotime(date('d M Y ',$reddate1)."+ 2 days"); //The second day is two days later.
$reddate5 = strtotime(date('d M Y ',$reddate2)."- 1 hour"); //The second day DST
$reddate3 = strtotime(date('d M Y ',$reddate2)."+ 2 days"); //The third day is two more days later
$reddate6 = strtotime(date('d M Y ',$reddate3)."- 1 hour"); //The third day DST
$greendate1 = mktime(0,0,0,1,2,2008); // The Beginning date is in format (hour,minute,second,month,day,year).
$greendate4 = strtotime(date('d M Y ',$greendate1)."- 1 hour"); //The DST.
$greendate2 = strtotime(date('d M Y ',$greendate1)."+ 2 days"); //The second day is two days later.
$greendate5 = strtotime(date('d M Y ',$greendate2)."- 1 hour"); //The second day DST
$greendate3 = strtotime(date('d M Y ',$greendate2)."+ 2 days"); //The third day is two more days later
$greendate6 = strtotime(date('d M Y ',$greendate3)."- 1 hour"); //The third day DST
if ((($bluedate1-$quest) % $nineDayWeek == 0 ) || (($bluedate2-$quest) % $nineDayWeek == 0 )|| (($bluedate3-$quest) % $nineDayWeek == 0 )|| (($bluedate4-$quest) % $nineDayWeek == 0 )|| (($bluedate5-$quest) % $nineDayWeek == 0 )|| (($bluedate6-$quest) % $nineDayWeek == 0 )){
if($quest == mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:blue;color:white;font-weight: bold;>";
} elseif ($quest < mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:#CAD4FF;color:gray;font-weight: bold;>";
} else {
echo "<TD ALIGN=CENTER style=background-color:#CAD4FF;color:blue;font-weight: bold;>";
}
}
elseif ((($reddate1-$quest) % $nineDayWeek == 0 ) || (($reddate2-$quest) % $nineDayWeek == 0 )|| (($reddate3-$quest) % $nineDayWeek == 0 )|| (($reddate4-$quest) % $nineDayWeek == 0 )|| (($reddate5-$quest) % $nineDayWeek == 0 )|| (($reddate6-$quest) % $nineDayWeek == 0 )){
if ($quest == mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:RED;color:white;font-weight: bold;>";
} elseif ($quest < mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:#FFD3C5;color:gray;font-weight: bold;>";
}
else {
echo "<TD ALIGN=CENTER style=background-color:#FFD3C5;color:RED;font-weight: bold;>";
}
}
elseif ((($greendate1-$quest) % $nineDayWeek == 0 ) || (($greendate2-$quest) % $nineDayWeek == 0 )|| (($greendate3-$quest) % $nineDayWeek == 0 )|| (($greendate4-$quest) % $nineDayWeek == 0 )|| (($greendate5-$quest) % $nineDayWeek == 0 )|| (($greendate6-$quest) % $nineDayWeek == 0 )){
if ($quest == mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:GREEn;color:white;font-weight: bold;>";
}
elseif ($quest < mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:#D0F4A9;color:gray;font-weight: bold;>";
}
else {
echo "<TD ALIGN=CENTER style=background-color:#D0F4A9;color:GREEN;font-weight: bold;>";
}
}
else {
echo "<TD ALIGN=CENTER style=background-color:#FFD3C5;color:RED;font-weight: bold;>";
}
}
/********************************************************************************************************************
*
* DayColor for D Shift
*
* ********************************************************************************************************************/
function daycolor($quest) {
$fouteenDayWeek = 60*60*24*14; //14 days
$nineDayWeek = 60*60*24*9; //9 Days
$royaldate1 = mktime(0,0,0,12,30,2007); // The Beginning date is in format (hour,minute,second,month,day,year). (Sunday)
$royaldate2 = strtotime(date('d M Y ',$royaldate1)."+ 3 days"); //The second day is three days later. (Wed)
$royaldate7 = strtotime(date('d M Y ',$royaldate1)."+ 4 days"); //The third day is four days later. (Thurs)
$royaldate9 = strtotime(date('d M Y ',$royaldate1)."+ 8 days"); //The fourth day is eight days later. (Mon)
$royaldate11 = strtotime(date('d M Y ',$royaldate1)."+ 9 days"); //The Fifth day is nine days later. (Tues)
$royaldate13 = strtotime(date('d M Y ',$royaldate1)."+ 12 days"); //The Sixth day is two days later. (Fri)
$royaldate15 = strtotime(date('d M Y ',$royaldate1)."+ 13 days"); //The Seventh day is two days later. (Sat)
$royaldate4 = strtotime(date('d M Y ',$royaldate1)."- 1 hour"); //The DST.
$royaldate5 = strtotime(date('d M Y ',$royaldate2)."- 1 hour"); //The second day DST
$royaldate8 = strtotime(date('d M Y ',$royaldate7)."- 1 hour"); //The second day DST
$royaldate10 = strtotime(date('d M Y ',$royaldate9)."- 1 hour"); //The second day DST
$royaldate12 = strtotime(date('d M Y ',$royaldate11)."- 1 hour"); //The second day DST
$royaldate14 = strtotime(date('d M Y ',$royaldate13)."- 1 hour"); //The second day DST
$royaldate16 = strtotime(date('d M Y ',$royaldate15)."- 1 hour"); //The second day DST
if((($royaldate1-$quest) % $fouteenDayWeek == 0 )|| (($royaldate4-$quest) % $fouteenDayWeek == 0 )|| (($royaldate2-$quest) % $fouteenDayWeek == 0 )|| (($royaldate5-$quest) % $fouteenDayWeek == 0 )|| (($royaldate7-$quest) % $fouteenDayWeek == 0 )|| (($royaldate8-$quest) % $fouteenDayWeek == 0 )|| (($royaldate9-$quest) % $fouteenDayWeek == 0 )|| (($royaldate10-$quest) % $fouteenDayWeek == 0 )|| (($royaldate11-$quest) % $fouteenDayWeek == 0 )|| (($royaldate12-$quest) % $fouteenDayWeek == 0 )|| (($royaldate13-$quest) % $fouteenDayWeek == 0 )|| (($royaldate14-$quest) % $fouteenDayWeek == 0 )|| (($royaldate15-$quest) % $fouteenDayWeek == 0 )|| (($royaldate16-$quest) % $fouteenDayWeek == 0 )){
if($quest == mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:purple;color:white;font-weight: bold;>";
} elseif ($quest < mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:#BF7FBF;color:gray;font-weight: bold;>";
} else {
echo "<TD ALIGN=CENTER style=background-color:#A802F9;color:white;font-weight: bold;>";
}
}
else {
if($quest == mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:yellow;color:black;font-weight: bold;>";
} elseif ($quest < mktime(0,0,0,date('m'),date('d'), date('Y'))) {
echo "<TD ALIGN=CENTER style=background-color:#FBFEA0;color:gray;font-weight: bold;>";
} else {
echo "<TD ALIGN=CENTER style=background-color:#F0FC44;color:black;font-weight: bold;>";
}
}
}
/*******************************************************************************************************************************
*
*
*
* End of the function daycolor()
*
*
* ****************************************************************************************************************************/
$MonthArray=array('January','February','March','April','May','June','July','August','September','October','November','December');
//print_r($MonthArray);
print("<div class=row>");
foreach($MonthArray as $mn => $MonthName){
$mn=$mn+1;
/**********************************************************************88
*
* For Each Month
*
* **********************************************************************/
print("<div class=column>"); //div column for each month
$Timestamp=mktime (0,0,0,$mn,1,$Year);
print("<div class=table>"); //div table for the month
print ("<TABLE border=1 CELLPADDING=3 CELLSPACING=0 ALIGN=CENTER>");
print ("<TR BGCOLOR=#404040><TD COLSPAN=7 ALIGN=CENTER><FONT COLOR=WHITE><B>
$MonthName $Year</B></FONT></TD></TR>");
print ("<TR BGCOLOR=#606060>
<TD ALIGN=CENTER WIDTH=20><B>
<FONT COLOR=WHITE>Su</FONT></B></TD>
<TD ALIGN=CENTER WIDTH=20><B>
<FONT COLOR=WHITE>M</FONT></B></TD>
<TD ALIGN=CENTER WIDTH=20><B>
<FONT COLOR=WHITE>Tu</FONT></B></TD>
<TD ALIGN=CENTER WIDTH=20><B>
<FONT COLOR=WHITE>W</FONT></B></TD>
<TD ALIGN=CENTER WIDTH=20><B>
<FONT COLOR=WHITE>Th</FONT></B></TD>
<TD ALIGN=CENTER WIDTH=20><B>
<FONT COLOR=WHITE>F</FONT></B></TD>
<TD ALIGN=CENTER WIDTH=20><B>
<FONT COLOR=WHITE>Sa</FONT></B></TD>
</TR>\n");
$MonthStart=date("w",$Timestamp);
if ($MonthStart == 0)
{
$MonthStart = 7;
}
$LastDay = date("d",mktime (0,0,0,$mn+1,0,$Year));
$StartDate=-$MonthStart;
for($k=1; $k <=6; $k++) //begin the loop for rows.
{
print("<TR>");
for ($i=1;$i <= 7; $i++) //begin the loop for columns.
{
$StartDate++;// Add one to the negative number before each loop print.
$quest= mktime(0,0,0,$mn,$StartDate,$Year);
if (($StartDate <=0) || ($StartDate > $LastDay))
{
print ("<TD style=\"background-color:#B8B870;\"> </TD>"); //Print background table boxes if $StartDate" is less than zero and bigger than the last day.
}
elseif (($StartDate >=1) && ($StartDate <=$LastDay))
{
if ($Cal == '2'){
daycolor1($quest);
} else {
daycolor($quest);
}
print ("".$StartDate."</TD>");
}
}
print ("</TR>\n");
}
print ("</TABLE>\n");
print("</div>"); //end of the div table
//if($mn == 4 || $mn == 8 || $mn == 12){
print("</div>"); //end of the month column
//}
}
print("</div>"); //End of the Rows of Months
print("<div style=text-align:center;>");
$This_Year = date("Y");
$Last_Year = $This_Year-1;
$Next_Year = $This_Year+1;
$In_Two_Years = $This_Year+2;
print ("<FORM method=post name=calchoice id=calch action=$PHP_SELF>\n");
print ("<SELECT NAME=Year id=\"year_select\" onchange=\"javascript:this.form.submit()\"> \n");
print (" <OPTION VALUE=".$Year.">".$Year."</OPTION>\n
<OPTION VALUE=".$This_Year.">This Year</OPTION>\n
<OPTION VALUE=".$Last_Year.">".$Last_Year."</OPTION>\n
<OPTION VALUE=".$Next_Year.">".$Next_Year."</OPTION>\n
<OPTION VALUE=".$In_Two_Years.">".$In_Two_Years."</OPTION>\n
</SELECT>\n");
print("</FORM>\n</center>");
print("</div>");
/*****************************************************************************************
*
*
*
*
* ******************************************************************************************/
?>