From 39f6a9e79a72ff17907ffaddeadf1193ca5f1f8f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 31 May 2003 12:42:02 +0000 Subject: - CSS improvements to the calendar of the archive module. Updated the Xtemplate theme and theme Marvin to take advantage of this. Patch by Al. Pretty stuff. --- modules/archive/archive.module | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'modules/archive/archive.module') diff --git a/modules/archive/archive.module b/modules/archive/archive.module index 3bb06ebae..51ca1db35 100644 --- a/modules/archive/archive.module +++ b/modules/archive/archive.module @@ -10,7 +10,8 @@ function archive_system($field){ function archive_calendar($original = 0) { // Extract today's date: - $today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); + $start_of_today = mktime(0, 0, 0, date("n", time()), date("d", time()), date("Y", time())); + $end_of_today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); // Extract the requested date: if (arg(0) == "archive" && arg(3)) { @@ -18,14 +19,14 @@ function archive_calendar($original = 0) { $month = arg(2); $day = arg(3); - $requested = mktime(23, 59, 59, $month, $day, $year); + $requested = mktime(0, 0, 0, $month, $day, $year); } else { $year = date("Y", time()); $month = date("n", time()); $day = date("d", time()); - $requested = $today; + $requested = $end_of_today; } // Extract first day of the month: @@ -42,8 +43,9 @@ function archive_calendar($original = 0) { // Generate calendar header: $output .= "\n\n"; - $output .= "\n"; - $output .= " \n"; + $output .= "
"; + $output .= "
". l("<", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($nextmonth <= time() ? l(">", "archive/". date("Y/m/d", $next)) : ">") ."
\n"; + $output .= " \n"; // First day of week (0 => Sunday, 1 => Monday, ...) $weekstart = variable_get("default_firstday", 0); @@ -54,9 +56,9 @@ function archive_calendar($original = 0) { // Generate the days of the week: $firstcolumn = mktime(0, 0, 0, 3, 20 + $weekstart, 1994); - $output .= " "; + $output .= " "; for ($i = 0; $i < 7; $i++) { - $output .= ""; + $output .= ""; } $output .= "\n"; @@ -69,26 +71,27 @@ function archive_calendar($original = 0) { // Set up blank days for first week of the month: if ($first != $weekstart) { $blankdays = ($first - $weekstart + 7) % 7; - $output .= " \n"; + $output .= " \n"; $first = $weekstart; } - // Start every week on a new line: if ($sday == $weekstart) { - $output .= " \n"; + $output .= " \n"; } // Print one cell: $date = mktime(0, 0, 0, $month, $nday, $year); - if ($date == $requested) { - $output .= " \n"; + $output .= " \n"; + } + else if ($date == $start_of_today) { + $output .= " \n"; } - else if ($date > $today) { - $output .= " \n"; + else if ($date > $end_of_today) { + $output .= " \n"; } else { - $output .= " \n"; + $output .= " \n"; } // Start every week on a new line: @@ -105,10 +108,10 @@ function archive_calendar($original = 0) { // Complete the calendar: if ($sday != $weekstart) { $end = (7 - $sday + $weekstart) % 7; - $output .= " \n \n"; + $output .= " \n \n"; } - $output .= "
". l("<", "archive/". date("Y/m/d", $prev)) ." ". date("F Y", $requested) ." ". ($nextmonth <= time() ? l(">", "archive/". date("Y/m/d", $next)) : ">") ."
". substr(ucfirst(t(date("l", $firstcolumn + $i * 86400))), 0, 1) ."". substr(ucfirst(t(date("l", $firstcolumn + $i * 86400))), 0, 1) ."
 
 
$nday$nday". l($nday, "archive/$year/$month/$nday") ."$nday$nday". l($nday, "archive/$year/$month/$nday", array("style" => "text-decoration: none;")) ."". l($nday, "archive/$year/$month/$nday") ." 
 
\n\n"; + $output .= "\n\n"; return $output; } -- cgit v1.2.3