$part) { $supplier = new Supplier($_POST['suppliers'][$key]); $supplier->name = str_replace("_", " ", $part); $supplier->quantity = $_POST['quantities'][$key]; $list->addSupplier($supplier); } $corps = $list->getSuppliers(); ?> " . count($corps) . " total suppliers selected. You may want to print this to help keep track of what parts you need.

"; foreach ($corps AS $corp) { $parts = $list->getParts($corp); if (count($parts)) { if ($corp == 'M') renderMouserParts($parts); else if ($corp == 'RS') renderRSParts($parts); else if ($corp == 'F') renderFarnellParts($parts); else if ($corp == '') renderUnknownParts($parts); else { if (isset($suppliers[$corp])) renderParts($parts, $suppliers[$corp]); else renderParts($parts, $corp); } } } } else echo "Oops, you gotta POST here bro."; drawFooter(); //VIEW FUNCTIONS BELOW. function renderParts($parts, $corp) { if ($corp instanceof Corporation) { echo '

' . $corp->name . '

'; echo "

$corp->description

"; } else echo "

$corp

"; if (count($parts)) { ?> Name"; echo ""; echo ""; echo ""; } echo "
Part # Quantity
"; if ($corp->buy_url) { $url = str_replace("%%PARTID%%", $part->part_id, $corp->buy_url); echo '' . $part->name . ''; } else if (preg_match("/http:/", $part->part_id)) echo '' . $part->part_id . ""; else echo $part->part_id; echo "$part->quantity" . stripslashes($part->name) . "
"; } else echo "No parts found."; } function renderMouserParts($parts) { ?>

Mouser Parts

Copy and paste the text below into their BOM Importer tool. You'll need an account, but you need one anyway to check out.

RS Parts

Go to their website, Ready to order? -> Copy & paste your order. Then do just that with the text below.

Farnell Parts

Go to their website, Choose country -> Quick Paste. Then do just that with the text below.

Parts with No Suppliers

"; echo "
Part Quantity
" . stripslashes($part->name) . "$part->quantity
"; } ?>