1 <title
>PeriodiCalendar
</Title
>
3 <small
>Calendar with period highlighting ability
</small
>
4 <?php
if(!isset($_GET['last'])) { ?
>
5 <form action
="?" method
="GET">
6 Last
: <input type
="text" name
="last" value
="2010-01-20" title
="YYYY-MM-DD date of last occurence" />
7 Periodicity
: <input type
="text" name
="period" value
="28" title
="Periodicity of cycle in days" />
8 Duration
: <input type
="text" name
="len" value
="7" title
="Days to highlight from beginning of cycle" />
9 Months
: <input type
="text" name
="months" value
="12" title
="How many months you want to draw" />
10 <input type
="submit" value
="DRAW" />
14 echo("\n<!-- OPEN SOURCE:\n");readfile(__FILE__
);echo("\n-".'->');
20 $now = time(); $now = mktime(12, 0, 0, date('n',$now), 1, date('Y',$now));
21 $last = date_parse_from_format('Y-m-d', $_GET['last']);
22 $last = mktime(12, 0, 0, $last['month'], $last['day'], $last['year']);
23 $period=28; if(isset($_GET['period'])) $period = $_GET['period'];
24 $length=7; if(isset($_GET['len'])) $length = $_GET['len'];
25 $months=12; if(isset($_GET['months'])) $months = $_GET['months'];
27 echo('<table border=1>');
29 for($i=0;$i<$months;$i++
) {
30 $lm = $m = date('m',$now);
32 echo("<tr><td bgcolor='lightblue'><b>$m ($mo)</b></td>");
34 if(round(($now-$last)/$day)%
($period) == 0) $r = $length;
36 if($r>0) $c = '#FF0000';
37 if($r==1 ||
$r==$length) $c = '#FF7777';
39 echo("<td bgcolor='$c'>".date('d', $now).'</td>');
45 echo('</table><small>You can bookmark this page it will get updated automatically each month.</small>');