[3526] | 1 | <?php |
---|
| 2 | /***************************************************************************\ |
---|
| 3 | * eGroupWare - mydms * |
---|
| 4 | * http://www.linux-at-work.de * |
---|
| 5 | * http://www.phpgw.de * |
---|
| 6 | * http://www.egroupware.org * |
---|
| 7 | * Written by : Lars Kneschke [lkneschke@linux-at-work.de] * |
---|
| 8 | * ------------------------------------------------- * |
---|
| 9 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 10 | * under the terms of the GNU General Public License as published by the * |
---|
| 11 | * Free Software Foundation; version 2 of the License. * |
---|
| 12 | \***************************************************************************/ |
---|
| 13 | |
---|
| 14 | /* $Id: class.bofolder.inc.php 19576 2005-11-03 14:24:31Z lkneschke $ */ |
---|
| 15 | |
---|
| 16 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.Settings.php'); |
---|
| 17 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php'); |
---|
| 18 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.AccessUtils.php'); |
---|
| 19 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassAccess.php'); |
---|
| 20 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassUser.php'); |
---|
| 21 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassGroup.php'); |
---|
| 22 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassFolder.php'); |
---|
| 23 | require_once(PHPGW_SERVER_ROOT.'/mydms/inc/inc.ClassDocument.php'); |
---|
| 24 | |
---|
| 25 | class bofolder |
---|
| 26 | { |
---|
| 27 | function copyFolder($_folderID, $_targetID, $_newFolderName, $_copySubFolder, $_copyDocuments) |
---|
| 28 | { |
---|
| 29 | //print "$_folderID, $_targetID, $_copySubFolder, $_copyDocuments"; |
---|
| 30 | $folder = getFolder($_folderID); |
---|
| 31 | $targetFolder = getFolder($_targetID); |
---|
| 32 | |
---|
| 33 | $this->user = getUser($GLOBALS['phpgw_info']['user']['account_id']); |
---|
| 34 | |
---|
| 35 | if (($folder->getAccessMode($this->user) < M_READWRITE) || ($targetFolder->getAccessMode($this->user) < M_READWRITE)) |
---|
| 36 | { |
---|
| 37 | return false; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | $newFolder = $targetFolder->addSubFolder($_newFolderName, $folder->getComment(), $this->user, $folder->getSequence()); |
---|
| 41 | |
---|
| 42 | if($_copySubFolder) |
---|
| 43 | { |
---|
| 44 | $this->copySubFolder($folder, $newFolder, $_copyDocuments); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | return $newFolder; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function copySubFolder($_sourceFolder, $_newParentFolder, $_copyDocuments) |
---|
| 51 | { |
---|
| 52 | $subFolders = $_sourceFolder->getSubFolders(); |
---|
| 53 | |
---|
| 54 | foreach($subFolders as $sourceSubFolder) |
---|
| 55 | { |
---|
| 56 | $newFolder = $_newParentFolder->addSubFolder($sourceSubFolder->getName(), $sourceSubFolder->getComment(), $this->user, $sourceSubFolder->getSequence()); |
---|
| 57 | $this->copySubFolder($sourceSubFolder, $newFolder, $_copyDocuments); |
---|
| 58 | } |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | ?> |
---|