projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rewrite to use db_pager.
[fa-stable.git]
/
includes
/
db_pager.inc
diff --git
a/includes/db_pager.inc
b/includes/db_pager.inc
index f00cc9060ea20e4c4c4e7e5e1af5b7227e47e282..474fed7a1327d4726702f613cc5843caddbc4ff8 100644
(file)
--- a/
includes/db_pager.inc
+++ b/
includes/db_pager.inc
@@
-112,7
+112,7
@@
class db_pager {
// Change sort column direction
// in order asc->desc->none->asc
//
// Change sort column direction
// in order asc->desc->none->asc
//
- function sort_table($col
=null
)
+ function sort_table($col)
{
$ord = $this->columns[$col]['ord'];
$ord = ($ord == '') ? 'asc' : (($ord == 'asc') ? 'desc' : '');
{
$ord = $this->columns[$col]['ord'];
$ord = ($ord == '') ? 'asc' : (($ord == 'asc') ? 'desc' : '');
@@
-196,7
+196,7
@@
class db_pager {
$flds = array($flds);
}
foreach ($flds as $colnum=>$coldef) {
$flds = array($flds);
}
foreach ($flds as $colnum=>$coldef) {
- if (
!is_numeric($colnum)) {
// 'colname'=>params
+ if (
is_string($colnum)) {
// 'colname'=>params
$h = $colnum;
$c = $coldef;
} else { // n=>params
$h = $colnum;
$c = $coldef;
} else { // n=>params
@@
-207,9
+207,8
@@
class db_pager {
$h = $coldef;
$c = 'text';
}
$h = $coldef;
$c = 'text';
}
- $c = '';
}
}
- if (
!is_array
($c)) // params is simple column type
+ if (
is_string
($c)) // params is simple column type
$c = array('type'=>$c);
if (!isset($c['type']))
$c = array('type'=>$c);
if (!isset($c['type']))
@@
-249,7
+248,8
@@
class db_pager {
return "SELECT COUNT($group) FROM $from $where";
}
return "SELECT COUNT($group) FROM $from $where";
}
- $sql = "$select FROM $from $where GROUP BY $group";
+ $sql = "$select FROM $from $where";
+ if($group) $sql.= " GROUP BY $group";
$ord = array();
foreach( $this->columns as $col) {
$ord = array();
foreach( $this->columns as $col) {
@@
-297,7
+297,7
@@
class db_pager {
global $Ajax;
$page = find_submit($this->name.'_page_', false);
global $Ajax;
$page = find_submit($this->name.'_page_', false);
- $sort = find_submit($this->name.'_sort_',
fals
e);
+ $sort = find_submit($this->name.'_sort_',
tru
e);
if ($page) {
$this->change_page($page);
if ($page == 'next' && !$this->next_page ||
if ($page) {
$this->change_page($page);
if ($page == 'next' && !$this->next_page ||
@@
-306,7
+306,7
@@
class db_pager {
if ($page == 'prev' && !$this->prev_page ||
$page == 'first' && !$this->first_page)
set_focus($this->name.'_page_next');
if ($page == 'prev' && !$this->prev_page ||
$page == 'first' && !$this->first_page)
set_focus($this->name.'_page_next');
- } elseif ($sort) {
+ } elseif ($sort
!= -1
) {
$this->sort_table($sort);
} else
$this->query();
$this->sort_table($sort);
} else
$this->query();