Commit 85dbb5a71b217ac0c6c4cb8c2f145d8c126141e5

Authored by Michael Joseph
1 parent 98a31d30

changed displayFolderPathLink to handle an array of folderIDs instead of folderNames

added optional link page parameter to displayFolderPathLink and displayFolderLink


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@526 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc
1 <?php 1 <?php
2 2
3 /** 3 /**
4 -* HTML information for folder stuff  
5 -*  
6 -*  
7 -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa  
8 -* @date 23 January 2003  
9 -* @package presentation.lookAndFeel.knowledgeTree.foldermanagement  
10 -*/ 4 + * $Id$
  5 + *
  6 + * HTML information for folder stuff
  7 + *
  8 + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  9 + *
  10 + * @version $Revision$
  11 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  12 + * @date 23 January 2003
  13 + * @package presentation.lookAndFeel.knowledgeTree.foldermanagement
  14 + */
11 15
12 -function displayFolderPathLink($aPathArray) { 16 +/**
  17 + * Displays the passed path array as a link
  18 + *
  19 + * @param array containing the path to the folder (folder ids)
  20 + * @param string the page to link to (defaults to the page this is called from)
  21 + */
  22 +function displayFolderPathLink($aPathArray, $sLinkPage = "") {
  23 + if (strlen($sLinkPath) == 0) {
  24 + $sLinkPath = $_SERVER["PHP_SELF"];
  25 + }
13 // display a separate link to each folder in the path 26 // display a separate link to each folder in the path
14 for ($i=0; $i<count($aPathArray); $i++) { 27 for ($i=0; $i<count($aPathArray); $i++) {
15 - // retrieve the folder id for this folder name  
16 - $iFolderID = Folder::getFolderID($aPathArray[$i]); 28 + $iFolderID = $aPathArray[$i];
  29 + // retrieve the folder name for this folder
  30 + $sFolderName = Folder::getFolderName($iFolderID);
17 // generate a link back to this page setting fFolderID 31 // generate a link back to this page setting fFolderID
18 - $sLink = generateLink($_SERVER["PHP_SELF"], 32 + $sLink = generateLink($sLinkPage,
19 "fBrowseType=folder&fFolderID=$iFolderID", 33 "fBrowseType=folder&fFolderID=$iFolderID",
20 - $aPathArray[$i]); 34 + $sFolderName);
21 $sPathLinks = (strlen($sPathLinks) > 0) ? $sPathLinks . " > " . $sLink : $sLink; 35 $sPathLinks = (strlen($sPathLinks) > 0) ? $sPathLinks . " > " . $sLink : $sLink;
22 } 36 }
23 return $sPathLinks; 37 return $sPathLinks;
24 } 38 }
25 39
26 -function displayFolderLink($oFolder) { 40 +
  41 +/**
  42 + * Displays the passed folder name as a link
  43 + *
  44 + * @param object the folder to link to
  45 + * @param string the page to link to (defaults to the page this is called from)
  46 + */
  47 +function displayFolderLink($oFolder, $sLinkPage = "") {
27 global $default; 48 global $default;
  49 +
  50 + if (strlen($sLinkPath) == 0) {
  51 + $sLinkPath = $_SERVER["PHP_SELF"];
  52 + }
  53 +
28 $sFolderIconPath = generateImage($default->owl_graphics_url . "/widgets/dfolder.gif"); 54 $sFolderIconPath = generateImage($default->owl_graphics_url . "/widgets/dfolder.gif");
29 - return generateLink($_SERVER["PHP_SELF"], 55 + return generateLink($sLinkPage,
30 "fBrowseType=folder&fFolderID=" . $oFolder->getID(), 56 "fBrowseType=folder&fFolderID=" . $oFolder->getID(),
31 $sFolderIconPath . 57 $sFolderIconPath .
32 $oFolder->getName()); 58 $oFolder->getName());