Use multipage controls for application lists

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-07-28 20:08:50 +00:00
committed by WineHQ
parent f37fa6e42f
commit 09107d7142
2 changed files with 55 additions and 8 deletions

View File

@@ -343,6 +343,14 @@ class Application {
addmsg("The application has been rejected.", "green");
}
}
function objectGetItemsPerPage($bQueued = false)
{
$aItemsPerPage = array(25, 50, 100, 200);
$iDefaultPerPage = 25;
return array($aItemsPerPage, $iDefaultPerPage);
}
function ReQueue()
{
if(!$_SESSION['current']->canRequeueApplication($this))
@@ -818,8 +826,21 @@ class Application {
return $sLink;
}
function objectGetEntries($bQueued, $bRejected, $sOrderBy = "appId")
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "appId")
{
$sLimit = "";
/* Should we add a limit clause to the query? */
if($iRows || $iStart)
{
$sLimit = " LIMIT ?,?";
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
after an offset given by iStart */
if(!$iRows)
$iRows = maintainer::objectGetEntriesCount($bQueued, $bRejected);
}
$sQuery = "SELECT * FROM appFamily WHERE
appFamily.queued = '?'";
@@ -831,13 +852,28 @@ class Application {
if(!$bRejected)
return FALSE;
$sQuery .= " AND appFamily.submitterId = '?' ORDER BY '?'";
$hResult = query_parameters($sQuery, $sQueued,
$_SESSION['current']->iUserId, $sOrderBy);
$sQuery .= " AND appFamily.submitterId = '?' ORDER BY '?'$sLimit";
if($sLimit)
{
$hResult = query_parameters($sQuery, $sQueued,
$_SESSION['current']->iUserId, $sOrderBy,
$iStart, $iRows);
} else
{
$hResult = query_parameters($sQuery, $sQueued,
$_SESSION['current']->iUserId, $sOrderBy);
}
} else
{
$sQuery .= " ORDER BY '?'";
$hResult = query_parameters($sQuery, $sQueued, $sOrderBy);
$sQuery .= " ORDER BY '?'$sLimit";
if($sLimit)
{
$hResult = query_parameters($sQuery, $sQueued, $sOrderBy,
$iStart, $iRows);
} else
{
$hResult = query_parameters($sQuery, $sQueued, $sOrderBy);
}
}
if(!$hResult)

View File

@@ -292,9 +292,20 @@ class application_queue
return TRUE;
}
function objectGetEntries($bQueued, $bRejected)
function objectGetItemsPerPage($bQueued = false)
{
return $this->oApp->objectGetEntries($bQueued, $bRejected);
return $this->oApp->objectGetItemsPerPage($bQueued);
}
function objectGetEntriesCount($bQueued, $bRejected)
{
return $this->oApp->objectGetEntriesCount($bQueued, $bRejected);
}
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "appId")
{
return $this->oApp->objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
$sOrderBy);
}
function objectGetHeader()