Skip to content
Snippets Groups Projects
Commit a64c9c80 authored by Xaver's avatar Xaver Committed by Till Brehm
Browse files

Sort list quota correct

parent 7a179afe
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ class listform_actions { ...@@ -39,6 +39,7 @@ class listform_actions {
private $sortKeys; private $sortKeys;
private function _sort($aOne, $aTwo) { private function _sort($aOne, $aTwo) {
$suffixes=array('k' => 1, 'M' => 1024, 'G' => 1048576, 'T' => 1099511627776);
if(!is_array($aOne) || !is_array($aTwo)) return 0; if(!is_array($aOne) || !is_array($aTwo)) return 0;
if(!is_array($this->sortKeys)) $this->sortKeys = array($this->sortKeys); if(!is_array($this->sortKeys)) $this->sortKeys = array($this->sortKeys);
...@@ -49,6 +50,15 @@ class listform_actions { ...@@ -49,6 +50,15 @@ class listform_actions {
} }
$a = $aOne[$sKey]; $a = $aOne[$sKey];
$b = $aTwo[$sKey]; $b = $aTwo[$sKey];
if(preg_match('/(\d+\.?\d*) ([kMGT])B/', $a, $match)) {
$a = $match[1] * $suffixes[$match[2]];
}
if(preg_match('/(\d+\.?\d*) ([kMGT])B/', $b, $match)) {
$b = $match[1] * $suffixes[$match[2]];
}
if(is_string($a)) $a = strtolower($a); if(is_string($a)) $a = strtolower($a);
if(is_string($b)) $b = strtolower($b); if(is_string($b)) $b = strtolower($b);
if($a < $b) return $sDir == 'DESC' ? 1 : -1; if($a < $b) return $sDir == 'DESC' ? 1 : -1;
...@@ -129,7 +139,7 @@ class listform_actions { ...@@ -129,7 +139,7 @@ class listform_actions {
// Getting Datasets from DB // Getting Datasets from DB
$records = $app->db->queryAllRecords($this->getQueryString($php_sort)); $records = $app->db->queryAllRecords($this->getQueryString($php_sort));
$csrf_token = $app->auth->csrf_token_get($app->listform->listDef['name']); $csrf_token = $app->auth->csrf_token_get($app->listform->listDef['name']);
$_csrf_id = $csrf_token['csrf_id']; $_csrf_id = $csrf_token['csrf_id'];
$_csrf_key = $csrf_token['csrf_key']; $_csrf_key = $csrf_token['csrf_key'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment