Allow object creation from a mysql resource, allow objectGetEntries() to limit the range of
entries requested, this will be necessary for future performance optimizations
This commit is contained in:
committed by
WineHQ
parent
fa111ec39d
commit
cbdce75b0b
@@ -18,31 +18,30 @@ class distribution {
|
|||||||
var $aTestingIds;
|
var $aTestingIds;
|
||||||
|
|
||||||
// constructor, fetches the data.
|
// constructor, fetches the data.
|
||||||
function distribution($iDistributionId = null)
|
function distribution($iDistributionId = null, $oRow = null)
|
||||||
{
|
{
|
||||||
// we are working on an existing distribution.
|
// we are working on an existing distribution.
|
||||||
if(is_numeric($iDistributionId))
|
if(is_numeric($iDistributionId))
|
||||||
{
|
{
|
||||||
// We fetch the data related to this distribution.
|
// We fetch the data related to this distribution.
|
||||||
if(!$this->$iDistributionId)
|
if(!$oRow)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT *
|
$sQuery = "SELECT *
|
||||||
FROM distributions
|
FROM distributions
|
||||||
WHERE distributionId = '?'";
|
WHERE distributionId = '?'";
|
||||||
if($hResult = query_parameters($sQuery, $iDistributionId))
|
if($hResult = query_parameters($sQuery, $iDistributionId))
|
||||||
{
|
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
if($oRow)
|
}
|
||||||
{
|
|
||||||
$this->iDistributionId = $iDistributionId;
|
if($oRow)
|
||||||
$this->sName = $oRow->name;
|
{
|
||||||
$this->sDescription = $oRow->description;
|
$this->iDistributionId = $iDistributionId;
|
||||||
$this->sUrl = $oRow->url;
|
$this->sName = $oRow->name;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sDescription = $oRow->description;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->sUrl = $oRow->url;
|
||||||
$this->sQueued = $oRow->queued;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
}
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
}
|
$this->sQueued = $oRow->queued;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -438,30 +437,26 @@ class distribution {
|
|||||||
echo html_tr($aCells, $sClass);
|
echo html_tr($aCells, $sClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued)
|
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
|
||||||
{
|
{
|
||||||
if($bQueued)
|
/* Only users with edit privileges are allowed to view queued
|
||||||
{
|
items, so return NULL in that case */
|
||||||
if(distribution::canEdit())
|
if($bQueued && !distribution::canEdit())
|
||||||
{
|
return NULL;
|
||||||
/* Only users with edit privileges are allowed to view queued
|
|
||||||
items, so return NULL in that case */
|
if(!$iRows)
|
||||||
$sQuery = "SELECT distributionId FROM distributions
|
$iRows = distribution::getNumberOfDistributions($bQueued);
|
||||||
WHERE queued = '?' ORDER BY name";
|
|
||||||
return query_parameters($sQuery, $bQueued ? "true" : "false");
|
$sQuery = "SELECT * FROM distributions
|
||||||
} else
|
WHERE queued = '?' ORDER BY name LIMIT ?,?";
|
||||||
return NULL;
|
|
||||||
} else
|
return query_parameters($sQuery, $bQueued ? "true" : "false",
|
||||||
{
|
$iStart, $iRows);
|
||||||
$sQuery = "SELECT distributionId FROM distributions
|
|
||||||
WHERE queued = '?' ORDER BY name";
|
|
||||||
return query_parameters($sQuery, "false");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ObjectGetInstanceFromRow($oRow)
|
function objectGetInstanceFromRow($oRow)
|
||||||
{
|
{
|
||||||
return new distribution($oRow->distributionId);
|
return new distribution($oRow->distributionId, $oRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectOutputTableRow($sClass = "")
|
function objectOutputTableRow($sClass = "")
|
||||||
|
|||||||
Reference in New Issue
Block a user