Allow appData constructor to import appData derived objects

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-06-10 23:07:51 +00:00
committed by WineHQ
parent 7e4a084fd3
commit fc6e645d1a
2 changed files with 18 additions and 4 deletions

View File

@@ -15,11 +15,25 @@ class appData
var $sSubmitTime; var $sSubmitTime;
var $sDescription; var $sDescription;
function appData($iId = null, $oRow = null) function appData($iId = null, $oRow = null, $oObject = null)
{ {
if(!$iId && !$oRow) if(!$iId && !$oRow)
return; return;
/* Since all objects stored in the appData table have a number of common
members, we can import such an object into an appData one without
making an SQL query */
if($oObject && $iId)
{
$this->iSubmitterId = $oObject->iSubmitterId;
$this->sDescription = $oObject->sDescription;
$this->iAppId = $oObject->iAppId;
$this->iVersionId = $oObject->iVersionId;
$this->sSubmitTime = $oObject->sSubmitTime;
$this->iId = $iId;
return;
}
if(!$oRow) if(!$oRow)
{ {
$hResult = query_parameters("SELECT * FROM appData WHERE id = '?'", $iId); $hResult = query_parameters("SELECT * FROM appData WHERE id = '?'", $iId);

View File

@@ -131,7 +131,7 @@ class Screenshot {
function delete($bSilent=false) function delete($bSilent=false)
{ {
/* appData has a universal function for removing database entries */ /* appData has a universal function for removing database entries */
$oAppData = new appData($this->iScreenshotId); $oAppData = new appData($this->iScreenshotId, null, $this);
if($oAppData->delete()) if($oAppData->delete())
{ {
/* make sure the screenshot and thumbnail is loaded */ /* make sure the screenshot and thumbnail is loaded */
@@ -562,7 +562,7 @@ class Screenshot {
/* arg1 = OM object, arg2 = CSS style, arg3 = text for edit link */ /* arg1 = OM object, arg2 = CSS style, arg3 = text for edit link */
function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel) function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
{ {
$oAppData = new AppData(); $oAppData = new AppData($this->iScreenshotId, null, $this);
$oAppData->objectOutputTableRow($oObject, $sClass, $sEditLinkLabel); $oAppData->objectOutputTableRow($oObject, $sClass, $sEditLinkLabel);
} }
@@ -573,7 +573,7 @@ class Screenshot {
function outputEditor() function outputEditor()
{ {
$oAppData = new appData($this->iScreenshotId); $oAppData = new appData($this->iScreenshotId, null, $this);
$oAppData->outputEditorGeneric(); $oAppData->outputEditorGeneric();
echo '<tr valign=top><td class=color0><b>Submited screenshot</b></td>',"\n"; echo '<tr valign=top><td class=color0><b>Submited screenshot</b></td>',"\n";