From 202df8fed7b7f32b624480b6382154262e5facfb Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 14 Nov 2013 05:04:08 -0500
Subject: [PATCH] Fixed sorting of quota columns (mail quota and web site quota)
---
interface/lib/classes/listform_actions.inc.php | 10 +++++++---
interface/lib/classes/listform.inc.php | 10 +++++++++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index 68d89b3..cf8f641 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -236,7 +236,13 @@
}
return ( $sql_where != '' ) ? $sql_where = substr($sql_where,0,-3) : '1';
}
-
+
+ public function getPagingValue($key) {
+ if(!is_array($this->pagingValues)) return null;
+ if(!array_key_exists($key, $this->pagingValues)) return null;
+ return $this->pagingValues[$key];
+ }
+
public function getPagingSQL($sql_where = '1')
{
global $app, $conf;
@@ -281,6 +287,8 @@
$vars['max_pages'] = $pages + 1;
$vars['records_gesamt'] = $record_count['anzahl'];
$vars['page_params'] = (isset($this->listDef['page_params'])) ? $this->listDef['page_params'] : '';
+ $vars['offset'] = $sql_von;
+ $vars['records_per_page'] = $records_per_page;
//$vars['module'] = $_SESSION['s']['module']['name'];
if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index acb0b96..70a6bde 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -126,7 +126,7 @@
}
// Getting Datasets from DB
- $records = $app->db->queryAllRecords($this->getQueryString());
+ $records = $app->db->queryAllRecords($this->getQueryString($php_sort));
$this->DataRowColor = "#FFFFFF";
$records_new = '';
@@ -147,6 +147,9 @@
$this->sortKeys = array($order_by => $order_dir);
uasort($records_new, array($this, '_sort'));
}
+ if($php_sort) {
+ $records_new = array_slice($records_new, $app->listform->getPagingValue('offset'), $app->listform->getPagingValue('records_per_page'));
+ }
$app->tpl->setLoop('records',$records_new);
@@ -185,7 +188,7 @@
return $rec;
}
- public function getQueryString() {
+ public function getQueryString($no_limit = false) {
global $app;
$sql_where = '';
@@ -231,7 +234,8 @@
}
$select = implode(', ', $table_selects);
- $sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql";
+ $sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql";
+ if($no_limit == false) $sql .= " $limit_sql";
//echo $sql;
return $sql;
}
--
Gitblit v1.9.1