add method isDescendant()

This commit is contained in:
Uwe Steinmann 2019-07-01 13:05:40 +02:00
parent d1100501fc
commit 536067200e

View File

@ -519,6 +519,24 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
return true;
} /* }}} */
/**
* Check, if this document is below of a given folder
*
* @param object $folder parent folder
* @return boolean true if folder is a subfolder
*/
function isDescendant($folder) { /* {{{ */
/* First check if the parent folder is folder looking for */
if ($this->getFolder()->getID() == $folder->getID())
return true;
/* Second, check for the parent folder of this document to be
* below the given folder
*/
if($this->getFolder()->isDescendant($folder))
return true;
return false;
} /* }}} */
/**
* Return the parent folder of the document
*