diff options
author | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-26 16:59:10 +0000 |
---|---|---|
committer | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-26 16:59:10 +0000 |
commit | a02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36 (patch) | |
tree | cd5c150b2490fdcb9503f4aa581dff868cf9170b /functions | |
parent | ae9ce41d6df68ed6449f296dd8af48590d27157d (diff) | |
download | phpicalendar-a02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36.tar.gz phpicalendar-a02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36.tar.bz2 phpicalendar-a02ca8fd76dfa6b0f280780f76fb9bfce5a9fd36.zip |
eliminate negative event lengths and adjust display lengths for short events
Diffstat (limited to 'functions')
-rw-r--r-- | functions/parse/end_vevent.php | 11 | ||||
-rw-r--r-- | functions/template.php | 8 |
2 files changed, 13 insertions, 6 deletions
diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php index 4c5c352..3f14924 100644 --- a/functions/parse/end_vevent.php +++ b/functions/parse/end_vevent.php @@ -48,7 +48,12 @@ if (isset($start_time) && isset($end_time)) { $allday_end = ($start_date + 1); } } - +# disallow events with negative length +if ($end_unixtime < $start_unixtime){ + $end_date = $start_date; + $end_time = $start_time; + $end_unixtime = $start_unixtime; +} # look for events that span more than one day if (isset($start_unixtime,$end_unixtime) && date('Ymd',$start_unixtime) != date('Ymd',$end_unixtime)) { $spans_day = true; @@ -63,9 +68,9 @@ if (isset($start_time) && $start_time != '') { preg_match ('/([0-9]{2})([0-9]{2})/', $start_time, $time); preg_match ('/([0-9]{2})([0-9]{2})/', $end_time, $time2); if (isset($start_unixtime) && isset($end_unixtime)) { - $length = $end_unixtime - $start_unixtime; + $length = $end_unixtime - $start_unixtime; } else { - $length = ($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]); + $length = ($time2[1]*60+$time2[2]) - ($time[1]*60+$time[2]); } $drawKey = drawEventTimes($start_time, $end_time); diff --git a/functions/template.php b/functions/template.php index 4df442c..bf4f340 100644 --- a/functions/template.php +++ b/functions/template.php @@ -359,7 +359,6 @@ class Page { $key = mktime($regs_tmp[1],$regs_tmp[2],0,$this_month,$this_day,$this_year); $key = date ($timeFormat, $key); - if (ereg("([0-9]{1,2}):00", $key)) { $weekdisplay .= '<tr>'; $weekdisplay .= '<td colspan="4" rowspan="' . (60 / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>'; @@ -466,11 +465,14 @@ class Page { $confirmed .= '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" /> '; } $colspan_width = round((80 / $nbrGridCols[$thisday]) * $drawWidth); + $event_temp = $loop_event; + $event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps'); + # adjust length by rough guess to word wrapping + $event_text_lines = ceil((strlen(strip_tags(trim($event))) * 8)/$colspan_width) + 1; + if ($event_length[$thisday][$i]['length'] < $event_text_lines) $event_length[$thisday][$i]['length'] = $event_text_lines; $weekdisplay .= '<td width="'.$colspan_width.'" rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n"; // Start drawing the event - $event_temp = $loop_event; - $event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps'); $event_temp = str_replace('{EVENT}', $event, $event_temp); $event_temp = str_replace('{EVENT_START}', $event_start, $event_temp); $event_temp = str_replace('{CONFIRMED}', $confirmed, $event_temp); |