Add and use vendor::objectGetEntriesCount()

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-03-25 03:59:58 +00:00
committed by WineHQ
parent 8b1271b185
commit 2e6ddd24c9
2 changed files with 23 additions and 13 deletions

View File

@@ -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();

View File

@@ -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 "<a href=\"".$this->objectMakeUrl()."\">$this->sName</a>";
}
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;
}
?>