"; //My custom CSS; SDV($HTMLStylesFmt['feralsimplecalendar'], " div#feralsimplecalendar { font-size: smaller; } table.feralsimplecalendar { border: 2px solid #abd5d6; border-collapse: collapse; } table.feralsimplecalendar caption { text-align: center; font-weight: bold; padding-top: 3px; padding-bottom: 3px; } table.feralsimplecalendar th { background-color: #eeeeee; border: 1px dotted #abd5d6; width: 2.2em; font-weight: normal; } table.feralsimplecalendar td { border: 1px dotted #abd5d6; text-align: center; padding: 3px; } th.feralsimplecalendar-daynames { text-align: center; color: green; } td.feralsimplecalendar-blank { background-color: #ddbbaa; } td.feralsimplecalendar-today { background-color: #ffff00; color: #000000; } td.feralsimplecalendar-day { background-color: #ffeedd; color: slategrey; } "); SDV($feralsimplecalendar_weekstart, 0); // Start on Sunday; //SDV($feralsimplecalendar_weekstart, 1); // Start on Monday; SDV($feralsimplecalendar_bottomsmalldatesep, '-'); // 2007-03-15 //SDV($feralsimplecalendar_bottomsmalldatesep, '/'); // 2007/03/15 SDVA($feralsimplecalendar_dayname, array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat") // array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") ); Markup('feralsimplecalendar','directives',"/^\(:feralsimplecalendar:\)\s*$/", "feralsimplecalendar"); function feralsimplecalendar($m) { // {{{ global $pagename; global $Group; // Config vars basically; global $feralsimplecalendar_weekstart; global $feralsimplecalendar_bottomsmalldatesep; global $feralsimplecalendar_dayname; // Determine this Group $invocation_group = FmtPageName('$Group',$pagename); $name = FmtPageName('$Name',$pagename); // What is today? $tyear = date("Y"); $tmonth = date("m"); $tday = date("d"); // // URL params else current. // $year = isset($_GET['year']) ? $_GET['year'] : $tyear; // $month = isset($_GET['month']) ? $_GET['month'] : $tmonth; // $day = isset($_GET['day']) ? $_GET['day'] : $tday; // Current date;. $year = $tyear; $month = $tmonth; $day = $tday; $out = ""; $out.= "
"; $itime = mktime(0,0,0,$month,16,$year); // day 16, i.e. in the middle; $iyear = strftime("%Y",$itime); $imonth = strftime("%m",$itime); $monthname = strftime("%B %Y",$itime); // Full month name YYYY // 7 wide, as far down untill we run out.. (i.e. 5) $out.=""; $out.=""; // From: //$lastday = mktime(0, 0, 0, 3, 0, 2000); //echo strftime("Last day in Feb 2000 is: %d", $lastday); //$lastday = mktime(0, 0, 0, 4, -31, 2000); //echo strftime("Last day in Feb 2000 is: %d", $lastday); $totaldays = date("t",mktime(0,0,0,$month,1,$year)); // from PmCal $totaldays $startdayofweek = date('w',mktime(0,0,0,$month,1,$year)); // from PmCal ($startdayofweek) // weekstart should be from 0 to 6. // also from PmCal $feralsimplecalendar_weekstart=abs($feralsimplecalendar_weekstart) % 7; if ( $feralsimplecalendar_weekstart >= 1 && $startdayofweek == 0 ) { $startdayofweek = 7; } // Day names // $feralsimplecalendar_weekstart=0 == (Sunday->Monday -> Friday->Saturday) // $feralsimplecalendar_weekstart=1 == (Monday -> Friday->Saturday->Sunday) $out.=""; for ( $ind = 0; $ind < 7; $ind++) { $spacing = ''; if ( $ind == 0 || $ind == 6 ) { $spacing = ' width="15%"'; } else { $spacing = ' width="14%"'; } $d=($ind+$feralsimplecalendar_weekstart) % 7; $out.="

".$feralsimplecalendar_dayname[$d]."

"; } $out.="
"; $work = ($feralsimplecalendar_weekstart-$startdayofweek); for ( $index=($feralsimplecalendar_weekstart-$startdayofweek); $index < $totaldays; ) { $out.=""; for ( $ind = 0; $ind < 7; $ind++, $index++) { $daynum = $index+1; if ($index < 0) { // empty cell before cal starts $out.=""; } else if ($index >= $totaldays) { // empty cell after cal ends. $out.=""; } else { // Normal cal cell. if ( $daynum < 10) { $paddeddaynum = "0".$daynum; } else { $paddeddaynum = $daynum; } $daynumtext = $daynum; if ( $tyear == $year && $tmonth == $month && $tday == $daynum ) { // TODAY $out.=""; } else { $out.=""; } } } $out.=""; } $out.= "
$monthname

 

 

$daynumtext

$daynumtext

"; $out.= "

$year$feralsimplecalendar_bottomsmalldatesep$month$feralsimplecalendar_bottomsmalldatesep$day

"; // $out.= "

".strftime("%#I:%M:%p on %A, %B %#d, %Y", time() )."

"; // 1:47:AM on Thursday, March 15, 2007 // $out.= "

".strftime("%A, %Y/%m/%d @ %#I:%M:%p", time() )."

"; // $out.= "

".strftime("%A, %Y/%m/%d", time() )."

"; $out.= "
"; return $out; } // }}}