Permalink
Browse files

Merging from HEAD:

Now get_sql_sort can be called static-function-imitation style as well.
Necessary to solve SC#187 gracefully.
  • Loading branch information...
1 parent 14c3063 commit a945eab2c289136562f2c701c9ce41fc3bb5da71 defacer committed Nov 13, 2005
Showing with 18 additions and 5 deletions.
  1. +18 −5 lib/tablelib.php
View
@@ -287,13 +287,26 @@ function setup() {
$this->setup = true;
}
- function get_sql_sort() {
- if(!$this->setup) {
- return false;
+ function get_sql_sort($uniqueid = NULL) {
+ if($uniqueid === NULL) {
+ // "Non-static" function call
+ if(!$this->setup) {
+ return false;
+ }
+ $sess = &$this->sess;
}
- if(!empty($this->sess->sortby)) {
+ else {
+ // "Static" function call
+ global $SESSION;
+ if(empty($SESSION->flextable[$uniqueid])) {
+ return '';
+ }
+ $sess = &$SESSION->flextable[$uniqueid];
+ }
+
+ if(!empty($sess->sortby)) {
$sortstring = '';
- foreach($this->sess->sortby as $column => $order) {
+ foreach($sess->sortby as $column => $order) {
if(!empty($sortstring)) {
$sortstring .= ', ';
}

0 comments on commit a945eab

Please sign in to comment.