aboutsummaryrefslogtreecommitdiffstats
path: root/functions/draw_functions.php
diff options
context:
space:
mode:
authordrei <drei>2002-09-27 23:30:30 +0000
committerdrei <drei>2002-09-27 23:30:30 +0000
commit436915acdd8c8682badd8fd53aec817590378986 (patch)
tree02b237c29f91b8b58751f5b206ffe94f19468b42 /functions/draw_functions.php
parent190cc7bd480ec34ecb0362ac54274d9be8835a7e (diff)
downloadphpicalendar-436915acdd8c8682badd8fd53aec817590378986.tar.gz
phpicalendar-436915acdd8c8682badd8fd53aec817590378986.tar.bz2
phpicalendar-436915acdd8c8682badd8fd53aec817590378986.zip
functions for drawing events in day grid.
Diffstat (limited to 'functions/draw_functions.php')
-rw-r--r--functions/draw_functions.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/functions/draw_functions.php b/functions/draw_functions.php
new file mode 100644
index 0000000..ee7fd91
--- /dev/null
+++ b/functions/draw_functions.php
@@ -0,0 +1,38 @@
+<?php
+// function returns starttime and endtime and event length for drawing into a grid
+
+function drawEventTimes ($start, $end) {
+ global $gridLength;
+
+ ereg ("([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";
+ }
+
+ ereg ("([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));
+ $end_min = "00";
+ }
+
+ if (($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);
+}
+
+?> \ No newline at end of file

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