From: <jo...@us...> - 2003-09-20 00:35:28
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1:/tmp/cvs-serv20701 Modified Files: list_years.php Log Message: Patch [793606] list_years.php Behavior Incorrect. Correctly displays years for all $num_years values. Index: list_years.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/list_years.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** list_years.php 16 Sep 2003 05:38:34 -0000 1.4 --- list_years.php 20 Sep 2003 00:35:25 -0000 1.5 *************** *** 1,31 **** <?php ! $year_time = strtotime("$getdate"); ! $getdate_year = date("Y", strtotime($getdate)); ! $num_years2 = $num_years; ! //echo "$num_years2"; ! print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">"; ! // build the <option> tags ! for ($i=0; $i < ($num_years2 +2); $i++) { ! $year_time2 = strtotime ("-$num_years2 year", $year_time); ! $yeardate = date("Ymd", $year_time2); ! $year_year = date ("Y", $year_time2); ! print "<option value=\"year.php?cal=$cal&getdate=$yeardate\">$year_year</option>"; ! $num_years2--; } ! $year_time = strtotime("$this_year-01-01"); ! $getdate_year = date("Y", strtotime($getdate)); ! for ($i=0; $i < ($num_years +1); $i++) { ! $year_year = date ("Y", $year_time); ! $yeardate = date("Ymd", $year_time); ! if ($year_year == $getdate_year) { ! print "<option value=\"year.php?cal=$cal&getdate=$yeardate\" selected>$year_year</option>"; ! } else { ! print "<option value=\"year.php?cal=$cal&getdate=$yeardate\">$year_year</option>"; ! } ! $year_time = strtotime ("+1 year", $year_time); } // finish <select> print "</select>"; ! ?> \ No newline at end of file --- 1,31 ---- <?php ! $year_time = strtotime($getdate); ! print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">\n"; ! ! // Print the previous year options. ! for ($i=0; $i < $num_years; $i++) { ! $offset = $num_years - $i; ! $prev_time = strtotime("-$offset year", $year_time); ! $prev_date = date("Ymd", $prev_time); ! $prev_year = date("Y", $prev_time); ! print "<option value=\"year.php?cal=$cal&getdate=$prev_date\">$prev_year</option>\n"; } ! ! // Print the current year option. ! $getdate_date = date("Ymd", $year_time); ! $getdate_year = date("Y", $year_time); ! print "<option value=\"year.php?cal=$cal&getdate=$getdate_date\" selected>$getdate_year</option>\n"; ! ! // Print the next year options. ! for ($i=0; $i < $num_years; $i++) { ! $offset = $i + 1; ! $next_time = strtotime("+$offset year", $year_time); ! $next_date = date("Ymd", $next_time); ! $next_year = date("Y", $next_time); ! print "<option value=\"year.php?cal=$cal&getdate=$next_date\">$next_year</option>\n"; } // finish <select> print "</select>"; ! ?> |