[Comoblog-commit] comoblog/modules/mod_calendar mod_calendar.php,1.3,1.4
Status: Inactive
Brought to you by:
markwallis
|
From: Mark W. \(a. serialmonkey\) <mar...@us...> - 2005-10-07 15:29:55
|
Update of /cvsroot/comoblog/comoblog/modules/mod_calendar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17367/modules/mod_calendar Modified Files: mod_calendar.php Log Message: Update mod_calendar to allow day offset to be a select string rather than an integer Index: mod_calendar.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/modules/mod_calendar/mod_calendar.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mod_calendar.php 7 Oct 2005 15:14:57 -0000 1.3 +++ mod_calendar.php 7 Oct 2005 15:29:47 -0000 1.4 @@ -11,7 +11,37 @@ else $mod_calendar_tpl->assign('ARROW_RIGHT', 'modules/mod_calendar/img/right.gif' ); - +function convert_offset ($str) +{ + $val = 0; + + switch ($str) + { + case "Sunday": + $val = 0; + break; + case "Monday": + $val = 1; + break; + case "Tuesday": + $val = 2; + break; + case "Wednesday": + $val = 3; + break; + case "Thursday": + $val = 4; + break; + case "Friday": + $val = 5; + break; + case "Saturday": + $val = 6; + break; + } + + return $val; +} function start_day ($month, $year) { @@ -29,7 +59,7 @@ $start_day = ($total_days_since_1901 + 2) % 7; - $start_day = $start_day - CFG_CALENDAR_DAY_OFFSET; + $start_day = $start_day - convert_offset(CFG_CALENDAR_DAY_OFFSET); if ($start_day == 0) { $start_day = 7; @@ -100,9 +130,11 @@ $cnt = 0; +$offset = convert_offset(CFG_CALENDAR_DAY_OFFSET); + while ($cnt < 7) { - $val = ($cnt + CFG_CALENDAR_DAY_OFFSET) % 7; + $val = ($cnt + $offset) % 7; switch ($val) { |