appdb/include sidebar.php vendor.php

WineHQ wineowner at wine.codeweavers.com
Sat Mar 24 22:59:58 CDT 2007


ChangeSet ID:	31003
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/03/24 22:59:58

Modified files:
	include        : sidebar.php vendor.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Add and use vendor::objectGetEntriesCount()

Patch: http://cvs.winehq.org/patch.py?id=31003

Old revision  New revision  Changes     Path
 1.29          1.30          +1 -1       appdb/include/sidebar.php
 1.18          1.19          +20 -10     appdb/include/vendor.php

Index: appdb/include/sidebar.php
diff -u -p appdb/include/sidebar.php:1.29 appdb/include/sidebar.php:1.30
--- appdb/include/sidebar.php:1.29	25 Mar 2007  3:59:58 -0000
+++ appdb/include/sidebar.php	25 Mar 2007  3:59:58 -0000
@@ -29,7 +29,7 @@ function global_sidebar_menu()
     $g->add("Help &amp; 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 at winehq.org");
     $g->done();    
 
Index: appdb/include/vendor.php
diff -u -p appdb/include/vendor.php:1.18 appdb/include/vendor.php:1.19
--- appdb/include/vendor.php:1.18	25 Mar 2007  3:59:58 -0000
+++ appdb/include/vendor.php	25 Mar 2007  3:59:58 -0000
@@ -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>";
     }
-}
 
-/* Get the total number of Vendors in the database */
-function getNumberOfVendors()
-{
-    $hResult = query_parameters("SELECT count(*) as num_vendors FROM vendor");
-    if($hResult)
+    function objectGetEntriesCount($bQueued, $bRejected)
     {
-      $oRow = mysql_fetch_object($hResult);
-      return $oRow->num_vendors;
+        /* 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;
     }
-    return 0;
 }
+
 ?>



More information about the wine-cvs mailing list