diff --git a/include/sidebar.php b/include/sidebar.php index 1a59db0..4c1be44 100644 --- a/include/sidebar.php +++ b/include/sidebar.php @@ -29,7 +29,7 @@ function global_sidebar_menu() $g->add("Help & Documentation", BASE."help/"); $g->add("AppDB Stats", BASE."appdbStats.php"); $g->add("View Distributions (".distribution::objectGetEntriesCount(false, false).")", BASE."objectManager.php?sClass=distribution&bIsQueue=false&sTitle=View%20Distributions"); - $g->add("View Vendors (".getNumberOfvendors().")", BASE."objectManager.php?sClass=vendor&bIsQueue=false&sTitle=View%20Vendors"); + $g->add("View Vendors (".vendor::objectGetEntriesCount(false, false).")", BASE."objectManager.php?sClass=vendor&bIsQueue=false&sTitle=View%20Vendors"); $g->add("Email your suggestions for improving the AppDB", "mailto:appdb@winehq.org"); $g->done(); diff --git a/include/vendor.php b/include/vendor.php index c9a9fb0..7d3c9ce 100644 --- a/include/vendor.php +++ b/include/vendor.php @@ -159,7 +159,7 @@ class Vendor { return FALSE; if(!$iRows) - $iRows = getNumberOfVendors(); + $iRows = objectGetEntriesCount($bQueued, $bRejected); $hResult = query_parameters("SELECT * FROM vendor ORDER BY vendorName LIMIT ?,?", @@ -263,17 +263,27 @@ class Vendor { { return "objectMakeUrl()."\">$this->sName"; } + + function objectGetEntriesCount($bQueued, $bRejected) + { + /* Not implemented */ + if($bQueued) + return FALSE; + + /* Not implemented */ + if($bRejected) + return FALSE; + + $hResult = query_parameters("SELECT COUNT(vendorId) as count FROM vendor"); + + if(!$hResult) + return FALSE; + + if(!$oRow = mysql_fetch_object($hResult)) + return FALSE; + + return $oRow->count; + } } -/* Get the total number of Vendors in the database */ -function getNumberOfVendors() -{ - $hResult = query_parameters("SELECT count(*) as num_vendors FROM vendor"); - if($hResult) - { - $oRow = mysql_fetch_object($hResult); - return $oRow->num_vendors; - } - return 0; -} ?>