for details. */ ?> '. ''.join("", array('Name', 'Modules', 'Description and Notes', 'Tags', 'Suppliers')).''; $q = $db->query("SELECT p.id, p.name, m.name, m.id, mp.quantity, p.description, p.notes, p.photo ". "FROM part p, module m, module_part mp WHERE p.id=mp.part_id AND m.id=mp.module_id AND p.id=$part_id ORDER BY p.name"); $part=array(); while ($row = $q->fetchRow(MDB2_FETCHMODE_ORDERED)) { $part[$row[0]][ count($part[$row[0]]) ] = $row; } foreach ($part as $p) { $quantity = 0; $module = ''; $part_id = $p[0][0]; $photo = $p[0][7]; foreach ($p as $m) { $module .= $db->make_module_href($m[3],$m[2]).($m[4] != 1 ? " ($m[4])
" : '
'); $quantity = $quantity + $m[4]; } $tag = $db->get_part_tags($p[0][0]); $supplier = html_source_for_part($part_id); $descrip = combine_description_notes($p[0][5], $p[0][6]); $str .= ''. join('', array($db->make_part_href($part_id,$p[0][1]).($quantity != 1 ? " ($quantity)" : ''), $module, $descrip, $tag, $supplier)). "\n"; } $str .= ''; if ($photo) { $str .= '

'; } return array('title' => 'Part Detail for '.$p[0][1], 'body' => $str); } function dump_parts_for_model ($model=0) { // TODO: make it model-specific global $db; global $model_name; $str .= ''. ''; $q = $db->query("SELECT p.id, p.name, m.name, m.id, mp.quantity, p.description, p.notes ". "FROM part p, module m, module_part mp WHERE p.id=mp.part_id AND m.id=mp.module_id ". "ORDER BY p.name"); $str .= html_part_rows($q); return array('title' => $model_name.' Bill of Materials Organized by Part', 'body' => $str.'
'.join("", array('Name', 'Modules', 'Description and Notes', 'Tags', 'Suppliers')).'
'); }