diff --git a/trunk/sites/all/modules/map/modules/map_proposition/theme.inc b/trunk/sites/all/modules/map/modules/map_proposition/theme.inc index 6d80a9e..a21a3e3 100644 --- a/trunk/sites/all/modules/map/modules/map_proposition/theme.inc +++ b/trunk/sites/all/modules/map/modules/map_proposition/theme.inc @@ -1812,14 +1812,17 @@ function map_proposition_next_contest($jurisdiction_codes = array()) { $contest = map_proposition_election_load(); $election_date = map_cvg_get_ballot_date(); $jurisdiction_codes = map_proposition_get_ballot_jurisdictions($jurisdiction_codes); + $next_content_link = t('Next'); // If we're actually under a contest, get the Next Jurisdiction link // (for the forward arrow button in the title bar). if ($contest) { $items = map_proposition_get_ballot_contests($jurisdiction_codes, $election_date, $office_id); if (is_array($items) && count($items) > 1) { + $limit = count($items) + 1; + $counter = 0; $found = FALSE; - while ($item = array_shift($items)) { + while ($item = array_shift($items) && $counter <= $limit) { // Put it back on the end of the list so we can go round & round. Like // the wheels on the bus. array_push($items, $item); @@ -1850,6 +1853,7 @@ function map_proposition_next_contest($jurisdiction_codes = array()) { if (strpos($_GET['q'], $contest_test->url) === 0) { $found = TRUE; } + $counter++; } } } @@ -1864,14 +1868,17 @@ function map_proposition_previous_contest($jurisdiction_codes = array()) { $contest = map_proposition_election_load(); $election_date = map_cvg_get_ballot_date(); $jurisdiction_codes = map_proposition_get_ballot_jurisdictions($jurisdiction_codes); + $prev_content_link = t('Prev'); // If we're actually under a contest, get the Next Jurisdiction link // (for the forward arrow button in the title bar). if ($contest) { $items = array_reverse(map_proposition_get_ballot_contests($jurisdiction_codes, $election_date, $office_id)); if (is_array($items) && count($items) > 1) { + $limit = count($items) + 1; + $counter = 0; $found = FALSE; - while ($item = array_shift($items)) { + while ($item = array_shift($items) && $counter <= $limit) { // Put it back on the end of the list so we can go round & round. Like // the wheels on the bus. @@ -1903,6 +1910,7 @@ function map_proposition_previous_contest($jurisdiction_codes = array()) { if (strpos($_GET['q'], $contest_test->url) === 0) { $found = TRUE; } + $counter++; } } }