Update of /cvsroot/phpicalendar/phpicalendar/functions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19974/phpicalendar/functions
Modified Files:
template.php
Log Message:
Change print and month view listings to omit duplicates
Index: template.php
===================================================================
RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -d -r1.87 -r1.88
*** template.php 5 Dec 2006 08:40:18 -0000 1.87
--- template.php 8 Apr 2007 01:41:55 -0000 1.88
***************
*** 63,67 ****
$parse_month = date ("Ym", strtotime($getdate));
$parse_year = date ("Y", strtotime($getdate));
!
foreach($master_array as $key => $val) {
preg_match ('/([0-9]{6})([0-9]{2})/', $key, $regs);
--- 63,68 ----
$parse_month = date ("Ym", strtotime($getdate));
$parse_year = date ("Y", strtotime($getdate));
!
! $seen_events = array();
foreach($master_array as $key => $val) {
preg_match ('/([0-9]{6})([0-9]{2})/', $key, $regs);
***************
*** 72,79 ****
$events_tmp = $loop_event;
$day_tmp = $loop_day;
!
// Pull out each day
foreach ($val as $new_val) {
foreach ($new_val as $new_key2 => $new_val2) {
if ($new_val2['event_text']) {
$event_text = stripslashes(urldecode($new_val2['event_text']));
--- 73,86 ----
$events_tmp = $loop_event;
$day_tmp = $loop_day;
! $day_events = 0;
// Pull out each day
foreach ($val as $new_val) {
foreach ($new_val as $new_key2 => $new_val2) {
+ if (isset($seen_events["$new_key2"])){
+ $new_val2['event_text'] .= " second instance of ".$new_key2;
+ continue;
+ }
+ $seen_events["$new_key2"] = 1;
+ $day_events++;
if ($new_val2['event_text']) {
$event_text = stripslashes(urldecode($new_val2['event_text']));
***************
*** 91,94 ****
--- 98,102 ----
$event_end = date ($timeFormat, strtotime ($event_end));
$event_start = $event_start .' - '.$event_end;
+ if (date("Ymd", $new_val2['start_unixtime']) != date("Ymd", $new_val2['end_unixtime'])) $event_start .= " ".localizeDate($dateFormat_day, $new_val2['end_unixtime']);
}
}
***************
*** 109,112 ****
--- 117,121 ----
}
}
+ if ($day_events == 0) continue;
$day_tmp = str_replace('{DAYOFMONTH}', $dayofmonth, $day_tmp);
$final .= $day_tmp.$some_events;
***************
*** 986,989 ****
--- 995,999 ----
$u_start = strtotime($m_start);
$i=0;
+ $seen_events = array();
do {
if (isset($master_array[$m_start])) {
***************
*** 992,995 ****
--- 1002,1007 ----
$switch['START_DATE'] = localizeDate ($dateFormat_week_list, $u_start);
foreach ($event_times as $uid => $val) {
+ if (isset($seen_events[$uid])) continue;
+ $seen_events[$uid] = 1;
$switch['CALNAME'] = $val['calname'];
if (!isset($val['event_start'])) {
|