aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Oster <parasytic@users.sourceforge.net>2009-07-08 18:28:13 +0000
committerJason Oster <parasytic@users.sourceforge.net>2009-07-08 18:28:13 +0000
commitca4ff2e70c0e5de884c77d5183a603b741f9e05d (patch)
treea04a6fd3518d5914d55a07dc7a942c59fe2d913a
parentbc77101e73f5fdf8eeddf9bbb1d434fb396fb089 (diff)
downloadphpicalendar-ca4ff2e70c0e5de884c77d5183a603b741f9e05d.zip
phpicalendar-ca4ff2e70c0e5de884c77d5183a603b741f9e05d.tar.gz
phpicalendar-ca4ff2e70c0e5de884c77d5183a603b741f9e05d.tar.bz2
Fix overlapping events which span a day, fix erroneously adding 15 minutes to events which span a day or more and end on the same time they start, add day-spanning icons in day and week views
-rw-r--r--functions/draw_functions.php7
-rw-r--r--functions/parse/end_vevent.php4
-rw-r--r--functions/parse/overlapping_events.php4
-rw-r--r--functions/template.php28
-rw-r--r--images/longevent_end.gifbin0 -> 57 bytes
-rw-r--r--images/longevent_mid.gifbin0 -> 56 bytes
-rw-r--r--images/longevent_start.gifbin0 -> 57 bytes
7 files changed, 36 insertions, 7 deletions
diff --git a/functions/draw_functions.php b/functions/draw_functions.php
index 77564c9..836d41f 100644
--- a/functions/draw_functions.php
+++ b/functions/draw_functions.php
@@ -1,6 +1,6 @@
<?php
# drawEventTimes returns starttime and endtime and event length for drawing into a grid
-function drawEventTimes ($start, $end) {
+function drawEventTimes ($start, $end, $long_event = FALSE) {
global $phpiCal_config;
$sta_h = $sta_min = $end_h = $end_min = "00";
$gridLength = $phpiCal_config->gridLength;
@@ -24,14 +24,15 @@ function drawEventTimes ($start, $end) {
$end_min = "00";
}
- if (($sta_h . $sta_min) == ($end_h . $end_min)) {
+ if ((!$long_event) && (($sta_h . $sta_min) == ($end_h . $end_min))) {
$end_min += $gridLength;
if ($end_min == 60) {
$end_h = sprintf("%02d", ($end_h + 1));
$end_min = "00";
}
- }
+ }
$draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min);
+
return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len);
}
diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php
index 8e8186a..a6546d5 100644
--- a/functions/parse/end_vevent.php
+++ b/functions/parse/end_vevent.php
@@ -66,7 +66,7 @@ if ($length < 0){
$end_time = $start_time;
}
# get hour and minute adjusted to allowed grid times
-$drawKey = drawEventTimes($start_time, $end_time);
+$drawKey = drawEventTimes($start_time, $end_time, ($length >= (60*60*24)));
preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3);
preg_match ('/([0-9]{2})([0-9]{2})/', $drawKey['draw_end'], $time4);
$hour = $time3[1];
@@ -349,7 +349,7 @@ foreach($recur_data as $recur_data_unixtime) {
'sequence' => $sequence,
'recur' => $recur
);
- }
+ }
if($time_key > -1) checkOverlap($this_date_tmp, $time_key, $uid);
}
} # end foreach recur_data
diff --git a/functions/parse/overlapping_events.php b/functions/parse/overlapping_events.php
index cca0ce5..509d94a 100644
--- a/functions/parse/overlapping_events.php
+++ b/functions/parse/overlapping_events.php
@@ -140,7 +140,9 @@ function checkOverlap($event_date, $event_time, $uid) {
$ol_day_array = @$overlap_array[$event_date];
$draw_end = $event['event_end'];
if (isset($event['display_end'])) $draw_end = $event['display_end'];
- $drawTimes = drawEventTimes($event['event_start'], $draw_end);
+ $drawTimes = drawEventTimes($event['event_start'], $draw_end, ($event['event_length'] >= (60*60*24)));
+ if ($event_time == "0000") $drawTimes['draw_start'] = "0000";
+ if ($draw_end == "2400") $drawTimes['draw_end'] = "2400";
// Track if $event has been merged in, so we don't re-add the details to 'event' or 'overlapRanges' multiple times.
$already_merged_once = false;
diff --git a/functions/template.php b/functions/template.php
index 9ce5124..1400873 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -266,7 +266,7 @@ class Page {
# ovlKey is a time slot; $ovlValue is an array with key=uid
if ($ovlKey != "-1") {
foreach($ovlValue as $ovl2Value) {
- $nbrGridCols[($thisday)] = kgv($nbrGridCols[($thisday)], ($ovl2Value["event_overlap"] + 1));
+ $nbrGridCols[$thisday] = kgv($nbrGridCols[$thisday], ($ovl2Value["event_overlap"] + 1));
}
}
}
@@ -508,6 +508,19 @@ class Page {
if ($event_status != '') {
$confirmed .= '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
}
+ $event_date_start = date('Ymd', $this_time_arr[$uid]['start_unixtime']);
+ $event_date_end = date('Ymd', $this_time_arr[$uid]['end_unixtime']);
+ if ($event_date_start != $event_date_end) {
+ if ($thisday == $event_date_start) {
+ $confirmed .= '<img src="images/longevent_start.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
+ }
+ else if ($thisday == $event_date_end) {
+ $confirmed .= '<img src="images/longevent_end.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
+ }
+ else {
+ $confirmed .= '<img src="images/longevent_mid.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
+ }
+ }
$event_temp = $loop_event;
$event = openevent($thisday, $cal_time, $uid, $this_time_arr[$uid], $phpiCal_config->week_events_lines, 25, 'ps');
$weekdisplay .= '<td rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n";
@@ -731,6 +744,19 @@ class Page {
$confirmed = '';
if (is_array($event_recur)) $confirmed .= '<img src="images/recurring.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
if ($event_status != '') $confirmed .= '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
+ $event_date_start = date('Ymd', $this_time_arr[$uid]['start_unixtime']);
+ $event_date_end = date('Ymd', $this_time_arr[$uid]['end_unixtime']);
+ if ($event_date_start != $event_date_end) {
+ if ($getdate == $event_date_start) {
+ $confirmed .= '<img src="images/longevent_start.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
+ }
+ else if ($getdate == $event_date_end) {
+ $confirmed .= '<img src="images/longevent_end.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
+ }
+ else {
+ $confirmed .= '<img src="images/longevent_mid.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
+ }
+ }
$daydisplay .= '<td rowspan="' . $event_length[$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n";
// Start drawing the event
diff --git a/images/longevent_end.gif b/images/longevent_end.gif
new file mode 100644
index 0000000..5e55240
--- /dev/null
+++ b/images/longevent_end.gif
Binary files differ
diff --git a/images/longevent_mid.gif b/images/longevent_mid.gif
new file mode 100644
index 0000000..ae7825e
--- /dev/null
+++ b/images/longevent_mid.gif
Binary files differ
diff --git a/images/longevent_start.gif b/images/longevent_start.gif
new file mode 100644
index 0000000..bccf0ca
--- /dev/null
+++ b/images/longevent_start.gif
Binary files differ

© 2014-2020 Faster IT GmbH | imprint | privacy policy