Index: trunk/kernel/include/parseditem.php
===================================================================
diff -u -r123 -r133
--- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 123)
+++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 133)
@@ -976,6 +976,7 @@
function Query_Item($sql, $offset=-1,$rows=-1)
{
global $Errors;
+
$dummy =& $this->GetDummy();
if( !$dummy->TableExists() )
{
@@ -990,7 +991,6 @@
$result = $this->adodbConnection->SelectLimit($sql, $rows,$offset);
}
else {
- //echo $sql."
";
$result = $this->adodbConnection->Execute($sql);
}
@@ -1433,6 +1433,7 @@
{
var $Page;
var $PerPageVar;
+ var $DefaultPerPage; // use this perpage value in case if no found in config
var $EnablePaging;
var $MaxListCount = 0;
var $PageEnvar;
@@ -1475,56 +1476,46 @@
function GetPageOffset()
{
- global $objConfig;
-
$Start = 0;
-
if($this->EnablePaging)
{
- if($this->Page<1)
- $this->Page=1;
- if(is_numeric($objConfig->Get($this->PerPageVar)))
- {
- $Start = ($this->Page-1)*$objConfig->Get($this->PerPageVar);
- }
+ if($this->Page < 1) $this->Page = 1;
+ $PerPage = $this->GetPerPage();
+ $Start = ($this->Page - 1) * $PerPage;
}
else
{
- if((int)$this->MaxListCount==0)
- $Start = -1;
+ if((int)$this->MaxListCount == 0) $Start = -1;
}
- return $Start;
+ return $Start;
}
function GetPageRowCount()
{
- global $objConfig;
-
if($this->EnablePaging)
{
- if($this->Page<1)
- $this->Page=1;
-// echo "PerPageVar = ".$this->PerPageVar."
\n";
-// echo "
"; print_r($objConfig); echo ""; - return $objConfig->Get($this->PerPageVar); + if($this->Page < 1) $this->Page = 1; + return $this->GetPerPage(); } else return (int)$this->MaxListCount; } - function Query_Item($sql,$limit=NULL) + function Query_Item($sql,$limit = null, $fix_method = 'set_first') { + // query itemlist (module items) using $sql specified + // apply direct limit clause ($limit) or calculate it if not specified + // fix invalid page in case if needed by method specified in $fix_method if(strlen($limit)) { $sql .= " ".$limit; - //echo "[$sql]