Module: appdb Branch: master Commit: b4f0ac8507229e75934d7c6f6af946dcf3e90e85 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=b4f0ac8507229e75934d7c6f6...
Author: Alexander Nicolaysen Sørnes <alexander@linux-xqqm.(none)> Date: Sun Nov 22 04:29:46 2009 +0100
Add and use maintainer::getMaintainerCountForUserId
---
include/maintainer.php | 10 ++++++++-- include/maintainerView.php | 5 +++-- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/maintainer.php b/include/maintainer.php index 5ca2751..881b315 100644 --- a/include/maintainer.php +++ b/include/maintainer.php @@ -529,17 +529,23 @@ class maintainer }
// returns the number of applications/versions a particular user maintains - function getMaintainerCountForUser($oUser, $bSuperMaintainer) + function getMaintainerCountForUserId($iUserId, $bSuperMaintainer) { $sQuery = "SELECT count(*) as cnt from appMaintainers WHERE userid = '?' AND superMaintainer = '?'". " AND state ='?'"; - $hResult = query_parameters($sQuery, $oUser->iUserId, $bSuperMaintainer ? "1" : "0", 'accepted'); + $hResult = query_parameters($sQuery, $iUserId, $bSuperMaintainer ? "1" : "0", 'accepted'); if(!$hResult) return 0; $oRow = query_fetch_object($hResult); return $oRow->cnt; }
+ // returns the number of applications/versions a particular user maintains + function getMaintainerCountForUser($oUser, $bSuperMaintainer) + { + return getMaintainerCountForUserId($oUser->iUserId, $bSuperMaintainer); + } + /** * get the applications and versions that this user maintains */ diff --git a/include/maintainerView.php b/include/maintainerView.php index 36cee0a..3fade1e 100644 --- a/include/maintainerView.php +++ b/include/maintainerView.php @@ -96,6 +96,7 @@ class maintainerView { $oTableRow = new TableRow(); $oMaintainerView = new maintainerView(null, $oRow); + $iUserId = $oMaintainerView->iUserId; $oUser = new user($oMaintainerView->iUserId); $sStyle = 'border-top: thin solid; border-bottom: thin solid;';
@@ -107,13 +108,13 @@ class maintainerView $oCell->SetStyle($sStyle); $oTableRow->AddCell($oCell);
- $iMaintainedApps = maintainer::GetMaintainerCountForUser($oUser, true); + $iMaintainedApps = maintainer::GetMaintainerCountForUserId($iUserId, true); $sPlural = ($iMaintainedApps == 1) ? '' : 's'; $oCell = new TableCell($iMaintainedApps ? "$iMaintainedApps application$sPlural" : ' '); $oCell->SetStyle($sStyle); $oTableRow->AddCell($oCell);
- $iMaintainedVersions = maintainer::GetMaintainerCountForUser($oUser, false); + $iMaintainedVersions = maintainer::GetMaintainerCountForUserId($iUserId, false); $sPlural = ($iMaintainedVersions == 1) ? '' : 's'; $oCell = new TableCell($iMaintainedVersions ? "$iMaintainedVersions version$sPlural" : ' '); $oCell->SetStyle($sStyle);