aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorJason Oster <parasytic@users.sourceforge.net>2009-05-14 21:24:46 +0000
committerJason Oster <parasytic@users.sourceforge.net>2009-05-14 21:24:46 +0000
commit7fef857492a9dc200e555c7ae3c2885f7da2aee8 (patch)
tree9fe6ed92b18b6dd6d65d103471ab114c45940fc1 /functions
parentef85825abc5bd774e3554a6533fc9241ba0eac8e (diff)
downloadphpicalendar-7fef857492a9dc200e555c7ae3c2885f7da2aee8.tar.gz
phpicalendar-7fef857492a9dc200e555c7ae3c2885f7da2aee8.tar.bz2
phpicalendar-7fef857492a9dc200e555c7ae3c2885f7da2aee8.zip
Added a function to generate titles from an event array
Diffstat (limited to 'functions')
-rw-r--r--functions/date_functions.php48
1 files changed, 34 insertions, 14 deletions
diff --git a/functions/date_functions.php b/functions/date_functions.php
index 0aa9704..3d55d7b 100644
--- a/functions/date_functions.php
+++ b/functions/date_functions.php
@@ -155,7 +155,39 @@ function chooseOffset($time, $timezone = '') {
}
return $offset;
}
-/* Returns a string to make event text with a link to popup boxes
+
+/* Returns a string to be used in HTML title attributes
+ $arr is a master array item
+ $time is the event's UNIX timestamp
+*/
+function makeTitle($arr, $time) {
+ global $timeFormat, $dateFormat_week;
+
+ $event_text = stripslashes(urldecode($arr["event_text"]));
+ if ($time == -1) {
+ $start = localizeDate($dateFormat_week, $arr['start_unixtime']);
+ $end = localizeDate($dateFormat_week, ($arr['end_unixtime'] - 60));
+ $title = $event_text;
+ if ($start != $end) $title .= "\n$start - $end";
+ } else {
+ $start = date($timeFormat, $arr['start_unixtime']);
+ $end = date($timeFormat, $arr['end_unixtime']);
+ $title = "$start: $event_text";
+ if ($start != $end) $title = "$event_text\n$start - $end";
+ }
+
+ if (!empty($arr['description'])) {
+ $title .= "\n\nDescription: ".urldecode($arr['description']);
+ }
+ if (!empty($arr['location'])) {
+ $title .= "\n\nLocation: ".urldecode($arr['location']);
+ }
+ $title = trim($title);
+
+ return $title;
+}
+
+/* Returns a string to make event text with a link to popup boxes
$arr is a master array item
$lines is the number of lines to restrict the event_text to, using word_wrap
$length is the length of one line
@@ -169,19 +201,7 @@ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $lin
$return = '';
$event_text = stripslashes(urldecode($arr["event_text"]));
# build tooltip
- if ($time == -1) {
- $start = localizeDate($dateFormat_week, $arr['start_unixtime']);
- $end = localizeDate($dateFormat_week, ($arr['end_unixtime'] - 60));
- $title = $event_text;
- if ($start != $end) $title = "$start - $end $event_text";
- } else {
- $start = date($timeFormat, $arr['start_unixtime']);
- $end = date($timeFormat, $arr['end_unixtime']);
- $title = "$start: $event_text";
- if ($start != $end) $title = "$start - $end $event_text";
- }
- $title .= "\n".urldecode($arr['description'])."\n".urldecode($arr['location']);
- $title = trim($title);
+ $title = makeTitle($arr, $time);
# for iCal pseudo tag <http> comptability
if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) {
$full_event_text = $matches[1] . $matches[2];

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