Calendar now has a little support for Arabic calendars.

This commit is contained in:
skeeter 2001-05-17 00:26:36 +00:00
parent ec58a63c0f
commit 325831f748
2 changed files with 62 additions and 35 deletions

View File

@ -220,42 +220,67 @@ class calendar extends calendar_
global $phpgw_info; global $phpgw_info;
$weekday = $this->day_of_week($year,$month,$day); $weekday = $this->day_of_week($year,$month,$day);
if ($phpgw_info['user']['preferences']['calendar']['weekdaystarts'] == 'Monday') switch($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])
{ {
$days = Array( case 'Monday':
0 => 'Mon', $days = Array(
1 => 'Tue', 0 => 'Mon',
2 => 'Wed', 1 => 'Tue',
3 => 'Thu', 2 => 'Wed',
4 => 'Fri', 3 => 'Thu',
5 => 'Sat', 4 => 'Fri',
6 => 'Sun' 5 => 'Sat',
); 6 => 'Sun'
switch($weekday) );
{ switch($weekday)
case 0: {
$sday = mktime(2,0,0,$month,$day - 6,$year); case 0:
break; $sday = mktime(2,0,0,$month,$day - 6,$year);
case 1: break;
$sday = mktime(2,0,0,$month,$day,$year); case 1:
break; $sday = mktime(2,0,0,$month,$day,$year);
default: break;
$sday = mktime(2,0,0,$month,$day - ($weekday - 1),$year); default:
break; $sday = mktime(2,0,0,$month,$day - ($weekday - 1),$year);
} break;
} }
else break;
{ case 'Sunday':
$days = Array( $days = Array(
0 => 'Sun', 0 => 'Sun',
1 => 'Mon', 1 => 'Mon',
2 => 'Tue', 2 => 'Tue',
3 => 'Wed', 3 => 'Wed',
4 => 'Thu', 4 => 'Thu',
5 => 'Fri', 5 => 'Fri',
6 => 'Sat' 6 => 'Sat'
); );
$sday = mktime(2,0,0,$month,$day - $weekday,$year); $sday = mktime(2,0,0,$month,$day - $weekday,$year);
break;
// The following is for Arabic support.....
case 'Saturday':
$days = Array(
0 => 'Sat',
1 => 'Sun',
2 => 'Mon',
3 => 'Tue',
4 => 'Wed',
5 => 'Thu',
6 => 'Fri'
);
switch($weekday)
{
case 0:
$sday = mktime(2,0,0,$month,$day - 1,$year);
break;
case 6:
$sday = mktime(2,0,0,$month,$day,$year);
break;
default:
$sday = mktime(2,0,0,$month,$day - ($weekday + 1),$year);
break;
}
break;
} }
$this->days = $days; $this->days = $days;

View File

@ -120,6 +120,8 @@
$str = '<select name="weekdaystarts">' $str = '<select name="weekdaystarts">'
. '<option value="Monday"'.$t_weekday['Monday'].'>'.lang('Monday').'</option>' . '<option value="Monday"'.$t_weekday['Monday'].'>'.lang('Monday').'</option>'
. '<option value="Sunday"'.$t_weekday['Sunday'].'>'.lang('Sunday').'</option>' . '<option value="Sunday"'.$t_weekday['Sunday'].'>'.lang('Sunday').'</option>'
// The following is for Arabic support.....
. '<option value="Saturday"'.$t_weekday['Saturday'].'>'.lang('Saturday').'</option>'
. '</select>'; . '</select>';
display_item(lang('weekday starts on'),$str); display_item(lang('weekday starts on'),$str);