mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 05:31:42 +00:00
add optional parameters to getDocumentsByCategory, new method countDocumentsByCategory
This commit is contained in:
parent
c21388fd72
commit
822e6c13f2
|
@ -98,10 +98,14 @@ class SeedDMS_Core_DocumentCategory {
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function getDocumentsByCategory() { /* {{{ */
|
function getDocumentsByCategory($limit=0, $offset=0) { /* {{{ */
|
||||||
$db = $this->_dms->getDB();
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
$queryStr = "SELECT * FROM `tblDocumentCategory` where `categoryID`=".$this->_id;
|
$queryStr = "SELECT * FROM `tblDocumentCategory` where `categoryID`=".$this->_id;
|
||||||
|
if($limit && is_numeric($limit))
|
||||||
|
$queryStr .= " LIMIT ".(int) $limit;
|
||||||
|
if($offset && is_numeric($offset))
|
||||||
|
$queryStr .= " OFFSET ".(int) $offset;
|
||||||
$resArr = $db->getResultArray($queryStr);
|
$resArr = $db->getResultArray($queryStr);
|
||||||
if (is_bool($resArr) && !$resArr)
|
if (is_bool($resArr) && !$resArr)
|
||||||
return false;
|
return false;
|
||||||
|
@ -113,6 +117,17 @@ class SeedDMS_Core_DocumentCategory {
|
||||||
return $documents;
|
return $documents;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
function countDocumentsByCategory() { /* {{{ */
|
||||||
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
|
$queryStr = "SELECT COUNT(*) as `c` FROM `tblDocumentCategory` where `categoryID`=".$this->_id;
|
||||||
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
if (is_bool($resArr) && !$resArr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return $resArr[0]['c'];
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user