Commit 53aecfc39d612a4e17d96874749409ff2eff62da
1 parent
c0dd425a
Added getList function and updated getFolderPath function
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@975 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
34 additions
and
4 deletions
lib/foldermanagement/Folder.inc
| @@ -279,6 +279,34 @@ class Folder { | @@ -279,6 +279,34 @@ class Folder { | ||
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | /** | 281 | /** |
| 282 | + * Static function | ||
| 283 | + * Get a list of Documents | ||
| 284 | + * | ||
| 285 | + * @param String Where clause (not required) | ||
| 286 | + * | ||
| 287 | + * @return Array array of Documents objects, false otherwise and set $_SESSION["errorMessage"] | ||
| 288 | + */ | ||
| 289 | + function getList($sWhereClause = null) { | ||
| 290 | + global $default, $lang_err_database; | ||
| 291 | + $aFolderArray; | ||
| 292 | + settype($aFolderArray, "array"); | ||
| 293 | + $sql = $default->db; | ||
| 294 | + // TODO: join on sys_deleted | ||
| 295 | + $result = $sql->query("SELECT * FROM " . $default->owl_folders_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); | ||
| 296 | + if ($result) { | ||
| 297 | + $iCount = 0; | ||
| 298 | + while ($sql->next_record()) { | ||
| 299 | + $oFolder = & Folder::get($sql->f("id")); | ||
| 300 | + $aFolderArray[$iCount] = $oFolder; | ||
| 301 | + $iCount++; | ||
| 302 | + } | ||
| 303 | + return $aFolderArray; | ||
| 304 | + } | ||
| 305 | + $_SESSION["errorMessage"] = $lang_err_database; | ||
| 306 | + return false; | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + /** | ||
| 282 | * Static function. | 310 | * Static function. |
| 283 | * Get the full path for a folder | 311 | * Get the full path for a folder |
| 284 | * | 312 | * |
| @@ -290,7 +318,8 @@ class Folder { | @@ -290,7 +318,8 @@ class Folder { | ||
| 290 | global $default; | 318 | global $default; |
| 291 | //if the folder has a parent | 319 | //if the folder has a parent |
| 292 | if (Folder::getParentFolderID($iFolderID) != 0) { | 320 | if (Folder::getParentFolderID($iFolderID) != 0) { |
| 293 | - return Folder::getFolderPath(Folder::getParentFolderID($iFolderID)) . "/" . Folder::getFolderName($iFolderID); | 321 | + $sCurrentPath = Folder::getFolderPath(Folder::getParentFolderID($iFolderID)) . Folder::getFolderName($iFolderID) . "/" . $sCurrentPath; |
| 322 | + return $sCurrentPath; | ||
| 294 | } | 323 | } |
| 295 | return $default->owl_FileDir . "/" . Folder::getFolderName($iFolderID) . "/"; | 324 | return $default->owl_FileDir . "/" . Folder::getFolderName($iFolderID) . "/"; |
| 296 | } | 325 | } |
| @@ -326,9 +355,10 @@ class Folder { | @@ -326,9 +355,10 @@ class Folder { | ||
| 326 | function getFolderDisplayPath($iFolderID) { | 355 | function getFolderDisplayPath($iFolderID) { |
| 327 | global $default; | 356 | global $default; |
| 328 | //if the folder has a parent | 357 | //if the folder has a parent |
| 329 | - if (Folder::getParentFolderID($iFolderID) != 0) { | 358 | + if (Folder::getParentFolderID($iFolderID) != 0) { |
| 359 | + | ||
| 330 | return Folder::getFolderDisplayPath(Folder::getParentFolderID($iFolderID)) . " > " . Folder::getFolderName($iFolderID); | 360 | return Folder::getFolderDisplayPath(Folder::getParentFolderID($iFolderID)) . " > " . Folder::getFolderName($iFolderID); |
| 331 | - } else { | 361 | + } else { |
| 332 | return Folder::getFolderName($iFolderID); | 362 | return Folder::getFolderName($iFolderID); |
| 333 | } | 363 | } |
| 334 | } | 364 | } |
| @@ -341,7 +371,7 @@ class Folder { | @@ -341,7 +371,7 @@ class Folder { | ||
| 341 | * | 371 | * |
| 342 | * @return integer primary key of parent folder | 372 | * @return integer primary key of parent folder |
| 343 | */ | 373 | */ |
| 344 | - function getParentFolderID($iFolderID) { | 374 | + function getParentFolderID($iFolderID) { |
| 345 | if ($iFolderID != 0) { | 375 | if ($iFolderID != 0) { |
| 346 | global $default; | 376 | global $default; |
| 347 | $sql = $default->db; | 377 | $sql = $default->db; |