Fix error caclulating total number of pages
This commit is contained in:
parent
0f803336c2
commit
82985b5fe1
1 changed files with 5 additions and 5 deletions
|
@ -23,6 +23,7 @@ class Submenu_Page {
|
|||
public $_path;
|
||||
|
||||
function __construct( $path ) {
|
||||
global $wpdb;
|
||||
|
||||
$this->_path = $path;
|
||||
$this->console_log('$_path -> '. $this->_path);
|
||||
|
@ -39,7 +40,7 @@ class Submenu_Page {
|
|||
'pg_limit integer not null default 0,' .
|
||||
'pg_dt datetime default current_timestamp, '.
|
||||
'unique lstix (pg_ix) );';
|
||||
$GLOBALS['wpdb']->query($sql);
|
||||
$wpdb->query($sql);
|
||||
|
||||
if ( ! $this->pmtLstRdy() ) {
|
||||
//
|
||||
|
@ -58,7 +59,7 @@ class Submenu_Page {
|
|||
$this->_npages . ',' .
|
||||
$this->_offset . ',' .
|
||||
$this->_limit .')';
|
||||
$GLOBALS['wpdb']->query($sql);
|
||||
$wpdb->query($sql);
|
||||
} else {
|
||||
// Load last state
|
||||
$params = $this->pmtLstParams();
|
||||
|
@ -70,12 +71,12 @@ class Submenu_Page {
|
|||
//
|
||||
// Calc new number of pages
|
||||
//
|
||||
$this->_npages = intdiv($this->_npages,$this->_limit);
|
||||
$this->_npages = intdiv($this->_nrows,$this->_limit);
|
||||
if ( $this->_nrows > ($this->_npages*$this->_limit) ) {
|
||||
$this->_npages++;
|
||||
}
|
||||
$sql = 'update zgo_pmtlst set pg_npages=' . $this->_npages . ' where pg_ix=1';
|
||||
$GLOBALS['wpdb']->query($sql);
|
||||
$wpdb->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +117,6 @@ class Submenu_Page {
|
|||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$currentDate = date('Y-m-d H:i:s');
|
||||
|
|
Loading…
Reference in a new issue