aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorWesley Miaw <josuah@users.sourceforge.net>2003-09-20 00:35:25 +0000
committerWesley Miaw <josuah@users.sourceforge.net>2003-09-20 00:35:25 +0000
commit6b386a7b724aac7510293ff277c285bc7450cd34 (patch)
tree736bdca04d2c5fc443e39da19a4706ae2f764684 /functions
parent25050f516fa8cad213724f18345ef6c2af8b1ab0 (diff)
downloadphpicalendar-6b386a7b724aac7510293ff277c285bc7450cd34.tar.gz
phpicalendar-6b386a7b724aac7510293ff277c285bc7450cd34.tar.bz2
phpicalendar-6b386a7b724aac7510293ff277c285bc7450cd34.zip
Patch [793606] list_years.php Behavior Incorrect.
Correctly displays years for all $num_years values.
Diffstat (limited to 'functions')
-rw-r--r--functions/list_years.php48
1 files changed, 24 insertions, 24 deletions
diff --git a/functions/list_years.php b/functions/list_years.php
index f5e823e..7b9c8de 100644
--- a/functions/list_years.php
+++ b/functions/list_years.php
@@ -1,31 +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&amp;getdate=$yeardate\">$year_year</option>";
- $num_years2--;
+$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&amp;getdate=$prev_date\">$prev_year</option>\n";
}
-$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&amp;getdate=$yeardate\" selected>$year_year</option>";
- } else {
- print "<option value=\"year.php?cal=$cal&amp;getdate=$yeardate\">$year_year</option>";
- }
- $year_time = strtotime ("+1 year", $year_time);
+
+// Print the current year option.
+$getdate_date = date("Ymd", $year_time);
+$getdate_year = date("Y", $year_time);
+print "<option value=\"year.php?cal=$cal&amp;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&amp;getdate=$next_date\">$next_year</option>\n";
}
// finish <select>
print "</select>";
-?> \ No newline at end of file
+?>

© 2014-2024 Faster IT GmbH | imprint | privacy policy