|| ###################################################################
\*=====================================================================*/
-// ###################################################################
/**
-* Constructs a massive <select> form element to create non-valid XHTML
-* for product selection. We have to use nested <optgroup>s (invalid)
-* because certain browsers (Safari) do not support <option disabled>,
-* which is how I want to implement components.
-*
-* @param string Permission action to verify against for a product
-* @param string Selection
-* @param bool Include obsolete versions?
-*
-* @return string A large blob of <select> HTML
-*/
-function ConstructProductSelect($action = 'canviewbugs', $select = null, $obsolete = true)
+ * Constructs a massive <select> form element to create non-valid XHTML
+ * for product selection. We have to use nested <optgroup>s (invalid)
+ * because certain browsers (Safari) do not support <option disabled>,
+ * which is how I want to implement components.
+ *
+ * @param string Permission action to verify against for a product
+ * @param string Selection
+ * @param bool Include obsolete versions?
+ *
+ * @return string A large blob of <select> HTML
+ */
+function construct_product_select($action = 'canviewbugs', $select = null, $obsolete = true)
{
- global $bugsys;
-
$output = '';
// index all of the components by parent and ID
$components = array();
if (is_array(bugdar::$datastore['component']))
{
- foreach (bugdar::$datastore['component'] AS $id => $prod)
+ foreach (bugdar::$datastore['component'] as $id => $prod)
{
$components["$prod[parentid]"]["$id"] = $prod;
}
}
// these are products
- foreach (bugdar::$datastore['product'] AS $productid => $product)
+ foreach (bugdar::$datastore['product'] as $productid => $product)
{
- if (!can_perform($action, $product['productid']) OR !can_perform('canviewbugs', $product['productid']))
+ if (!can_perform($action, $product['productid']) || !can_perform('canviewbugs', $product['productid']))
{
continue;
}
- if ($versions = ConstructVersionSelect($productid, $select, $obsolete))
+ if ($versions = construct_version_select($productid, $select, $obsolete))
{
- $output .= ConstructOptionGroup($product['title'], $versions);
+ $output .= construct_option_group($product['title'], $versions);
}
// these are components
if ($components["$productid"])
{
- foreach ($components["$productid"] AS $componentid => $component)
+ foreach ($components["$productid"] as $componentid => $component)
{
- $output .= ConstructOptionGroup($product['title'] . '/' . $component['title'], ConstructVersionSelect($componentid, $select, $obsolete));
+ $output .= construct_option_group($product['title'] . '/' . $component['title'], construct_version_select($componentid, $select, $obsolete));
}
}
}
return $output;
}
-// ###################################################################
/**
-* Constructs a string of HTML <option>s for a given product ID. This
-* will always include global versions and inherited versions (if the
-* passed ID is that of a component).
-*
-* @param integer Product ID
-* @param string Selection
-* @param bool Include obsolete versions?
-*
-* @return string Constructed <option> HTML
-*/
-function ConstructVersionSelect($productid, $select, $obsolete)
+ * Constructs a string of HTML <option>s for a given product ID. This
+ * will always include global versions and inherited versions (if the
+ * passed ID is that of a component).
+ *
+ * @param integer Product ID
+ * @param string Selection
+ * @param bool Include obsolete versions?
+ *
+ * @return string Constructed <option> HTML
+ */
+function construct_version_select($productid, $select, $obsolete)
{
global $bugsys;
$product = bugdar::$datastore['product']["$component[parentid]"];
}
- foreach (bugdar::$datastore['version'] AS $versionid => $version)
+ foreach (bugdar::$datastore['version'] as $versionid => $version)
{
- if ((!$version['productid'] OR $version['productid'] == $component['productid'] OR $version['productid'] == $product['productid']) AND (!$version['obsolete'] OR ($version['obsolete'] AND $obsolete)))
+ if ((!$version['productid'] || $version['productid'] == $component['productid'] || $version['productid'] == $product['productid']) && (!$version['obsolete'] || ($version['obsolete'] && $obsolete)))
{
$tpl = new BSTemplate('selectoption');
$tpl->vars = array(
return $build;
}
-// ###################################################################
/**
-* Constructs an <optgroup> block from a label and a string of
-* HTML <option> elements.
-*
-* @param string Label for this <optgroup>
-* @param string HTML bits
-*
-* @return string Composed HTML
-*/
-function ConstructOptionGroup($glabel, $optbits)
+ * Constructs an <optgroup> block from a label and a string of
+ * HTML <option> elements.
+ *
+ * @param string Label for this <optgroup>
+ * @param string HTML bits
+ *
+ * @return string Composed HTML
+ */
+function construct_option_group($glabel, $optbits)
{
$tpl = new BSTemplate('selectoptgroup');
$tpl->vars = array(