distribution: Make tables sortable
This commit is contained in:
committed by
Chris Morgan
parent
3a3863ccd2
commit
6361b26cb2
@@ -492,9 +492,9 @@ class distribution {
|
|||||||
|
|
||||||
function objectGetHeader()
|
function objectGetHeader()
|
||||||
{
|
{
|
||||||
$oTableRow = new TableRow();
|
$oTableRow = new TableRowSortable();
|
||||||
|
|
||||||
$oTableRow->AddTextCell("Distribution name");
|
$oTableRow->AddSortableTextCell("Distribution name", "name");
|
||||||
|
|
||||||
$oTableRow->AddTextCell("Distribution url");
|
$oTableRow->AddTextCell("Distribution url");
|
||||||
|
|
||||||
@@ -505,7 +505,12 @@ class distribution {
|
|||||||
return $oTableRow;
|
return $oTableRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
public static function objectGetSortableFields()
|
||||||
|
{
|
||||||
|
return array('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "name", $bAscending = TRUE)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
if($bRejected)
|
if($bRejected)
|
||||||
@@ -516,12 +521,14 @@ class distribution {
|
|||||||
if($bQueued && !distribution::canEdit())
|
if($bQueued && !distribution::canEdit())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
$sOrder = $bAscending ? "ASC" : "DESC";
|
||||||
|
|
||||||
/* If row limit is 0 we want to fetch all rows */
|
/* If row limit is 0 we want to fetch all rows */
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = distribution::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = distribution::objectGetEntriesCount($bQueued, $bRejected);
|
||||||
|
|
||||||
$sQuery = "SELECT * FROM distributions
|
$sQuery = "SELECT * FROM distributions
|
||||||
WHERE queued = '?' ORDER BY name LIMIT ?,?";
|
WHERE queued = '?' ORDER BY $sOrderBy $sOrder LIMIT ?,?";
|
||||||
|
|
||||||
return query_parameters($sQuery, $bQueued ? "true" : "false",
|
return query_parameters($sQuery, $bQueued ? "true" : "false",
|
||||||
$iStart, $iRows);
|
$iStart, $iRows);
|
||||||
|
|||||||
Reference in New Issue
Block a user