\n"; $output .= "\n"; $output .= " \n"; // Generate the days of the week: $somesunday = mktime(0, 0, 0, 3, 20, 1994); $output .= " "; for ($i = 0; $i < 7; $i++) { $output .= ""; } $output .= "\n"; // Initialize temporary variables: $nday = 1; $sday = $first; // Loop through all the days of the month: while ($nday <= $last) { // Set up blank days for first week of the month: if ($first) { $output .= " \n"; $first = 0; } // Start every week on a new line: if ($sday == 0) { $output .= " \n"; } // Print one cell: $date = mktime(0, 0, 0, $month, $nday, $year); if ($date == $original) { $output .= " \n"; } else if ($date > $today) { $output .= " \n"; } else { // due to text-decoration we use drupal_url() instead of lm() $output .= " \n"; } // Start every week on a new line: if ($sday == 6) { $output .= " \n"; } // Update temporary variables: $sday++; $sday = $sday % 7; $nday++; } // Complete the calendar: if ($sday) { $end = 7 - $sday; $output .= " \n \n"; } $output .= "
". lm("<", array("mod" => "archive", "date" => $prev)) ." ". date("F Y", $original) ." ". ($next <= $thislast ? lm(">", array("mod" => "archive", "date" => $next)) : ">") ."
". substr(ucfirst(t(date("l", $somesunday + $i * 86400))), 0, 1) ."
 
$nday$nday "archive", "date" => $date), "module") ." \" style=\"text-decoration: none;\">$nday
 
\n\n"; return $output; } function archive_block() { global $date; $block[0]["subject"] = "Browse archives"; $block[0]["content"] = archive_display($date); $block[0]["info"] = "Calendar to browse archives"; return $block; } function archive_link($type) { if ($type == "page" && user_access("access content")) { $links[] = lm(t("archives"), array("mod" => "archive"), "", array("title" => t("Read the older content in our archive."))); } return $links ? $links : array(); } function archive_page() { global $date, $edit, $theme, $op, $month, $year, $meta; $theme->header(); if (user_access("access content")) { switch ($op) { case t("Show"): $date = mktime(0, 0, 0, $edit["month"], $edit["day"], $edit["year"]); // Fall though default: /* ** Prepare the values of the form fields: */ $years = array(2000 => "2000", 2001 => "2001", 2002 => "2002", 2003 => "2003", 2004 => "2004", 2005 => "2005"); $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December")); for ($i = 1; $i <= 31; $i++) $days[$i] = $i; /* ** If a timestamp is being specified, extract the date: */ if ($date) { $edit["year"] = date("Y", $date); $edit["month"] = date("m", $date); $edit["day"] = date("d", $date); } $start = form_select("", "year", ($edit["year"] ? $edit["year"] : date("Y")), $years) . form_select("", "month", ($edit["month"] ? $edit["month"] : date("m")), $months) . form_select("", "day", ($edit["day"] ? $edit["day"] : date("d")), $days) . form_submit(t("Show")); $start = ereg_replace("<[/]?p>", "", $start); $theme->box(t("Archives"), form($start)); /* ** Fetch nodes for the selected date, or current date if none ** selected. */ $result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_query($date) : time()) ." ORDER BY created LIMIT 20"); while ($nid = db_fetch_object($result)) { node_view(node_load(array("nid" => $nid->nid)), 1); } } } else { $theme->box(t("Access denied"), message_access()); } $theme->footer(); } ?>