Use get_small_link().
authorIain Patterson <me@iain.cx>
Mon, 13 May 2013 08:29:19 +0000 (04:29 -0400)
committerIain Patterson <me@iain.cx>
Mon, 13 May 2013 08:29:19 +0000 (04:29 -0400)
Tidy up links from summary lines with get_small_link().

lib/area.php
lib/city.php
lib/contact.php

index 720617e..b2ac8c8 100644 (file)
 
         if (count($areas)) {
           foreach ($areas as $area) {
-            echo "<br>\nArea: " . $area->getStrongLink();
-            printf(" <a class=\"small\" href=\"/contact/in/area/%s/%d\">Contacts</a>", urlencode($area->getName()), $area->getId());
-            printf(" <a class=\"small\" href=\"/donation/in/area/%s/%d\">Donations</a>", urlencode($area->getName()), $area->getId());
-            printf(" <a class=\"small\" href=\"/order/in/area/%s/%d\">Orders</a>", urlencode($area->getName()), $area->getId());
+            echo "<br>\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();
             }
 
     echo "<form method=\"POST\" action=\"" . $_SERVER['REQUEST_URI'] . "\">\n";
     echo "<p>Area: <span class=\"strong\">" . $area->getName() . "</span>";
-    printf(" <a class=\"small\" href=\"/contact/in/area/%s/%d\">Contacts</a>", urlencode($area->getName()), $area->getId());
-    printf(" <a class=\"small\" href=\"/donation/in/area/%s/%d\">Donations</a>", urlencode($area->getName()), $area->getId());
-    printf(" <a class=\"small\" href=\"/order/in/area/%s/%d\">Orders</a>", 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();
     }
index 9dfc3c3..1294176 100644 (file)
     if (count($p)) {
       foreach ($p as $city) {
         echo "<br>\nCity: " . $city->getStrongLink(get_city_displayname($city));
-        printf(" <a class=\"small\" href=\"/area/in/city/%s/%d\">Areas</a>", urlencode($city->getName()), $city->getId());
-        printf(" <a class=\"small\" href=\"/contact/in/city/%s/%d\">Contacts</a>", urlencode($city->getName()), $city->getId());
-        printf(" <a class=\"small\" href=\"/donation/in/city/%s/%d\">Donations</a>", urlencode($city->getName()), $city->getId());
-        printf(" <a class=\"small\" href=\"/order/in/city/%s/%d\">Orders</a>", 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();
         }
     if (! $city) return;
 
     echo "<p>City: <span class=\"strong\">" . get_city_displayname($city) . "</span>";
-    printf(" <a class=\"small\" href=\"/area/in/city/%s/%d\">Areas</a>", urlencode($city->getName()), $city->getId());
-    printf(" <a class=\"small\" href=\"/contact/in/city/%s/%d\">Contacts</a>", urlencode($city->getName()), $city->getId());
-    printf(" <a class=\"small\" href=\"/donation/in/city/%s/%d\">Donations</a>", urlencode($city->getName()), $city->getId());
-    printf(" <a class=\"small\" href=\"/order/in/city/%s/%d\">Orders</a>", 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();
     }
index a5bceee..c561023 100644 (file)
     $role = $contact->getRole();
     $role_string = get_contact_role_string($contact);
     if ($role_string) echo " $role_string";
-    if ($role & $GLOBALS['ROLE_DONOR']) printf(" <a class=\"small\" href=\"/donation/from/contact/%s/%d\">Donations</a>", urlencode($contact->getDisplayname()), $contact->getId());
-    if ($role & $GLOBALS['ROLE_REQUESTER']) printf(" <a class=\"small\" href=\"/order/from/referrer/%s/%d\">Referred</a>", 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(" <a class=\"small\" href=\"/order/to/beneficiary/%s/%d\">Orders</a>", urlencode($contact->getDisplayname()), $contact->getId());
-      if (get_contact_area($contact)) printf(" <a class=\"small\" href=\"/order/place/for/beneficiary/%s/%d\">Place</a>", 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();