From 6a6d2f63d22c3c418ad76c2e34bedbfe8806d1b5 Mon Sep 17 00:00:00 2001 From: Scott Dale Date: Wed, 28 Mar 2007 21:10:27 +0000 Subject: Monday is first now --- usr/local/www/firewall_schedule.php | 8 ++-- usr/local/www/firewall_schedule_edit.php | 75 ++++++++++++++++---------------- 2 files changed, 41 insertions(+), 42 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/firewall_schedule.php b/usr/local/www/firewall_schedule.php index c4aab1c..81c6666 100644 --- a/usr/local/www/firewall_schedule.php +++ b/usr/local/www/firewall_schedule.php @@ -33,7 +33,7 @@ $pgtitle = "Firewall: Schedules"; -$dayArray = array ('Sun','Mon','Tues','Wed','Thur','Fri','Sat'); +$dayArray = array ('Mon','Tues','Wed','Thur','Fri','Sat','Sun'); $monthArray = array ('January','February','March','April','May','June','July','August','September','October','November','December'); require("guiconfig.inc"); @@ -156,9 +156,9 @@ include("head.inc"); $dayFriendly .= ", "; $currentDay--; if ($currentDay != $firstDay) - $dayFriendly .= $dayArray[$firstDay] . " - " . $dayArray[$currentDay]; + $dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; else - $dayFriendly .= $dayArray[$firstDay]; + $dayFriendly .= $dayArray[$firstDay-1]; $firstDayFound = false; $firstprint = true; } @@ -168,7 +168,7 @@ include("head.inc"); } - $dayFriendly .= ": " . $starttime . "-" . $stoptime; + $dayFriendly .= " : " . $starttime . "-" . $stoptime . " : " . $timerange['rangedescr']; echo $dayFriendly; echo "
"; } diff --git a/usr/local/www/firewall_schedule_edit.php b/usr/local/www/firewall_schedule_edit.php index 28b71ec..91fabd0 100644 --- a/usr/local/www/firewall_schedule_edit.php +++ b/usr/local/www/firewall_schedule_edit.php @@ -39,7 +39,7 @@ $starttimemin = 00; $stoptimehr = 23; $stoptimemin = 59; -$dayArray = array ('Sun','Mon','Tues','Wed','Thur','Fri','Sat'); +$dayArray = array ('Mon','Tues','Wed','Thur','Fri','Sat','Sun'); $monthArray = array ('January','February','March','April','May','June','July','August','September','October','November','December'); if (!is_array($config['schedules']['schedule'])) @@ -129,8 +129,7 @@ if ($_POST) { $monthpos = strpos($currentselection, "m"); $daypos = strpos($currentselection, "d"); $monthstr .= substr($currentselection, $monthpos+1, $daypos-$monthpos-1); - $daystr .= substr($currentselection, $daypos+1); - + $daystr .= substr($currentselection, $daypos+1); $firstprint = true; } } @@ -181,7 +180,7 @@ $jscriptstr = << - + -
" z-index:-1000; style="position:relative; display:"> +
" z-index:-1000; style="position:relative; display:"> - + - - + + "; } @@ -767,18 +771,14 @@ EOD; echo ""; } - //if day is Sunday, - if ($positioncounter == 6) - { - $positioncounter = 0; - $weekcounter = date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter+1), date("Y"))); - //trim leading zeros - $weekcounter = ltrim($weekcounter, "0"); + if ($positioncounter ==7){ + $positioncounter = 1; echo ""; } else{ $positioncounter++; - } + } + }//end while loop?>
Sun
Mon Tue Wed Thu Fri SatSun
@@ -787,6 +787,7 @@ EOD; if ($monthcounter == 12) { $monthcounter = 1; + $yearcounter++; } else { @@ -916,22 +917,20 @@ EOD; $month = $tempmontharray[$arraycounter]; $day = $tempdayarray[$arraycounter]; $daypos = date("w", mktime(0, 0, 0, date($month), date($day), date("Y"))); - //if sunday, move to monday to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this. + //if sunday, set position to 7 to get correct week number. This is due to php limitations on ISO-8601. When we move to php5.1 we can change this. if ($daypos == 0) - $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day+1), date("Y"))); - else - $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y"))); - + $day = 7; + $weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y"))); $weeknumber = ltrim($weeknumber, "0"); $monthstr = $monthArray[$month-1]; $tempFriendlyTime .= $monthstr . " " . $day . ","; - - $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day; - if (!$firstPrint) + if ($firstPrint) { $tempID .= ","; - $firstPrint = true; } + $tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day; + $firstPrint = true; + $arraycounter++; } } @@ -969,9 +968,9 @@ EOD; $tempFriendlyTime .= ", "; $currentDay--; if ($currentDay != $firstDay) - $tempFriendlyTime .= $dayArray[$firstDay] . " - " . $dayArray[$currentDay]; + $tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1]; else - $tempFriendlyTime .= $dayArray[$firstDay]; + $tempFriendlyTime .= $dayArray[$firstDay-1]; $firstDayFound = false; $firstprint = true; } -- cgit v1.1