mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
add some documentation for isDescendant() and isSubFolder()
This commit is contained in:
parent
3d7357fca9
commit
3cf58fbc86
|
@ -390,6 +390,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
* to say it differently the passed folder is somewhere below the
|
||||
* current folder.
|
||||
*
|
||||
* This is basically the opposite of {@see SeedDMS_Core_Folder::isDescendant()}
|
||||
*
|
||||
* @param SeedDMS_Core_Folder $subfolder folder to be checked if it is
|
||||
* a subfolder on any level of the current folder
|
||||
* @return bool true if passed folder is a subfolder, otherwise false
|
||||
|
@ -795,15 +797,22 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
|
||||
/**
|
||||
* Check, if this folder is a subfolder of a given folder
|
||||
*
|
||||
*
|
||||
* This is basically the opposite of {@see SeedDMS_Core_Folder::isSubFolder()}
|
||||
*
|
||||
* @param object $folder parent folder
|
||||
* @return boolean true if folder is a subfolder
|
||||
*/
|
||||
function isDescendant($folder) { /* {{{ */
|
||||
function isDescendant($folder) { /* {{{ */
|
||||
/* If the current folder has no parent it cannot be a descendant */
|
||||
if(!$this->getParent())
|
||||
return false;
|
||||
return false;
|
||||
/* Check if the passed folder is the parent of the current folder.
|
||||
* In that case the current folder is a subfolder of the passed folder.
|
||||
*/
|
||||
if($this->getParent()->getID() == $folder->getID())
|
||||
return true;
|
||||
return true;
|
||||
/* Recursively go up to the root folder */
|
||||
return $this->getParent()->isDescendant($folder);
|
||||
} /* }}} */
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user