Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -253,6 +253,10 @@ class _Content extends Table
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure we initialize the default sort fields so that we can properly get the column sort direction */
|
||||
$this->defaultSortBy = $this->sortBy;
|
||||
$this->defaultSortDirection = $this->sortDirection;
|
||||
|
||||
/* Do any multi-mod */
|
||||
if ( isset( \IPS\Request::i()->modaction ) )
|
||||
{
|
||||
@@ -1061,4 +1065,24 @@ class _Content extends Table
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sort direction to use for links
|
||||
*
|
||||
* @note Abstracted so other table helper instances can adjust as needed
|
||||
* @param string $column Sort by string
|
||||
* @return string [asc|desc]
|
||||
*/
|
||||
public function getSortDirection( $column )
|
||||
{
|
||||
$class = $this->class;
|
||||
|
||||
/* ID and Title columns should be ascending */
|
||||
if( $column != $this->defaultSortBy AND ( $column == $class::$databaseColumnId OR $column == $class::$databaseColumnMap[ 'title' ] ) )
|
||||
{
|
||||
return 'asc';
|
||||
}
|
||||
|
||||
return parent::getSortDirection( $column );
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,16 @@ abstract class _Table
|
||||
* @brief Columns that are not sortable
|
||||
*/
|
||||
public $noSort = array();
|
||||
|
||||
/**
|
||||
* @brief Default column to sort results by
|
||||
*/
|
||||
public $defaultSortBy;
|
||||
|
||||
/**
|
||||
* @brief Default sort direction - "asc" or "desc"
|
||||
*/
|
||||
public $defaultSortDirection = NULL;
|
||||
|
||||
/**
|
||||
* @brief Filters
|
||||
@@ -770,6 +780,12 @@ abstract class _Table
|
||||
*/
|
||||
public function getSortDirection( $column )
|
||||
{
|
||||
/* If the column we are sorting by is the default sort, use the default sort direction */
|
||||
if ( $this->defaultSortBy AND $column == $this->defaultSortBy AND $this->defaultSortDirection )
|
||||
{
|
||||
return $this->defaultSortDirection;
|
||||
}
|
||||
|
||||
if( $column == 'title' )
|
||||
{
|
||||
return 'asc';
|
||||
|
||||
Reference in new issue
Block a user