Skip to content

Instantly share code, notes, and snippets.

@MissAllSunday
Created March 20, 2014 17:56
Show Gist options
  • Save MissAllSunday/9669911 to your computer and use it in GitHub Desktop.
Save MissAllSunday/9669911 to your computer and use it in GitHub Desktop.
// Get the right sort method depending on the cust field type.
if ($row['field_type'] != 'check')
$cpf['columns'][$row['col_name']]['sort'] = array(
'down' => 'LENGTH(t' . $row['col_name'] . '.value) > 0 ASC, IFNULL(t' . $row['col_name'] . '.value, 1=1) DESC, t' . $row['col_name'] . '.value DESC',
'up' => 'LENGTH(t' . $row['col_name'] . '.value) > 0 DESC, IFNULL(t' . $row['col_name'] . '.value, 1=1) ASC, t' . $row['col_name'] . '.value ASC'
);
else
$cpf['columns'][$row['col_name']]['sort'] = array(
'down' => 't' . $row['col_name'] . '.value DESC',
'up' => 't' . $row['col_name'] . '.value ASC'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment