end_form();
}
+ function show_hub_donation_form($hub) {
+ if (! check_admin(1)) return;
+
+ $area = get_hub_area($hub);
+ if (! $area) {
+ echo "<p>No such <a href=\"/area\">area</a>!</p>\n";
+ return;
+ }
+
+ $donation = new Donation;
+ $donation->setHubId($hub->getId());
+
+ form();
+ echo "<p>Record a donation:</p>\n";
+
+ echo "<table>\n";
+ show_donation_form($donation, $area->getId());
+
+ echo "<tr>\n";
+ echo " <td colspan=2>"; submit("add_donation", "Record"); echo "</td></tr>\n";
+ echo "</tr>\n";
+ echo "</table>\n";
+ end_form();
+ }
+
function show_add_new_donation_form() {
if (! check_admin(1)) return;
break;
}
}
+ else if ($parameters[0] == "record") {
+ if ($parameters[1] == "to") {
+ if ($parameters[2] == "hub") {
+ if ($parameters[4]) $hub = get_hub_by_id($parameters[4]);
+ if (! $hub) $hub = get_hub_by_name(urldecode($parameters[3]));
+ if ($hub) show_hub_donation_form($hub);
+ }
+ }
+ }
}
list($ignored, $id, $args) = parse_parameters($parameters);
//echo "<p>$name($id) " . print_r($args, true) . "</p>\n";
$role = $hub->getRole();
$role_string = get_hub_role_string($hub);
if ($role_string) echo " $role_string";
- if ($role & $GLOBALS['ROLE_COLLECTION']) printf(" <a class=\"small\" href=\"/donation/to/hub/%s/%d\">Donations</a>", urlencode($hub->getName()), $hub->getId());
- if ($role & $GLOBALS['ROLE_DISTRIBUTION']) printf(" <a class=\"small\" href=\"/order/to/hub/%s/%d\">Orders</a>", urlencode($hub->getName()), $hub->getId());
+ $d = urlencode($hub->getName());
+ $i = $hub->getId();
+ if ($role & $GLOBALS['ROLE_COLLECTION']) {
+ printf(" <a class=\"small\" href=\"/donation/to/hub/%s/%d\">Donations</a>", $d, $i);
+ echo " " . get_small_link("Record", "/donation/record/to/hub/%s/%d", $d, $i);
+ }
+ if ($role & $GLOBALS['ROLE_DISTRIBUTION']) printf(" <a class=\"small\" href=\"/order/to/hub/%s/%d\">Orders</a>", $d, $i);
if (check_admin(1)) {
echo " " . $hub->getDeleteLink();
}