X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;ds=inline;f=lib%2Fcity.php;h=94c556e736be87aff7d990596525f3218a733b92;hb=eeeda82e51f5b591d78b45a039ea0046bc641d8f;hp=9dfc3c38142813f5cd8928bbe99418998233a7eb;hpb=f9e5947f547ece139806309f589d80177e48cb79;p=readifood.git diff --git a/lib/city.php b/lib/city.php index 9dfc3c3..94c556e 100644 --- a/lib/city.php +++ b/lib/city.php @@ -10,22 +10,26 @@ } } - 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));
- printf(" Areas", urlencode($city->getName()), $city->getId());
- printf(" Contacts", urlencode($city->getName()), $city->getId());
- printf(" Donations", urlencode($city->getName()), $city->getId());
- printf(" Orders", urlencode($city->getName()), $city->getId());
+ $n = $city->getName();
+ $i = $city->getId();
+ echo " " . get_small_link("Areas", "/area/in/city/%s/%d", $n, $i);
+ echo " " . get_small_link("Contacts", "/contact/in/city/%s/%d", $n, $i);
+ echo " " . get_small_link("Donations", "/donation/in/city/%s/%d", $n, $i);
+ echo " " . get_small_link("Orders", "/order/in/city/%s/%d", $n, $i);
if (check_admin(1)) {
echo " " . $city->getDeleteLink();
}
}
+ show_pagination($cities);
}
else echo " none";
echo "