phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] folders/inc class.treemenu.inc.php,NONE,1.1


From: Philipp Kamps <address@hidden>
Subject: [Phpgroupware-cvs] folders/inc class.treemenu.inc.php,NONE,1.1
Date: Fri, 07 Nov 2003 17:02:00 +0000

Update of /cvsroot/phpgroupware/folders/inc
In directory subversions:/tmp/cvs-serv17421/inc

Added Files:
        class.treemenu.inc.php 
Log Message:
subclass of treemenu.inc move fromt the phplayersmenu project to this directory

--- NEW FILE: class.treemenu.inc.php ---
<?php
// PHP Layers Menu 3.1.0 (C) 2001-2003 Marco Pratesi (marco at telug dot it)

        
/**************************************************************************\
        * phpGroupWare - Folders                                                
   *
        * http://www.phpgroupware.org                                           
   *
        * Written by Philipp Kamps <address@hidden>               *
        * --------------------------------------------                          
   *
        *  This program is free software; you can redistribute it and/or modify 
it *
        *  under the terms of the GNU General Public License as published by 
the   *
        *  Free Software Foundation; either version 2 of the License, or (at 
your  *
        *  option) any later version.                                           
   *
        
\**************************************************************************/



class phpGWTreeMenu extends TreeMenu
{

        function phpGWTreeMenu()
        {
                $this->TreeMenu();
        }

/**
* The method to parse the current menu table and correspondingly update related 
variables
* @access public
* @param string $menu_name the name to be attributed to the menu
*   whose structure has to be parsed
* @param string $language i18n language; either omit it or pass
*   an empty string ("") if you do not want to use any i18n table
* @return void
*/
        function scanTableForMenu(
                $menu_name = '', // non consistent default...
                $language = '',
                $db,
                $mailFolders
                ) {
                $this->_maxLevel[$menu_name] = 0;
                $this->_firstLevelCnt[$menu_name] = 0;
                unset($this->tree[$this->_nodesCount+1]);
                $this->_firstItem[$menu_name] = $this->_nodesCount + 1;

                $sql = (
                'SELECT ' .
                        'cat_id AS id, ' .
                        'cat_parent AS parent_id, ' .
                        'cat_name AS text, ' .
                        'cat_name AS href, ' .
                        'cat_name AS title, ' .
                        //'cat_id AS icon, ' .
                        'cat_appname AS target ' .
                        //$this->tableFields["expanded"] . " AS expanded
                'FROM phpgw_categories ' .
                'WHERE ( cat_owner=\'6\' or cat_access = \'public\') '
                );

                //echo $sql;
                $db->query($sql,__LINE__,__FILE__);

                $this->_tmpArray = array();
                while ($db->next_record())
                {
                        if ($db->f('target') == 'phpgw')
                        {
                                $module = '';
                        }
                        else
                        {
                                $module = $db->f('target');
                        }
                        $this->_tmpArray[$db->f('id')]['parent_id'] = 
$db->f('parent_id');
                        $this->_tmpArray[$db->f('id')]['text']      = 
$db->f('text');
                        $this->_tmpArray[$db->f('id')]['href']      = 
$GLOBALS['phpgw']->link('/'.$module.'/index.php', array( 'fcat_id' => 
$db->f('id') ) );
                        $this->_tmpArray[$db->f('id')]['title']     = 
$db->f('title');
                        $this->_tmpArray[$db->f('id')]['icon']      = 
$module.'.png';
                        $this->_tmpArray[$db->f('id')]['target']    = '_parent';
                        $this->_tmpArray[$db->f('id')]['expanded']  = 
$db->f('expanded');
                }

                for($i=0; $i < count($mailFolders); $i++)
                {
                        $this->_tmpArray[$mailFolders[$i]['id']] = array 
('parent_id' => $mailFolders[$i]['parent_id'],
                                                                                
                                                                                
                                                                'title'     => 
$mailFolders[$i]['title'],
                                                                                
                                                                                
                                                                'text'      => 
$mailFolders[$i]['name'],
                                                                                
                                                                                
                                                                'icon'      => 
$mailFolders[$i]['icon'],
                                                                                
                                                                                
                                                                'href'      => 
$mailFolders[$i]['href'],
                                                                                
                                                                                
                                                                'target'    => 
$mailFolders[$i]['target']
                                                                                
                                                                                
                                                         );
                }

                $this->_depthFirstSearch($this->_tmpArray, $menu_name, '0', 1);

                $this->_lastItem[$menu_name] = count($this->tree);
                $this->_nodesCount = $this->_lastItem[$menu_name];
                $this->tree[$this->_lastItem[$menu_name]+1]["level"] = 0;
                $this->_postParse($menu_name);
        }
}

?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]