From 19181910f0259c9711f3850bebb0caf12a2ade01 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 4 Dec 2006 06:10:38 +0000 Subject: [PATCH] r1329: Our new product selection system is interesting, but looks kinda unhelpful because there is no depth marking --- includes/functions_product.php | 101 +++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/includes/functions_product.php b/includes/functions_product.php index 3946f08..851cefc 100644 --- a/includes/functions_product.php +++ b/includes/functions_product.php @@ -19,6 +19,107 @@ || ################################################################### \*=====================================================================*/ +// ################################################################### +/** +* Constructs a massive HTML +*/ +function ConstructProductSelect($select = null) +{ + global $bugsys; + + $output = ''; + $build = ''; + + // index all of the products by parent and ID + $products = array(); + foreach ($bugsys->datastore['product'] AS $id => $prod) + { + $products["$prod[componentmother]"]["$id"] = $prod; + } + + // these are products + foreach ($products['0'] AS $productid => $product) + { + $build .= ConstructVersionSelect($productid, $select); + + // these are components + foreach ($products["$productid"] AS $componentid => $component) + { + $build .= ConstructOptionGroup($component['title'], ConstructVersionSelect($componentid, $select)); + } + + $output .= ConstructOptionGroup($product['title'], $build); + $build = ''; + } + + return $output; +} + +// ################################################################### +/** +* Constructs a string of HTML block from a label and a string of +* HTML +* @param string HTML bits +* +* @return string Composed HTML +*/ +function ConstructOptionGroup($glabel, $optbits) +{ + global $bugsys; + eval('$HTML = "' . $bugsys->template->fetch('selectoptgroup') . '";'); + return $HTML; +} + // #################### Start construct_pcv_select ################### // constructs a product/component/version select with one go :-) // NB: need to make sure we have the option to turn off just p/c selection without v -- 2.43.5