public function Sort_Click($strFormId, $strControlId, $strParameter)
{
$this->blnModified = true;
if (strlen($strParameter)) {
// Sorting
$intColumnIndex = QType::Cast($strParameter, QType::Integer);
$objColumn = $this->objColumnArray[$intColumnIndex];
// First, reset pagination (if applicable)
if ($this->objPaginator) {
$this->PageNumber = 1;
}
// First, make sure the Column is Sortable
if ($objColumn->OrderByClause) {
// It is
// Are we currently sorting by this column?
if ($this->intSortColumnIndex == $intColumnIndex) {
// Yes we are currently sorting by this column
// In Reverse?
if ($this->intSortDirection == 1) {
// Yep -- unreverse the sort
$this->intSortDirection = 0;
} else {
// Nope -- can we reverse?
if ($objColumn->ReverseOrderByClause) {
$this->intSortDirection = 1;
}
}
} else {
// Nope -- so let's set it to this column
$this->intSortColumnIndex = $intColumnIndex;
$this->intSortDirection = $objColumn->DefaultSortDirection;
}
} else {
// It isn't -- clear all sort properties
$this->intSortDirection = 0;
$this->intSortColumnIndex = -1;
}
}
}