-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
81 lines (68 loc) · 1.95 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
<html>
<?php
# Set location and timezone.
#$lat = -33.87; $lon = 151.21; $tz = "Australia/Sydney";
#$lat = 51.51; $lon = -0.13; $tz = "Europe/London";
#$lat = -22.91; $lon = -43.17; $tz = "America/Sao_Paulo";
#$lat = 69.65; $lon = 18.96; $tz = "Europe/Oslo";
#$lat = 55.76; $lon = 37.62; $tz = "Europe/Moscow";
#$lat = 42.00; $lon = -80.18; $tz = "America/New_York";
$lat = 40.44; $lon = -79.95; $tz = "America/New_York";
# Compute the facts.
require_once('doldrums.php');
computeFacts($lat, $lon, $tz);
$start_date = strtotime(min(array_keys($facts)));
$end_date = strtotime(max(array_keys($facts)));
echo "\n<head>";
echo "\n<title>Positive thoughts for the Doldrums of ".$print_year."</title>";
?>
<style>
#calendar .month-odd { background: #fff; }
#calendar .month-even { background: #eee; }
#calendar tr { break-inside: avoid; }
</style>
<?php
echo "\n</head>";
echo "\n<body>";
echo "\n";
# Print the facts.
echo "<h2>POSITIVE THOUGHTS FOR THE DOLDRUMS OF ".$print_year."</h2>";
echo "<h3>customized to (lat ".$lat.", lon ".$lon.")</h3>";
echo "\n<table border=1 id=\"calendar\">";
echo "\n<tr>";
echo "\n<th>Monday</th>";
echo "\n<th>Tuesday</th>";
echo "\n<th>Wednesday</th>";
echo "\n<th>Thursday</th>";
echo "\n<th>Friday</th>";
echo "\n<th>Saturday</th>";
echo "\n<th>Sunday</th>";
echo "\n</tr>";
$d = strtotime("last Monday", $start_date);
while ($d <= strtotime("next Sunday", $end_date)) {
$i = date("Y-m-d", $d);
# Start the week row.
if (date("N", $d) == 1) {
echo "\n<tr valign=top>";
}
# Print the day.
echo "\n<td class=\"month-".( date("n", $d) % 2 == 0 ? "even" : "odd" )."\">";
echo date("\nd F Y", $d);
if (array_key_exists($i, $facts)) {
echo "\n<ul>";
foreach ($facts[$i] as $fact) {
echo "\n<li>".$fact."</li>";
}
echo "\n</ul>";
}
echo "\n</td>";
# End the week row.
if (date("N", $d) == 7) {
echo "\n</tr>";
}
$d = strtotime("+1 day", $d);
}
echo "</table>";
echo "</body>";
?>
</html>