Skip to content

Commit 202df8f

Browse files
author
Marius Cramer
committed
Fixed sorting of quota columns (mail quota and web site quota)
1 parent 213e0bc commit 202df8f

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

interface/lib/classes/listform.inc.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,13 @@ public function getSearchSQL($sql_where = '')
236236
}
237237
return ( $sql_where != '' ) ? $sql_where = substr($sql_where,0,-3) : '1';
238238
}
239-
239+
240+
public function getPagingValue($key) {
241+
if(!is_array($this->pagingValues)) return null;
242+
if(!array_key_exists($key, $this->pagingValues)) return null;
243+
return $this->pagingValues[$key];
244+
}
245+
240246
public function getPagingSQL($sql_where = '1')
241247
{
242248
global $app, $conf;
@@ -281,6 +287,8 @@ public function getPagingSQL($sql_where = '1')
281287
$vars['max_pages'] = $pages + 1;
282288
$vars['records_gesamt'] = $record_count['anzahl'];
283289
$vars['page_params'] = (isset($this->listDef['page_params'])) ? $this->listDef['page_params'] : '';
290+
$vars['offset'] = $sql_von;
291+
$vars['records_per_page'] = $records_per_page;
284292
//$vars['module'] = $_SESSION['s']['module']['name'];
285293

286294
if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;

interface/lib/classes/listform_actions.inc.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function onLoad()
126126
}
127127

128128
// Getting Datasets from DB
129-
$records = $app->db->queryAllRecords($this->getQueryString());
129+
$records = $app->db->queryAllRecords($this->getQueryString($php_sort));
130130

131131
$this->DataRowColor = "#FFFFFF";
132132
$records_new = '';
@@ -147,6 +147,9 @@ public function onLoad()
147147
$this->sortKeys = array($order_by => $order_dir);
148148
uasort($records_new, array($this, '_sort'));
149149
}
150+
if($php_sort) {
151+
$records_new = array_slice($records_new, $app->listform->getPagingValue('offset'), $app->listform->getPagingValue('records_per_page'));
152+
}
150153

151154
$app->tpl->setLoop('records',$records_new);
152155

@@ -185,7 +188,7 @@ public function prepareDataRow($rec)
185188
return $rec;
186189
}
187190

188-
public function getQueryString() {
191+
public function getQueryString($no_limit = false) {
189192
global $app;
190193
$sql_where = '';
191194

@@ -231,7 +234,8 @@ public function getQueryString() {
231234
}
232235
$select = implode(', ', $table_selects);
233236

234-
$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";
237+
$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";
238+
if($no_limit == false) $sql .= " $limit_sql";
235239
//echo $sql;
236240
return $sql;
237241
}

0 commit comments

Comments
 (0)