From cf2b0c139b4ca884b5ce335ce893f2211b8e95bb Mon Sep 17 00:00:00 2001
From: Chad Little
Date: Fri, 30 Jan 2004 22:49:01 +0000
Subject: Mid-day sanity checkin.
---
functions/date_functions.php | 5 ++
functions/ical_parser.php | 2 +
functions/template.php | 58 +++++++++++--------
functions/timezones.php | 112 ++++++++++++++++++-------------------
month.php | 10 +++-
templates/default/calendar_nav.tpl | 74 +++++++++++++++++-------
templates/default/footer.tpl | 3 +-
templates/default/month.tpl | 4 +-
templates/default/month_large.tpl | 54 ++++++++++++++----
templates/default/month_small.tpl | 25 +++++++--
10 files changed, 227 insertions(+), 120 deletions(-)
diff --git a/functions/date_functions.php b/functions/date_functions.php
index 46cbb8a..72b9a9c 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -14,6 +14,11 @@ if (phpversion() < '4.1') {
}
}
+function getmicrotime() {
+ list($usec, $sec) = explode(' ',microtime());
+ return ((float)$usec + (float)$sec);
+}
+
// takes iCalendar 2 day format and makes it into 3 characters
// if $txt is true, it returns the 3 letters, otherwise it returns the
// integer of that day; 0=Sun, 1=Mon, etc.
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 4f974e0..9dbc8e0 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -8,6 +8,8 @@ include_once(BASE.'functions/overlapping_events.php');
include_once(BASE.'functions/timezones.php');
include_once(BASE.'functions/list_functions.php');
+$php_started = getmicrotime();
+
$fillTime = $day_start;
$day_array = array ();
while ($fillTime < $day_end) {
diff --git a/functions/template.php b/functions/template.php
index 46a563f..ca214da 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -1,24 +1,20 @@
(.*)<\!-- loop weekday off -->!is", $template, $match1);
- preg_match("!<\!-- loop monthweeks on -->(.*)<\!-- loop monthweeks off -->!is", $template, $match2);
- preg_match("!<\!-- switch notthismonth on -->(.*)<\!-- switch notthismonth off -->!is", $template, $match3);
- preg_match("!<\!-- switch notevent on -->(.*)<\!-- switch notevent off -->!is", $template, $match4);
- preg_match("!<\!-- switch isevent on -->(.*)<\!-- switch isevent off -->!is", $template, $match5);
- preg_match("!<\!-- loop monthweeks on -->(.*)<\!-- switch notthismonth on -->!is", $template, $match6);
- preg_match("!<\!-- switch notevent off -->(.*)<\!-- loop monthweeks off -->!is", $template, $match7);
+ preg_match("!<\!-- loop monthdays on -->(.*)<\!-- loop monthdays off -->!is", $template, $match2);
+ preg_match("!<\!-- loop monthweeks on -->(.*)<\!-- loop monthdays on -->!is", $template, $match6);
+ preg_match("!<\!-- loop monthdays off -->(.*)<\!-- loop monthweeks off -->!is", $template, $match7);
$loop_wd = trim($match1[1]);
- $loop_w = trim($match2[1]);
- $notthismonth = trim($match3[1]);
- $notevent = trim($match4[1]);
- $isevent = trim($match5[1]);
+ $loop_md = trim($match2[1]);
$startweek = trim($match6[1]);
$endweek = trim($match7[1]);
$fake_getdate_time = strtotime($this_year.'-'.$this_month.'-15');
@@ -47,25 +43,39 @@ function draw_month($template, $offset = '+0', $type) {
$start_day = strtotime(dateOfWeek($first_of_month, $week_start_day));
$i = 0;
$whole_month = TRUE;
- $to_replace = array('{DAY}', '{CAL}', '{DAYLINK}', '{MINICAL_VIEW}');
do {
- if ($i == 0) $middle .= $startweek;
- $day = date ("j", $start_day);
- $daylink = date ("Ymd", $start_day);
- $check_month = date ("m", $start_day);
- $replace_with = array($day, $cal, $daylink, $minical_view);
- if ($check_month != $minical_month) {
- $middle .= str_replace($to_replace, $replace_with, $notthismonth);
- } elseif (isset($master_array[$daylink]) && ($check_month == $minical_month)) {
- $middle .= str_replace($to_replace, $replace_with, $isevent);
+ if ($i == 0) $middle .= $startweek; $i++;
+ $temp_middle = $loop_md;
+ $switch = array('notthismonth' => '', 'istoday' => '', 'ismonth' => '', 'noevent' => '', 'anyevent' => '', 'allday' => '', 'event_title' => '', 'cal' => $cal, 'minical_view' => $minical_view);
+ $check_month = date ("m", $start_day);
+ $daylink = date ("Ymd", $start_day);
+ $switch['day'] = date ("j", $start_day);
+ $switch['daylink'] = date ("Ymd", $start_day);
+ $switch['notthismonth'] = ($check_month != $minical_month) ? 'set' : '';
+ $switch['istoday'] = ($switch['daylink'] == $getdate) ? 'set' : '';
+ $switch['ismonth'] = (($switch['istoday'] == '') && ($switch['notthismonth'] == '')) ? 'set' : '';
+ if (isset($master_array[$daylink]['-1'])) {
+ $switch['anyevent'] = 'set';
+ $switch['allday'] = 'set';
+ //$switch['event_title'] = $master_array[$daylink]['-1']['0']['event_text'];
+ //print_r ($master_array[$daylink]['-1']);
+ } elseif (isset($master_array[$daylink])) {
+ $switch['anyevent'] = 'set';
} else {
- $middle .= str_replace($to_replace, $replace_with, $notevent);
+ $switch['noevent'] = 'set';
}
- $start_day = strtotime("+1 day", $start_day);
+ foreach ($switch as $tag => $data) {
+ if (!$data) {
+ $temp_middle = eregi_replace('(.*)', '', $temp_middle);
+ } else {
+ $temp_middle = eregi_replace('{' . $tag . '}', $data, $temp_middle);
+ }
+ }
+ $middle .= $temp_middle;
- $i++;
+ $start_day = strtotime("+1 day", $start_day);
if ($i == 7) {
$i = 0;
$middle .= $endweek;
diff --git a/functions/timezones.php b/functions/timezones.php
index fa42298..8eda9cb 100644
--- a/functions/timezones.php
+++ b/functions/timezones.php
@@ -1,60 +1,60 @@
replace_tags(array(
'next_month' => $next_month,
'prev_month' => $prev_month,
'show_goto' => '',
+ 'is_logged_in' => '',
'list_icals' => $list_icals,
'list_years' => $list_years,
'list_months' => $list_months,
'list_weeks' => $list_weeks,
'style_select' => $style_select,
- 'message' => $message
+ 'generated' => $generated
));
@@ -77,3 +82,6 @@ $page->replace_langs($lang);
$page->output();
+
+
+?>
\ No newline at end of file
diff --git a/templates/default/calendar_nav.tpl b/templates/default/calendar_nav.tpl
index e0cfa47..c32e61f 100644
--- a/templates/default/calendar_nav.tpl
+++ b/templates/default/calendar_nav.tpl
@@ -2,6 +2,13 @@
{MONTH_SMALL|-1}
+
|
@@ -9,7 +16,7 @@
- {L_JUMP_TO} |
+ {L_JUMP} |
@@ -34,36 +41,63 @@
|
+
|
|
-
+
+
+ {CALENDAR_NAME} |
+
+
+
+
+ |
+
+
+
|
|
{MONTH_SMALL|+1}
+
|
\ No newline at end of file
diff --git a/templates/default/footer.tpl b/templates/default/footer.tpl
index 3ce9084..87e6e28 100644
--- a/templates/default/footer.tpl
+++ b/templates/default/footer.tpl
@@ -6,8 +6,9 @@
-{L_THIS_SITE_IS} RSS-Enabled
+{L_THIS_SITE_IS} RSS-Enabled
+Page generated in {GENERATED} seconds.