phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc/class.menu.inc.php, 1.2


From: nomail
Subject: [Phpgroupware-cvs] property/inc/class.menu.inc.php, 1.2
Date: Wed, 2 Jun 2004 20:54:28 +0200

Update of /property/inc
Added Files:
        Branch: 
          class.menu.inc.php

date: 2004/06/02 18:54:28;  author: sigurdne;  state: Exp;  lines: +361 -0

Log Message:
no message
=====================================================================
<?php
        
/**************************************************************************\
        * phpGroupWare - property                                               
   *
        * http://www.phpgroupware.org                                           
   *
        *                                                                       
   *
        * Facilities Management                                                 
   *
        * Written by Sigurd Nes [sigurdne at online.no]                         
   *
        * 
------------------------------------------------------------------------ *
        * Copyright 2000 - 2003 Free Software Foundation, Inc                   
   *
        * This program is part of the GNU project, see http://www.gnu.org/      
   *
        * 
------------------------------------------------------------------------ *
        * 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.                                            
   *
        
\**************************************************************************/
        /* $Id: class.menu.inc.php,v 1.2 2004/06/02 18:54:28 sigurdne Exp $ */

        class menu
        {
                var $sub;

                var $public_functions = array
                (
                        'links'                                 => True,
                );

                function menu($sub='')
                {
                        $this->sub              = $sub;
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                }

                function links($page='')
                {
                        $currentapp=$this->currentapp;
                        $sub = $this->sub;
//                      $menu = 
$GLOBALS['phpgw']->session->appsession('menu',$currentapp.$sub);
//_debug_array($page);
                        if(!$menu)
                        {
                                $this->acl2                     = 
CreateObject($this->currentapp.'.acl2');

                                $i=0;
                                if($sub=='location')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']             = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id=1');
                                $menu['module'][$i]['name']             = 
lang('Property');
                                $menu['module'][$i]['statustext']       = 
lang('Property');
                                $i++;
                                if($sub=='meter')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']             = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uimeter.index');
                                $menu['module'][$i]['name']             = 
lang('Meter');
                                $menu['module'][$i]['statustext']       = 
lang('Meter');

                                $i++;
                                if($sub=='ticket')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']                     
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index');
                                $menu['module'][$i]['name']                     
=       lang('Helpdesk');
                                $menu['module'][$i]['statustext']       =       
lang('Helpdesk');
                                $i++;
                                if($sub=='project')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']                     
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
                                $menu['module'][$i]['name']                     
=       lang('Project');
                                $menu['module'][$i]['statustext']       =       
lang('Project');
                                $i++;
                                if($sub=='invoice')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']                     
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
                                $menu['module'][$i]['name']                     
=       lang('Invoice');
                                $menu['module'][$i]['statustext']       =       
lang('Invoice');
                                $i++;
                                if($sub=='pricebook')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']                     
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
                                $menu['module'][$i]['name']                     
=       lang('Pricebook');
                                $menu['module'][$i]['statustext']       =       
lang('Pricebook');
                                $i++;
                                if($sub=='document')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']                     
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index');
                                $menu['module'][$i]['name']                     
=       lang('Documentation');
                                $menu['module'][$i]['statustext']       =       
lang('Documentation');
                                $i++;
                                if($sub=='custom')
                                {
                                        $menu['module'][$i]['this']=True;
                                }
                                $menu['module'][$i]['link']                     
=       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uicustom.index');
                                $menu['module'][$i]['name']                     
=       lang('Custom');
                                $menu['module'][$i]['statustext']       =       
lang('Custom queries');

                                $entity                 = 
CreateObject($this->currentapp.'.soadmin_entity');
                                $entity_list    = 
$entity->read(array('allrows'=>True));

                                if (isset($entity_list) AND 
is_array($entity_list))
                                {
                                        foreach($entity_list as $entry)
                                        {
                                                $i++;
                                                if($sub=='entity_' . 
$entry['id'])
                                                {
                                                        
$menu['module'][$i]['this']=True;
                                                }
                                                $menu['module'][$i]['link']     
                =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uientity.index&entity_id='
 .$entry['id']);
                                                $menu['module'][$i]['name']     
                =       $entry['name'];
                                                
$menu['module'][$i]['statustext']       =       $entry['descr'];
                                        }
                                }

                                unset($entity);

                                if ($sub == 'location')
                                {
                                        $soadmin_location       = 
CreateObject($this->currentapp.'.soadmin_location');
                                        $location       = 
$soadmin_location->select_location_type();
                                        $location_count=count($location);
                                        for ($j=0; $j<$location_count; $j++)
                                        {
                                                $i++;
                                                
if($page=='location'.$location[$j]['id'].'_')
                                                {
                                                        
$menu['sub_menu'][$i]['this']=True;
                                                }
                                                $menu['sub_menu'][$i]['link'] = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id='
 .$location[$j]['id'] );
                                                $menu['sub_menu'][$i]['name'] = 
$location[$j]['name'];
                                                
$menu['sub_menu'][$i]['statustext'] = $location[$j]['descr'];
                                        }

                                        $config_tenant = 
