Object constructors shouldn't require an id if passed a $oRow object. Gets rid of

objectGetInstanceFromRow() since we can pass the row into the constructor instead.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-06-10 18:51:33 +00:00
committed by WineHQ
parent d0022decd4
commit f7b24fab9a
14 changed files with 411 additions and 357 deletions

View File

@@ -18,24 +18,29 @@ class maintainer
var $bQueued;
var $sReplyText;
function maintainer($iMaintainerId = "")
function maintainer($iMaintainerId = null, $oRow = null)
{
$sQuery = "SELECT * FROM appMaintainers WHERE maintainerId = '?'";
$hResult = query_parameters($sQuery, $iMaintainerId);
if($hResult)
if(!$iMaintainerId && !$oRow)
return;
if(!$oRow)
{
$oRow = mysql_fetch_object($hResult);
if($oRow)
{
$this->iMaintainerId = $oRow->maintainerId;
$this->iAppId = $oRow->appId;
$this->iVersionId = $oRow->versionId;
$this->iUserId = $oRow->userId;
$this->sMaintainReason = $oRow->maintainReason;
$this->bSuperMaintainer = $oRow->superMaintainer;
$this->aSubmitTime = $oRow->submitTime;
$this->bQueued = $oRow->queued;
}
$sQuery = "SELECT * FROM appMaintainers WHERE maintainerId = '?'";
$hResult = query_parameters($sQuery, $iMaintainerId);
if($hResult)
$oRow = mysql_fetch_object($hResult);
}
if($oRow)
{
$this->iMaintainerId = $oRow->maintainerId;
$this->iAppId = $oRow->appId;
$this->iVersionId = $oRow->versionId;
$this->iUserId = $oRow->userId;
$this->sMaintainReason = $oRow->maintainReason;
$this->bSuperMaintainer = $oRow->superMaintainer;
$this->aSubmitTime = $oRow->submitTime;
$this->bQueued = $oRow->queued;
}
}
@@ -218,7 +223,7 @@ class maintainer
/* Excluding requests for queued apps and versions, as these will be
handled automatically */
$sQuery = "SELECT DISTINCT maintainerId, appMaintainers.submitTime FROM
$sQuery = "SELECT DISTINCT appMaintainers.* FROM
appMaintainers, appFamily, appVersion WHERE
appMaintainers.queued = '?'
AND
@@ -486,11 +491,6 @@ class maintainer
echo "</td></tr></table></div>\n\n";
}
function objectGetInstanceFromRow($oRow)
{
return new maintainer($oRow->maintainerId, $oRow);
}
function canEdit()
{
if($_SESSION['current']->hasPriv("admin"))