add optional parameter $limit and $offset to SeedDMS_Core_Folder::getSubFolders

This commit is contained in:
Uwe Steinmann 2017-12-19 07:05:08 +01:00
parent 5c80a8bf6d
commit b0747e74f0
2 changed files with 13 additions and 4 deletions

View File

@ -462,9 +462,11 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
* @param string $orderby if set to 'n' the list is ordered by name, otherwise
* it will be ordered by sequence
* @param string $dir direction of sorting (asc or desc)
* @param integer $limit limit number of subfolders
* @param integer $offset offset in retrieved list of subfolders
* @return array list of folder objects or false in case of an error
*/
function getSubFolders($orderby="", $dir="asc") { /* {{{ */
function getSubFolders($orderby="", $dir="asc", $limit=0, $offset=0) { /* {{{ */
$db = $this->_dms->getDB();
if (!isset($this->_subFolders)) {
@ -475,6 +477,11 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
elseif ($orderby=="d") $queryStr .= " ORDER BY `date`";
if($dir == 'desc')
$queryStr .= " DESC";
if(is_int($limit) && $limit > 0) {
$queryStr .= " LIMIT ".$limit;
if(is_int($offset) && $offset > 0)
$queryStr .= " OFFSET ".$offset;
}
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
@ -670,10 +677,11 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
elseif($orderby=="d") $queryStr .= " ORDER BY `date`";
if($dir == 'desc')
$queryStr .= " DESC";
if(is_int($limit) && $limit > 0)
if(is_int($limit) && $limit > 0) {
$queryStr .= " LIMIT ".$limit;
if(is_int($offset) && $offset > 0)
$queryStr .= " OFFSET ".$offset;
if(is_int($offset) && $offset > 0)
$queryStr .= " OFFSET ".$offset;
}
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$resArr)

View File

@ -32,6 +32,7 @@
- add SeedDMS_Core_DocumentFile::setDate()
- remove SeedDMS_Core_DocumentCategory::addCategory() and getCategories()
- add optional parameters $limit and $offset to SeedDMS_Core_Folder::getDocuments()
and SeedDMS_Core_Folder::getSubFolders()
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">