--- ConnorCalendar/calendar.pl 2017/06/15 01:52:15 1.12 +++ ConnorCalendar/calendar.pl 2020/11/13 18:07:40 1.14 @@ -8,7 +8,7 @@ | | Nicholas DeClario | March 2009 -| $Id: calendar.pl,v 1.12 2017/06/15 01:52:15 nick Exp $ +| $Id: calendar.pl,v 1.14 2020/11/13 18:07:40 nick Exp $ | +------------------------------------------------------------------------------ =end comment @@ -26,7 +26,7 @@ use Calendar::Simple; use Date::Pcalendar::Year qw( :all ); use Date::Pcalendar::Profiles qw( $Profiles ); -my $VERSION = '$Id: calendar.pl,v 1.12 2017/06/15 01:52:15 nick Exp $'; +my $VERSION = '$Id: calendar.pl,v 1.14 2020/11/13 18:07:40 nick Exp $'; my $DEBUG = ""; my $URL = "http://demandred.dyndns.org/cgi-bin/ConnorCalendar/index.cgi"; my %post_in = ( ); @@ -45,13 +45,34 @@ my %holidays = ( "New Year's Day" => 'odd', "New Year's Eve" => 'odd', "Thanksgiving Day" => 'odd', - ); + ); my %specials = ( "11/28" => "even", "5/6" => "odd", ); +my @school_days = ( + "2020/11/27", + "2020/12/24", + "2020/12/25", + "2020/12/28", + "2020/12/29", + "2020/12/30", + "2020/12/31", + "2021/01/01", + "2021/01/18", + "2021/02/15", + "2021/03/29", + "2021/03/30", + "2021/03/31", + "2021/04/01", + "2021/04/02", + "2021/04/05", + "2021/05/31", + "2021/06/01" + ); + print "Content-type: text/html\n\n"; print &header( ); @@ -102,6 +123,8 @@ for( my $month = 1; $month <= 12; $month print sprintf "%2d ", $day; } elsif ( &isToday( $YEAR, $month, $day ) ) { print sprintf "%2d ", $day; + } elsif ( &isSchoolClosed( $YEAR, $month, $day ) ) { + print sprintf "%2d ", $day; } else { print sprintf "%2d ", $day; } @@ -115,13 +138,14 @@ for( my $month = 1; $month <= 12; $month $row++; } print ""; -print "

Holidays I have Connor are in Red\n
"; +print "

Holidays Connor visits are in Red\n
"; print "Today is Blue\n
"; -print "Weekends and special days I have Connor are in Green\n

"; +print "Days off from school are Orange\n
Last Day of School 06/23/2021\n
\n"; +print "Weekends and special days Connor visits are in Green\n

"; print "
List of Special/Holidays " . - "I have Connor:

"; + "Connor Visits:

"; print map { $_ . "
\n" } sort @list; print "

\n"; print "

Version: $VERSION
"; @@ -147,9 +171,9 @@ sub IHaveConnor sub isSpecial { - my $y = shift || return 0; - my $m = shift || return 0; - my $d = shift || return 0; + my $y = shift || return 0; + my $m = shift || return 0; + my $d = shift || return 0; my $yr = ( $YEAR % 2 ) ? "odd" : "even"; my $ref = "$m/$d"; @@ -166,6 +190,21 @@ sub isSpecial return 0; } +sub isSchoolClosed +{ + my $y = shift || return 0; + my $m = shift || return 0; + my $d = shift || return 0; + + my $date_str = sprintf( "$y/%02d/%02d", $m, $d ); + + foreach my $sd ( @school_days ) { + return 1 if $date_str =~ m/$sd/; + } + + return 0; +} + sub isWeekend { my $y = shift || return 0; @@ -199,7 +238,7 @@ sub calcWeekends my $d = shift; my %weekends = ( ); - print "Weekends I have Connor:\n"; + print "Weekends Connor Visits:\n"; use Calendar; my $date = Calendar->new_from_Gregorian( $m, $d, $y );