diff options
author | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-28 19:30:41 +0000 |
---|---|---|
committer | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-28 19:30:41 +0000 |
commit | d482264b6af8598ce50677ac6a8f781e219b7d6f (patch) | |
tree | 5bff034467e4ed8e1b1fe442c7de643f112da7f7 /functions/draw_functions.php | |
parent | fc3e1a8590046c858b2ddebdf6c43df8240e9a97 (diff) | |
download | phpicalendar-d482264b6af8598ce50677ac6a8f781e219b7d6f.tar.gz phpicalendar-d482264b6af8598ce50677ac6a8f781e219b7d6f.tar.bz2 phpicalendar-d482264b6af8598ce50677ac6a8f781e219b7d6f.zip |
fix misc bugs; rewrite some places where warnings squelched with @; require php5.1 or greater
Diffstat (limited to 'functions/draw_functions.php')
-rw-r--r-- | functions/draw_functions.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/functions/draw_functions.php b/functions/draw_functions.php index a5a98a9..77564c9 100644 --- a/functions/draw_functions.php +++ b/functions/draw_functions.php @@ -1,21 +1,23 @@ <?php -// function returns starttime and endtime and event length for drawing into a grid - +# drawEventTimes returns starttime and endtime and event length for drawing into a grid function drawEventTimes ($start, $end) { global $phpiCal_config; + $sta_h = $sta_min = $end_h = $end_min = "00"; $gridLength = $phpiCal_config->gridLength; - preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time); - $sta_h = @$time[1]; - $sta_min = @$time[2]; + if (preg_match ('/([0-9]{2})([0-9]{2})/', $start, $time)){ + $sta_h = $time[1]; + $sta_min = $time[2]; + } $sta_min = sprintf("%02d", floor($sta_min / $gridLength) * $gridLength); if ($sta_min == 60) { $sta_h = sprintf("%02d", ($sta_h + 1)); $sta_min = "00"; } - preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time); - $end_h = @$time[1]; - $end_min = @$time[2]; + if (preg_match ('/([0-9]{2})([0-9]{2})/', $end, $time)){ + $end_h = $time[1]; + $end_min = $time[2]; + } $end_min = sprintf("%02d", floor($end_min / $gridLength) * $gridLength); if ($end_min == 60) { $end_h = sprintf("%02d", ($end_h + 1)); @@ -28,10 +30,8 @@ function drawEventTimes ($start, $end) { $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); } |