Filter area and city searches.
[readifood.git] / lib / donation.php
index e9c75da..be3710c 100644 (file)
       return;
     }
 
+    form("noprint standout");
+    $candidates = array();
+    foreach ($areas as $area) {
+      if (! count(get_area_hubs($area->getId()))) continue;
+      $candidates[] = $area;
+    }
+    if (! count($candidates)) return;
+
     echo "<p>Show donations in area\n";
     echo "<select name=\"area_id\">\n";
-    foreach ($areas as $area) {
+    foreach ($candidates as $area) {
       option("area_id", $area->getId(), get_area_displayname($area));
     }
     echo "</select>\n";
       return;
     }
 
+    $candidates = array();
+    foreach ($cities as $city) {
+      if (! count(get_city_hubs($city->getId()))) continue;
+      $candidates[] = $city;
+    }
+    if (! count($candidates)) return;
+
     echo "<p>Show donations in city\n";
     echo "<select name=\"city_id\">\n";
-    foreach ($cities as $city) {
+    foreach ($candidates as $city) {
       option("city_id", $city->getId(), get_city_displayname($city), $city_id);
     }
     echo "</select>\n";