From: Iain Patterson Date: Mon, 13 May 2013 08:29:19 +0000 (-0400) Subject: Use get_small_link(). X-Git-Tag: 2013-05-13~22 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=4cd13bda037940724f018b8bfc62413156c52b75;p=readifood.git Use get_small_link(). Tidy up links from summary lines with get_small_link(). --- diff --git a/lib/area.php b/lib/area.php index 720617e..b2ac8c8 100644 --- a/lib/area.php +++ b/lib/area.php @@ -27,10 +27,12 @@ if (count($areas)) { foreach ($areas as $area) { - echo "
\nArea: " . $area->getStrongLink(); - printf(" Contacts", urlencode($area->getName()), $area->getId()); - printf(" Donations", urlencode($area->getName()), $area->getId()); - printf(" Orders", urlencode($area->getName()), $area->getId()); + echo "
\nArea: " . $area->getStrongLink() . "\n"; + $n = urlencode($area->getName()); + $i = $area->getId(); + echo " " . get_small_link("Contacts", "/contact/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Donations", "/donation/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Orders", "/order/in/area/%s/%d", $n, $i); if (check_admin(1)) { echo " " . $area->getDeleteLink(); } @@ -211,9 +213,11 @@ echo "
\n"; echo "

Area: " . $area->getName() . ""; - printf(" Contacts", urlencode($area->getName()), $area->getId()); - printf(" Donations", urlencode($area->getName()), $area->getId()); - printf(" Orders", urlencode($area->getName()), $area->getId()); + $n = $area->getName(); + $i = $area->getId(); + echo " " . get_small_link("Contacts", "/contact/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Donations", "/donation/in/area/%s/%d", $n, $i); + echo " " . get_small_link("Orders", "/order/in/area/%s/%d", $n, $i); if (check_admin(1)) { echo " " . $area->getDeleteLink(); } diff --git a/lib/city.php b/lib/city.php index 9dfc3c3..1294176 100644 --- a/lib/city.php +++ b/lib/city.php @@ -18,10 +18,12 @@ if (count($p)) { foreach ($p 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(); } @@ -100,10 +102,12 @@ if (! $city) return; echo "

City: " . 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(); } diff --git a/lib/contact.php b/lib/contact.php index a5bceee..c561023 100644 --- a/lib/contact.php +++ b/lib/contact.php @@ -50,11 +50,13 @@ $role = $contact->getRole(); $role_string = get_contact_role_string($contact); if ($role_string) echo " $role_string"; - if ($role & $GLOBALS['ROLE_DONOR']) printf(" Donations", urlencode($contact->getDisplayname()), $contact->getId()); - if ($role & $GLOBALS['ROLE_REQUESTER']) printf(" Referred", urlencode($contact->getDisplayname()), $contact->getId()); + $d = urlencode($contact->getDisplayname()); + $i = $contact->getId(); + if ($role & $GLOBALS['ROLE_DONOR']) echo " " . get_small_link("Donations", "/donation/from/contact/%s/%d", $d, $i); + if ($role & $GLOBALS['ROLE_REQUESTER']) echo " " . get_small_link("Referred", "/order/from/referrer/%s/%d", $d, $i); if ($role & $GLOBALS['ROLE_BENEFICIARY']) { - printf(" Orders", urlencode($contact->getDisplayname()), $contact->getId()); - if (get_contact_area($contact)) printf(" Place", urlencode($contact->getDisplayname()), $contact->getId()); + echo " " . get_small_link("Orders", "/order/to/beneficiary/%s/%d", $d, $contact->getId()); + if (get_contact_area($contact)) echo " " . get_small_link("Place", "/order/place/for/beneficiary/%s/%d", $d, $i); } if (check_admin(1)) { echo " " . $contact->getDeleteLink();