From e56e95d63a0b169d981c23955e56d6e8fe82a81e Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Fri, 7 Jul 2006 16:44:41 +0000 Subject: [PATCH] Move getMaintainersUserIds...() to version::getMaintainersUserIds() and fixup callers of this function --- admin/adminMaintainerQueue.php | 3 ++- include/maintainer.php | 24 ------------------------ include/version.php | 26 ++++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/admin/adminMaintainerQueue.php b/admin/adminMaintainerQueue.php index cd0919c..9668d46 100644 --- a/admin/adminMaintainerQueue.php +++ b/admin/adminMaintainerQueue.php @@ -68,7 +68,8 @@ if ($aClean['sSub']) $firstDisplay = true; /* if false we need to fix up table rows appropriately */ - $other_users = getMaintainersUserIdsFromAppIdVersionId($oRow->versionId); + $oVersion = new Version($oRow->versionId); + $other_users = $oVersion->getMaintainersUserIds(); if($other_users) { $foundMaintainers = true; diff --git a/include/maintainer.php b/include/maintainer.php index c2c7a70..7e6e97b 100644 --- a/include/maintainer.php +++ b/include/maintainer.php @@ -3,30 +3,6 @@ /* functions for maintainers */ /*****************************/ -/* - * get the userIds of maintainers for a versionId - */ -function getMaintainersUserIdsFromAppIdVersionId($versionId) -{ - $retval = array(); - - /* early out if the versionId isn't valid */ - if($versionId == 0) - return $retval; - - $sQuery = "SELECT userId FROM ". - "appMaintainers WHERE versionId = '?';"; - $hResult = query_parameters($sQuery, $versionId); - $c = 0; - while($oRow = mysql_fetch_object($hResult)) - { - $retval[$c] = $oRow->userId; - $c++; - } - - return $retval; -} - /* * get the userIds of super maintainers for this appId */ diff --git a/include/version.php b/include/version.php index b68cf4f..34a4b18 100644 --- a/include/version.php +++ b/include/version.php @@ -32,7 +32,7 @@ class Version { var $aTestingIds; // an array that contains the testingId of every test result linked to this version var $aMonitorIds; // an array that contains the monitorId of every monitor linked to this version - /** + /** * constructor, fetches the data. */ function Version($iVersionId = null) @@ -677,7 +677,7 @@ class Version { // display all maintainers of this application echo "Maintainers of this version:\n"; echo ""; - $aMaintainers = getMaintainersUserIdsFromAppIdVersionId($this->iVersionId); + $aMaintainers = $this->getMaintainersUserIds(); $aSupermaintainers = getSuperMaintainersUserIdsFromAppId($this->iAppId); $aAllMaintainers = array_merge($aMaintainers,$aSupermaintainers); $aAllMaintainers = array_unique($aAllMaintainers); @@ -926,6 +926,28 @@ class Version { echo html_frame_end("Click the Version Name to view the details of that Version"); } } + + /* returns the maintainers of this version in an array */ + function getMaintainersUserIds() + { + $aMaintainers = array(); + + /* early out if the versionId isn't valid */ + if($this->iVersionId == 0) + return $aMaintainers; + + $sQuery = "SELECT userId FROM ". + "appMaintainers WHERE versionId = '?';"; + $hResult = query_parameters($sQuery, $this->iVersionId); + $iCount = 0; + while($oRow = mysql_fetch_object($hResult)) + { + $aMaintainers[$iCount] = $oRow->userId; + $iCount++; + } + + return $aMaintainers; + } } ?>