Standardize objectGetEntries parameters

This commit is contained in:
Alexander Nicolaysen Sørnes
2008-04-12 21:50:02 +02:00
committed by Chris Morgan
parent 5afa1598df
commit ed64f049d7
16 changed files with 63 additions and 44 deletions

View File

@@ -326,7 +326,7 @@ class appData
return $oTableRow;
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sType)
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true, $sType = null)
{
/* Not implemented for appData */
if($sState == 'rejected')

View File

@@ -934,6 +934,11 @@ class Application {
return $sLink;
}
public static function objectGetDefaultSort()
{
return 'appId';
}
public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE)
{
$sLimit = "";

View File

@@ -384,6 +384,11 @@ class application_queue
return $this->oApp->objectGetEntriesCount($sState);
}
public static function objectGetDefaultSort()
{
return application::objectGetDefaultSort();
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE)
{
return $this->oApp->objectGetEntries($sState, $iRows, $iStart,

View File

@@ -365,7 +365,7 @@ class Bug
return $this->iLinkId;
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0)
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
{
$sLimit = "";

View File

@@ -555,6 +555,11 @@ class distribution {
return array('name');
}
public static function objectGetDefaultSort()
{
return 'name';
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "name", $bAscending = TRUE)
{
/* Not implemented */

View File

@@ -432,9 +432,9 @@ class downloadurl
return $oAppData->reject();
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0)
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
{
return appData::objectGetEntries($sState, $iRows, $iStart, 'downloadurl');
return appData::objectGetEntries($sState, $iRows, $iStart, $sOrderBy, $bAscending, 'downloadurl');
}
function objectGetEntriesCount($sState)

View File

@@ -395,7 +395,7 @@ class maintainer
return $hResult;
}
function ObjectGetEntries($sState, $iRows = 0, $iStart = 0)
function ObjectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
{
/* Not implemented */
if($sState == 'rejected')

View File

@@ -299,7 +299,7 @@ class Monitor {
return "";
}
function objectGetEntries($sState)
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
{
$hResult = query_parameters("SELECT * FROM appMonitors");

View File

@@ -320,7 +320,7 @@ class Note {
// do not support queuing at this point
// TODO: we have no permissions scope on retrieving entries
// as notes are typically only added to unqueued versions
function objectGetEntries($sState)
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
{
$sQuery = "select * from appNotes";
$hResult = query_parameters($sQuery);

View File

@@ -271,39 +271,18 @@ class ObjectManager
/* Set the sort info */
$this->setSortInfo($aClean);
if(!$this->oSortInfo->sCurrentSort)
$this->oSortInfo->sCurrentSort = $this->getOptionalSetting('objectGetDefaultSort', '');
/* query the class for its entries */
/* We pass in queue states to tell the object */
/* if we are requesting a list of its queued objects or */
/* all of its objects */
if($this->oMultiPage->bEnabled)
{
/* Has the user chosen a particular field to sort by? If not we want to use the default */
if($this->oSortInfo->sCurrentSort)
{
$hResult = $oObject->objectGetEntries($this->sState,
$this->oMultiPage->iItemsPerPage,
$this->oMultiPage->iLowerLimit,
$this->oSortInfo->sCurrentSort,
$this->oSortInfo->bAscending);
} else
{
$hResult = $oObject->objectGetEntries($this->sState,
$this->oMultiPage->iItemsPerPage,
$this->oMultiPage->iLowerLimit);
}
} else
{
/* Has the user chosen a particular field to sort by? If not we want to use the default */
if($this->oSortInfo->sCurrentSort)
{
$hResult = $oObject->objectGetEntries($this->sState,
$this->oSortInfo->sCurrentSort,
$this->oSortInfo->bAscending);
} else
{
$hResult = $oObject->objectGetEntries($this->sState);
}
}
$hResult = $oObject->objectGetEntries($this->sState,
$this->oMultiPage->iItemsPerPage,
$this->oMultiPage->iLowerLimit,
$this->oSortInfo->sCurrentSort,
$this->oSortInfo->bAscending);
/* did we get any entries? */
if(!$hResult || query_num_rows($hResult) == 0)

View File

@@ -649,9 +649,9 @@ class screenshot
echo "</tr></table></div><br>\n";
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0)
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = '', $bAscending = true)
{
return appData::objectGetEntries($sState, $iRows, $iStart,
return appData::objectGetEntries($sState, $iRows, $iStart, $sOrderBy, $bAscending,
'screenshot');
}

View File

@@ -1202,7 +1202,12 @@ class testData{
return $oRow->count;
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId")
public static function objectGetDefaultSort()
{
return 'testingId';
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId", $bAscending = true)
{
$oTest = new testData();

View File

@@ -142,9 +142,14 @@ class testData_queue
$this->oTestData->objectDisplayAddItemHelp();
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId")
public static function objectGetDefaultSort()
{
return $this->oTestData->objectGetEntries($sState, $iRows, $iStart, $sOrderBy);
return testData::objectGetDefaultSort();
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId", $bAscending = true)
{
return $this->oTestData->objectGetEntries($sState, $iRows, $iStart, $sOrderBy, $bAscending);
}
function objectGetEntriesCount($sState)

View File

@@ -242,6 +242,11 @@ class Vendor {
return array('vendorName');
}
public static function objectGetDefaultSort()
{
return 'vendorName';
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = 'vendorName', $bAscending = TRUE)
{
/* Not implemented */

View File

@@ -1544,7 +1544,12 @@ class version {
return array($aItemsPerPage, $iDefaultPerPage);
}
public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId")
public static function objectGetDefaultSort()
{
return 'versionId';
}
public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true)
{
$sLimit = "";

View File

@@ -235,10 +235,15 @@ class version_queue
return $this->oVersion->objectGetEntriesCount($sState);
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId")
public static function objectGetDefaultSort()
{
return version::objectGetDefaultSort();
}
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true)
{
return $this->oVersion->objectGetEntries($sState, $iRows, $iStart,
$sOrderBy);
$sOrderBy, $bAscending);
}
function objectGetHeader()