diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index f9cda31633..4ecb63b42b 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -1421,7 +1421,7 @@ class calendar extends calendar_ $eventstart = $this->localdates($event->datetime); $eventend = $this->localdates($event->edatetime); $start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100); - $starttemp = $this->splittime("$start"); + $starttemp = $this->splittime("$start",False); $subminute = 0; for($m=0;$m<$interval;$m++) { @@ -1433,7 +1433,7 @@ class calendar extends calendar_ } $start -= $subminute; $end = ($eventend['hour'] * 10000) + ($eventend['minute'] * 100); - $endtemp = $this->splittime("$end"); + $endtemp = $this->splittime("$end",False); $addminute = 0; for($m=0;$m<$interval;$m++) { @@ -1444,8 +1444,8 @@ class calendar extends calendar_ } } $end += $addminute; - $starttemp = $this->splittime("$start"); - $endtemp = $this->splittime("$end"); + $starttemp = $this->splittime("$start",False); + $endtemp = $this->splittime("$end",False); // Do not display All-Day events in this free/busy time if((($starttemp['hour'] == 0) && ($starttemp['minute'] == 0)) && (($endtemp['hour'] == 23) && ($endtemp['minute'] == 59))) { diff --git a/calendar/inc/class.calendar_sql.inc.php b/calendar/inc/class.calendar_sql.inc.php index 6edddc2291..32164a5fc7 100755 --- a/calendar/inc/class.calendar_sql.inc.php +++ b/calendar/inc/class.calendar_sql.inc.php @@ -960,7 +960,7 @@ class calendar_ extends calendar__ return $temp; } - function splittime($time) + function splittime($time,$follow_24_rule=True) { global $phpgw_info; @@ -974,23 +974,25 @@ class calendar_ extends calendar__ $temp['minute'] = $minute; $temp['hour'] = $hour; $temp['ampm'] = ' '; - if ($phpgw_info['user']['preferences']['common']['timeformat'] == '24') + if($follow_24_rule == True) { - return $temp; + if ($phpgw_info['user']['preferences']['common']['timeformat'] == '24') + { + return $temp; + } + + $temp['ampm'] = 'am'; + + if ((int)$temp['hour'] > 12) + { + $temp['hour'] = (int)((int)$temp['hour'] - 12); + $temp['ampm'] = 'pm'; + } + elseif ((int)$temp['hour'] == 12) + { + $temp['ampm'] = 'pm'; + } } - - $temp['ampm'] = 'am'; - - if ((int)$temp['hour'] > 12) - { - $temp['hour'] = (int)((int)$temp['hour'] - 12); - $temp['ampm'] = 'pm'; - } - elseif ((int)$temp['hour'] == 12) - { - $temp['ampm'] = 'pm'; - } - return $temp; } diff --git a/calendar/viewmatrix.php b/calendar/viewmatrix.php index fee518c391..4a2bdf5d8f 100755 --- a/calendar/viewmatrix.php +++ b/calendar/viewmatrix.php @@ -66,7 +66,7 @@ { case 'free/busy': $freetime = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday,$thisyear); - echo $phpgw->calendar->timematrix($freetime,$phpgw->calendar->splittime('000000'),0,$participants); + echo $phpgw->calendar->timematrix($freetime,$phpgw->calendar->splittime('000000',False),0,$participants); break; case 'weekly': echo $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$participants);