@@ -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