timematrix now takes into account peoples preference of 12/24 hour

This commit is contained in:
skeeter 2001-03-11 04:17:58 +00:00
parent 30ddc12b8e
commit ab7f21802a
3 changed files with 23 additions and 21 deletions

View File

@ -1421,7 +1421,7 @@ class calendar extends calendar_
$eventstart = $this->localdates($event->datetime); $eventstart = $this->localdates($event->datetime);
$eventend = $this->localdates($event->edatetime); $eventend = $this->localdates($event->edatetime);
$start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100); $start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100);
$starttemp = $this->splittime("$start"); $starttemp = $this->splittime("$start",False);
$subminute = 0; $subminute = 0;
for($m=0;$m<$interval;$m++) for($m=0;$m<$interval;$m++)
{ {
@ -1433,7 +1433,7 @@ class calendar extends calendar_
} }
$start -= $subminute; $start -= $subminute;
$end = ($eventend['hour'] * 10000) + ($eventend['minute'] * 100); $end = ($eventend['hour'] * 10000) + ($eventend['minute'] * 100);
$endtemp = $this->splittime("$end"); $endtemp = $this->splittime("$end",False);
$addminute = 0; $addminute = 0;
for($m=0;$m<$interval;$m++) for($m=0;$m<$interval;$m++)
{ {
@ -1444,8 +1444,8 @@ class calendar extends calendar_
} }
} }
$end += $addminute; $end += $addminute;
$starttemp = $this->splittime("$start"); $starttemp = $this->splittime("$start",False);
$endtemp = $this->splittime("$end"); $endtemp = $this->splittime("$end",False);
// Do not display All-Day events in this free/busy time // Do not display All-Day events in this free/busy time
if((($starttemp['hour'] == 0) && ($starttemp['minute'] == 0)) && (($endtemp['hour'] == 23) && ($endtemp['minute'] == 59))) if((($starttemp['hour'] == 0) && ($starttemp['minute'] == 0)) && (($endtemp['hour'] == 23) && ($endtemp['minute'] == 59)))
{ {

View File

@ -960,7 +960,7 @@ class calendar_ extends calendar__
return $temp; return $temp;
} }
function splittime($time) function splittime($time,$follow_24_rule=True)
{ {
global $phpgw_info; global $phpgw_info;
@ -974,23 +974,25 @@ class calendar_ extends calendar__
$temp['minute'] = $minute; $temp['minute'] = $minute;
$temp['hour'] = $hour; $temp['hour'] = $hour;
$temp['ampm'] = ' '; $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; return $temp;
} }

View File

@ -66,7 +66,7 @@
{ {
case 'free/busy': case 'free/busy':
$freetime = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday,$thisyear); $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; break;
case 'weekly': case 'weekly':
echo $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$participants); echo $phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$participants);