Update functions_product.php to use proper naming
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 20:21:39 +0000 (16:21 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 20:21:39 +0000 (16:21 -0400)
includes/functions_product.php
newreport.php
search.php
showreport.php

index 963102d9c5c8444842aa6a738d0e72cc9044d6d3..f4feb30ece5df84d2bd8c19e82ed8526e83f8842 100644 (file)
 || ###################################################################
 \*=====================================================================*/
 
-// ###################################################################
 /**
-* 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));
                        }
                }
        }
@@ -74,19 +71,18 @@ function ConstructProductSelect($action = 'canviewbugs', $select = null, $obsole
        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;
        
@@ -102,9 +98,9 @@ function ConstructVersionSelect($productid, $select, $obsolete)
                $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(
@@ -119,17 +115,16 @@ function ConstructVersionSelect($productid, $select, $obsolete)
        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(
index a00df942a70739aa548cdc68d0a153ba187e6759..f343c4242c9d0210092658fdd9479aa6954ca1c6 100755 (executable)
@@ -190,7 +190,7 @@ if ($_REQUEST['do'] == 'add')
        $tpl = new BSTemplate('newreport');
        $tpl->vars = array(
                'reporter'              => construct_user_display(bugdar::$userinfo),
-               'productSelect' => ConstructProductSelect('cansubmitbugs', $input->in['product'], false),
+               'productSelect' => construct_product_select('cansubmitbugs', $input->in['product'], false),
                'select'                => $select,
                'customfields'  => $customfields
        );
index e10608bdd66aa81a4f29318e39170c54cc4e7fc9..ad56a684cbcbbbbb7ad601fc67035b688274b895 100644 (file)
@@ -169,7 +169,7 @@ if ($_REQUEST['do'] == 'search')
                $tpl = new BSTemplate('search');
                $tpl->vars = array(
                        'select'                => $select,
-                       'productSelect' => ConstructProductSelect(),
+                       'productSelect' => construct_product_select(),
                        'customfields'  => $customfields,
                        'searches'              => $searches
                );
@@ -503,7 +503,7 @@ if ($_REQUEST['do'] == 'update')
                'search'                => $search,
                'select'                => $select,
                'customfields'  => $customfields,
-               'productSelect' => ConstructProductSelect()
+               'productSelect' => construct_product_select()
        );
        $tpl->evaluate()->flush();
 }
index 1bd55ef29e0786d2a91758e7ac58c47ae18c1e9b..266438c38c3f276743ffed9a913f94a5467de801 100644 (file)
@@ -120,7 +120,7 @@ if ($show['edit'])
                }
        }
        
-       $productSelect = ConstructProductSelect('canviewbugs', "$bug[product],$bug[component],$bug[version]");
+       $productSelect = construct_product_select('canviewbugs', "$bug[product],$bug[component],$bug[version]");
        
        if ($bug['duplicateof'])
        {