From e81ea8336e90a1aee1cf4a95437db8e3023d227e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 14 Jun 2001 19:01:09 +0000 Subject: - Integrated calendar.class into calendar.class (just like we did for headline.class 2 or 3 weeks ago). --- modules/calendar.class | 77 ------------------------------------------------- modules/calendar.module | 76 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 79 deletions(-) delete mode 100644 modules/calendar.class (limited to 'modules') diff --git a/modules/calendar.class b/modules/calendar.class deleted file mode 100644 index 0858215bc..000000000 --- a/modules/calendar.class +++ /dev/null @@ -1,77 +0,0 @@ -date = ($date ? $date : time()); - } - - function display() { - // Extract information from the given date: - $month = date("n", $this->date); - $year = date("Y", $this->date); - $day = date("d", $this->date); - - // Extract today's date: - $today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); - - // Extract first day of the month: - $first = date("w", mktime(0, 0, 0, $month, 1, $year)); - - // Extract last day of the month: - $last = date("t", mktime(0, 0, 0, $month, 1, $year)); - - // Calculate previous and next months dates: - $prev = mktime(0, 0, 0, $month - 1, $day, $year); - $next = mktime(0, 0, 0, $month + 1, $day, $year); - - // Generate calendar header: - $output .= "\n\n"; - $output .= "\n"; - $output .= " \n"; - $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(23, 59, 59, $month, $nday, $year); - if ($nday == $day) $output .= " \n"; - else if ($date > $today) $output .= " \n"; - else $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 .= "
<   ". date("F Y", $this->date) ."   >
SMTWTFS
 
$nday$nday$nday
 
\n\n"; - - // Return calendar: - return $output; - } -} - -?> diff --git a/modules/calendar.module b/modules/calendar.module index 23b600793..fc519e8e3 100644 --- a/modules/calendar.module +++ b/modules/calendar.module @@ -1,10 +1,82 @@ date = ($date ? $date : time()); + } + + function display() { + // Extract information from the given date: + $month = date("n", $this->date); + $year = date("Y", $this->date); + $day = date("d", $this->date); + + // Extract today's date: + $today = mktime(23, 59, 59, date("n", time()), date("d", time()), date("Y", time())); + + // Extract first day of the month: + $first = date("w", mktime(0, 0, 0, $month, 1, $year)); + + // Extract last day of the month: + $last = date("t", mktime(0, 0, 0, $month, 1, $year)); + + // Calculate previous and next months dates: + $prev = mktime(0, 0, 0, $month - 1, $day, $year); + $next = mktime(0, 0, 0, $month + 1, $day, $year); + + // Generate calendar header: + $output .= "\n\n"; + $output .= "\n"; + $output .= " \n"; + $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(23, 59, 59, $month, $nday, $year); + if ($nday == $day) $output .= " \n"; + else if ($date > $today) $output .= " \n"; + else $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 .= "
<   ". date("F Y", $this->date) ."   >
SMTWTFS
 
$nday$nday$nday
 
\n\n"; + + // Return calendar: + return $output; + } +} + function calendar_block() { global $date; - include_once "modules/calendar.class"; - $calendar = new Calendar($date); $block[0]["subject"] = "Browse archives"; -- cgit v1.2.3