X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Fcity.php;h=94c556e736be87aff7d990596525f3218a733b92;hb=f01f7f07701d082995cd4919d51449a2db2ed9bc;hp=b90116308286a0d534e600c6e5519997bccccfb6;hpb=5e3d7c056815eb5d231d4e6fdb7b82da4b677fb0;p=readifood.git diff --git a/lib/city.php b/lib/city.php index b901163..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 "
You must confirm deletion of city " . $city->getName() . ": " . $city->getDeleteLink(true) . "
\n"; + } + function delete_city($name, $id = null) { if (! check_admin(1, "delete a city")) return; @@ -128,17 +141,21 @@ if (count($args)) { switch ($args[0]) { case "delete": + confirm_delete_city($name, $id); + break; + + case "confirmdelete": delete_city($name, $id); 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 " \n"; show_new_city_form();