- rename class to LetoDMS_Folder

- created replacement function for getFolder(), etc. as static method
This commit is contained in:
steinm 2010-10-30 19:29:09 +00:00
parent 7566c92cd9
commit 509aaa18d6

View File

@ -17,59 +17,25 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
function getFolder($id)
{
GLOBAL $db;
if (!is_numeric($id)) return false;
$queryStr = "SELECT * FROM tblFolders WHERE id = " . $id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
else if (count($resArr) != 1)
return false;
$resArr = $resArr[0];
return new Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
}
function getFolder($id) {
return LetoDMS_Folder::getFolder($id);
}
function getFolderPathHTML($folder, $tagAll=false) {
$path = $folder->getPath();
$txtpath = "";
for ($i = 0; $i < count($path); $i++) {
if ($i +1 < count($path)) {
$txtpath .= "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
$path[$i]->getName()."</a> / ";
}
else {
$txtpath .= ($tagAll ? "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
$path[$i]->getName()."</a>" : $path[$i]->getName());
}
}
return $txtpath;
}
function getFolderPathPlain($folder) {
$path="";
$folderPath = $folder->getPath();
for ($i = 0; $i < count($folderPath); $i++) {
$path .= $folderPath[$i]->getName();
if ($i +1 < count($folderPath))
$path .= " / ";
}
return $path;
}
return $folder->getFolderPathHTML($tagAll);
}
function getFolderPathPlain($folder) {
return $folder->getFolderPathPlain();
}
/**********************************************************************\
| Folder-Klasse |
\**********************************************************************/
class Folder
class LetoDMS_Folder
{
var $_id;
var $_name;
@ -80,7 +46,7 @@ class Folder
var $_defaultAccess;
var $_sequence;
function Folder($id, $name, $parentID, $comment, $ownerID, $inheritAccess, $defaultAccess, $sequence)
function LetoDMS_Folder($id, $name, $parentID, $comment, $ownerID, $inheritAccess, $defaultAccess, $sequence)
{
$this->_id = $id;
$this->_name = $name;
@ -92,6 +58,24 @@ class Folder
$this->_sequence = $sequence;
}
function getFolder($id)
{
GLOBAL $db;
if (!is_numeric($id)) return false;
$queryStr = "SELECT * FROM tblFolders WHERE id = " . $id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
else if (count($resArr) != 1)
return false;
$resArr = $resArr[0];
return new LetoDMS_Folder($resArr["id"], $resArr["name"], $resArr["parent"], $resArr["comment"], $resArr["owner"], $resArr["inheritAccess"], $resArr["defaultAccess"], $resArr["sequence"]);
}
function getID() { return $this->_id; }
function getName() { return $this->_name; }
@ -397,7 +381,7 @@ class Folder
$this->_subFolders = array();
for ($i = 0; $i < count($resArr); $i++)
$this->_subFolders[$i] = new Folder($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["parent"], $resArr[$i]["comment"], $resArr[$i]["owner"], $resArr[$i]["inheritAccess"], $resArr[$i]["defaultAccess"], $resArr[$i]["sequence"]);
$this->_subFolders[$i] = new LetoDMS_Folder($resArr[$i]["id"], $resArr[$i]["name"], $resArr[$i]["parent"], $resArr[$i]["comment"], $resArr[$i]["owner"], $resArr[$i]["inheritAccess"], $resArr[$i]["defaultAccess"], $resArr[$i]["sequence"]);
}
return $this->_subFolders;
@ -456,6 +440,33 @@ class Folder
}
}
function getFolderPathHTML($tagAll=false) {
$path = $this->getPath();
$txtpath = "";
for ($i = 0; $i < count($path); $i++) {
if ($i +1 < count($path)) {
$txtpath .= "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
$path[$i]->getName()."</a> / ";
}
else {
$txtpath .= ($tagAll ? "<a href=\"../out/out.ViewFolder.php?folderid=".$path[$i]->getID()."&showtree=".showtree()."\">".
$path[$i]->getName()."</a>" : $path[$i]->getName());
}
}
return $txtpath;
}
function getFolderPathPlain() {
$path="";
$folderPath = $this->getPath();
for ($i = 0; $i < count($folderPath); $i++) {
$path .= $folderPath[$i]->getName();
if ($i +1 < count($folderPath))
$path .= " / ";
}
return $path;
}
/**
* Überprüft, ob dieser Ordner ein Unterordner von $folder ist
*/