From: <par...@us...> - 2009-05-14 21:24:54
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1735/functions Modified Files: date_functions.php Log Message: Added a function to generate titles from an event array Index: date_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** date_functions.php 5 Feb 2009 15:38:24 -0000 1.52 --- date_functions.php 14 May 2009 21:24:46 -0000 1.53 *************** *** 156,160 **** return $offset; } ! /* 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 --- 156,192 ---- return $offset; } ! ! /* 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 *************** *** 170,186 **** $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); # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) { --- 202,206 ---- $event_text = stripslashes(urldecode($arr["event_text"])); # build tooltip ! $title = makeTitle($arr, $time); # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) { |