$soadmin_location->read_config_single('tenant_id');

                                        $i++;
                                        if(substr($page,-2)=='_1')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&lookup_tenant=1&type_id='
 . $config_tenant);
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Tenant');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Tenant');

                                        $i++;
                                        if($page=='drawing')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidrawing.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Drawing');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Drawing');
                                        $i++;
                                        if($page=='gab')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uigab.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('gabnr');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('gabnr');
                                        $i++;
                                        if($page=='summary')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.summary');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Summary');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Summary');
                                }

                                if ($sub == 'invoice')
                                {
                                        $i++;
                                        if($page=='invoice_')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Invoice');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Invoice');
                                        $i++;
                                        if($page=='invoice_1')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index&paid=true');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Paid');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Paid');
                                        $i++;
                                        if($page=='consume')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.consume');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('consume');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('consume');

                                        if ($this->acl2->check('.invoice',16))
                                        {
                                                $i++;
                                                if($page=='investment')
                                                {
                                                        
$menu['sub_menu'][$i]['this']=True;
                                                }
                                                $menu['sub_menu'][$i]['link']   
                =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvestment.index');
                                                $menu['sub_menu'][$i]['name']   
                =       lang('Investment value');
                                                
$menu['sub_menu'][$i]['statustext']             =       lang('Investment 
value');
                                                $i++;
                                                if($page=='import_inv')
                                                {
                                                        
$menu['sub_menu'][$i]['this']=True;
                                                }
                                                $menu['sub_menu'][$i]['link']   
                =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.import');
                                                $menu['sub_menu'][$i]['name']   
                =       lang('Import invoice');
                                                
$menu['sub_menu'][$i]['statustext']             =       lang('Import invoice');
                                                $i++;
                                                if($page=='export_inv')
                                                {
                                                        
$menu['sub_menu'][$i]['this']=True;
                                                }
                                                $menu['sub_menu'][$i]['link']   
                =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.export');
                                                $menu['sub_menu'][$i]['name']   
                =       lang('Export invoice');
                                                
$menu['sub_menu'][$i]['statustext']             =       lang('Export invoice');
                                        }
                                }

                                if ($sub == 'pricebook' && 
$this->acl2->check('.pricebook',16))
                                {
                                        $i++;
                                        if($page=='price_vendor')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Per Vendor');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Per Vendor');
                                        $i++;
                                        if($page=='activity')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Per Agreement');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Per Agreement');
                                        $i++;
                                        if($page=='agreement')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.agreement');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Agreement');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Agreement');
                                }

                                if ($sub == 'project')
                                {
                                        $i++;
                                        if($page=='project')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Project');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Project');
                                        $i++;
                                        if($page=='workorder')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Workorder');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Workorder');
                                        $i++;
                                        if($page=='request')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uirequest.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Request');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Request');
                                        $i++;
                                        if($page=='template')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('template');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Workorder template');
                                }

                                if ($sub == adm_loc && 
$this->acl2->check('.location',16))
                                {
                                        $i++;
                                        if($page=='loc_type')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Location type');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Location type');
                                        $i++;
                                        if($page=='loc_config')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.config');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('Config');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Location Config');
                                }

                                if ($sub == 'document')
                                {
                                        $i++;
                                        if($page=='document_')
                                        {
                                                
$menu['sub_menu'][$i]['this']=True;
                                        }
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('location');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Documentation for locations');

                                        if (isset($entity_list) AND 
is_array($entity_list))
                                        {
                                                foreach($entity_list as $entry)
                                                {
                                                        
if($entry['documentation'])
                                                        {
                                                                $i++;
                                                                
if($page=='document_'.$entry['id'])
                                                                {
                                                                        
$menu['sub_menu'][$i]['this']=True;
                                                                }
                                                                
$menu['sub_menu'][$i]['link']                   =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index&entity_id='
 .$entry['id']);
                                                                
$menu['sub_menu'][$i]['name']                   =       $entry['name'];
                                                                
$menu['sub_menu'][$i]['statustext']             =       $entry['descr'];
                                                        }
                                                }
                                        }

                                }

                                $menu = 
$GLOBALS['phpgw']->session->appsession('menu',$currentapp.$sub,$menu);
                        }

                        return $menu;
                }
        }
?>




reply via email to

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