Commit 53aecfc39d612a4e17d96874749409ff2eff62da

Authored by rob
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 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 310 * Static function.
283 311 * Get the full path for a folder
284 312 *
... ... @@ -290,7 +318,8 @@ class Folder {
290 318 global $default;
291 319 //if the folder has a parent
292 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 324 return $default->owl_FileDir . "/" . Folder::getFolderName($iFolderID) . "/";
296 325 }
... ... @@ -326,9 +355,10 @@ class Folder {
326 355 function getFolderDisplayPath($iFolderID) {
327 356 global $default;
328 357 //if the folder has a parent
329   - if (Folder::getParentFolderID($iFolderID) != 0) {
  358 + if (Folder::getParentFolderID($iFolderID) != 0) {
  359 +
330 360 return Folder::getFolderDisplayPath(Folder::getParentFolderID($iFolderID)) . " > " . Folder::getFolderName($iFolderID);
331   - } else {
  361 + } else {
332 362 return Folder::getFolderName($iFolderID);
333 363 }
334 364 }
... ... @@ -341,7 +371,7 @@ class Folder {
341 371 *
342 372 * @return integer primary key of parent folder
343 373 */
344   - function getParentFolderID($iFolderID) {
  374 + function getParentFolderID($iFolderID) {
345 375 if ($iFolderID != 0) {
346 376 global $default;
347 377 $sql = $default->db;
... ...