add $skiproot and $sep parameter to getFolderPathPlain()

This commit is contained in:
Uwe Steinmann 2022-11-29 17:31:54 +01:00
parent c87eb6c6f0
commit e8192d2813

View File

@ -782,17 +782,20 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
* Run str_replace(' / ', '/', $path) on it to get a valid unix * Run str_replace(' / ', '/', $path) on it to get a valid unix
* file system path. * file system path.
* *
* @param bool $skiproot skip the name of the root folder and start with $sep
* @param string $sep separator between path elements
* @return string path separated with ' / ' * @return string path separated with ' / '
*/ */
function getFolderPathPlain() { /* {{{ */ function getFolderPathPlain($skiproot = false, $sep = ' / ') { /* {{{ */
$path=""; $path="";
$folderPath = $this->getPath(); $folderPath = $this->getPath();
for ($i = 0; $i < count($folderPath); $i++) { for ($i = 0; $i < count($folderPath); $i++) {
if($i > 0 || !$skiproot)
$path .= $folderPath[$i]->getName(); $path .= $folderPath[$i]->getName();
if ($i +1 < count($folderPath)) if ($i +1 < count($folderPath))
$path .= " / "; $path .= $sep;
} }
return $path; return trim($path);
} /* }}} */ } /* }}} */
/** /**