<?php
/**
 * folders module
 * @author Philipp Kamps <pkamps@probusiness.de>
 * @copyright Copyright (C) 2003 Free Software Foundation http://www.fsf.org/
 * @license http://www.fsf.org/licenses/gpl.html GNU General Public License
 * @package folders
 * @version $Id: class.bofolders.inc.php 14052 2003-11-17 17:39:14Z fipsfuchs $
 */

	include ('folders/phplayersmenu/lib/PHPLIB.php');
	include ('folders/phplayersmenu/lib/layersmenu-common.inc.php');
	include ('folders/phplayersmenu/lib/treemenu.inc.php');
	include ('folders/inc/class.treemenu.inc.php');


	class bofolders
	{
		var $public_functions = Array(
			'folders'                    => True,
			'get_user_list'              => True,
			'return_sorted_user_folders' => True,
			'get_folder_list'            => True
		 );
		var $mid;
		var $debug = false;


		function bofolders()
		{
			$this->mid = new phpGWTreeMenu();

			$this->mid->setLibjsdir('folders/phplayersmenu/libjs');
			//$this->mid->setDirroot(PHPGW_SERVER_ROOT); // not correctly working :-(
			$this->mid->setImgwww('./');
			$this->mid->setImgdir(PHPGW_SERVER_ROOT.'/');

			$this->group            = CreateObject('phpgwapi.accounts');
			$this->bo               = CreateObject('email.bopreferences');

		 }

		function buildFolders($menuname)
		{
			$hookContent = $GLOBALS['phpgw']->hooks->process('getFolderContent');

			$folderContent = array();
			while(list($key, $value) = each($hookContent))
			{
				if (is_array($hookContent[$key]['content']))
				{
					while (list($xkey, $value) = each($hookContent[$key]['content']))
					{
						$folderContent[$xkey] = $hookContent[$key]['content'][$xkey];
					}
				}
			}
			$this->mid->scanTableForMenu($menuname,'', $folderContent);
		}

		function parseFolders($menuname)
		{
			return $this->mid->newTreeMenu($menuname);
		}
	}