X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Fcity.php;fp=lib%2Fcity.php;h=94c556e736be87aff7d990596525f3218a733b92;hb=762ae69462813affdcdab3960dede2c7d679baf3;hp=dd60e360899b5d9d8442f9ba5d06f5905a342b98;hpb=6cbb29ad097d97f152a4318ddb0bc2498b2f6ca7;p=readifood.git diff --git a/lib/city.php b/lib/city.php index dd60e36..94c556e 100644 --- a/lib/city.php +++ b/lib/city.php @@ -10,13 +10,14 @@ } } - function show_cities($offset, $per_page, $name = null) { + function show_cities($name = null) { + list($first_page, $per_page) = pagination(); echo "

Cities:"; $q = new CityQuery; if (isset($name)) $q->filterByName($name); - $p = $q->paginate($offset, $per_page); - if (count($p)) { - foreach ($p as $city) { + $cities = $q->paginate($first_page, $per_page); + if (count($cities)) { + foreach ($cities as $city) { echo "
\nCity: " . $city->getStrongLink(get_city_displayname($city)); $n = $city->getName(); $i = $city->getId(); @@ -28,6 +29,7 @@ echo " " . $city->getDeleteLink(); } } + show_pagination($cities); } else echo " none"; echo "

\n"; @@ -147,13 +149,13 @@ break; default: - show_cities(0, 10, $name); + show_cities($name); show_new_city_form(); break; } } else if (isset($name)) show_city($name, $id); - else show_cities(0, 10); + else show_cities(); if (count($parameters)) echo "

Show all cities

\n"; show_new_city_form();