<?php

/**
* @package Admin
*/
class Admin_menu extends NE_MenuHook
{
    function Admin_menu(&$user, &$customer, &$tpl)
    {
            parent::NE_MenuHook($user, $customer, $tpl);

            if($this->user->isAdmin()){

                //Settings menu item
                $menuItem = new NE_MenuItem($this->user->lang('Settings'),"index.php?fuse=admin&amp;view=Settings&amp;settings=account_general");
                $menuItem->addViews(array(
                    "ViewModuleSettings",
                    "ViewBillingTypes",
                    "ViewTaxOverview",
                    "ViewAddTaxRules",
                    "ViewListCoupons",
                    "ViewCurrencies",
                    "ViewAdmin_Emails",
                    "ViewEmailRoutings",
                    "ViewMailGeneral",
                    "ViewKBGeneral",
                    "ViewAccountGeneral",
                    "ViewLocalizationSettings",
                    "ViewSignupGeneral",
                    "ViewSecurityGeneral",
                    "ViewPasswordSettings",
                    "ViewAPIKey",
                    "ViewDisplayPassphraseInfo",
                    "ViewDisplayEncryptDomainPasswords",
                    "ViewSupportGeneral",
                    "ViewBillingGeneral",
                    "ViewSupportWidget",
                    "ViewDepartments",
                    "ViewEscalations",
                    "ViewTicketTypes",
                    'ViewDomainGeneral',
                    'ViewSettings',
                    'ViewShowCustomFieldsTicketTypes'
                ));
                $menuItem->addPermissions("admin_edit_settings");
                $this->addItem($menuItem);

                if($user->isSuperAdmin() || $user->isCompanySuperAdmin()){
                    //Staff / Clients
                    $label = NE_Registry::getCompany()->supports('accounts')?
                        $this->user->lang('Staff / Clients')
                        : $this->user->lang('Staff');
                    $menuItem = new NE_MenuItem($label, "index.php?fuse=admin&amp;view=ViewAdminList");
                    $menuItem->addViews(array('ShowCustomFields','ShowAddAdmin', 'ViewAdminList', 'EditAddAdminAccount', 'ViewGeneralGroups', 'AddEditGeneralGroup','ViewCustomerGroups','ViewCustomerGroupNotes','AddEditCustomerGroup'));
                    $this->addItem($menuItem);
                }

                //Product menu items
                if(NE_Registry::getCompany()->supports('products')) {
                    $menuItem = new NE_MenuItem($this->user->lang("Products&nbsp;/&nbsp;Addons"),"index.php?fuse=admin&amp;view=viewProducts");
                    $menuItem->addViews(array('ViewviewProducts','ViewviewAddons','ViewviewCustomFieldsForProduct'));
                    $menuItem->addPermissions('admin_view_packagetypes');
                    $this->addItem($menuItem);
                }

                //Files
                if(NE_Registry::getCompany()->supports('files')
                        && $this->user->hasPermission("files_view")){
                    $menuItem = new NE_MenuItem($this->user->lang('Files'),"index.php?fuse=files&amp;view=FileOverview");
                    $menuItem->addViews(array('FileEdit','FileOverview'));
                    $this->addItem($menuItem);
                }

               //Hosting Menu Item
               if(NE_Registry::getCompany()->supports('products')) {
                   $menuItem = new NE_MenuItem($this->user->lang('Servers'),"index.php?fuse=admin&amp;view=ViewServers");
                   $menuItem->addViews(array('ViewServers'));
                   $menuItem->addPermissions("admin_edit_servers");
                   $this->addItem($menuItem);
               }

                //plugin menu tab
                $menuItem = new NE_MenuItem($this->user->lang("Plugins"), "index.php?fuse=admin&amp;view=Services");
                $menuItem->addViews(array('Registrars','ThirdPartyBilling','Services','Fraud','PhoneVerification','Affiliates','LiveSupport'));
                $menuItem->addPermissions("admin_manage_plugins");
                $this->addItem($menuItem);

                //Import / Export
                if (NE_Registry::getCompany()->getId() == 0 &&  $this->user->hasPermission('admin_view_import_export') ) {
                    $menuItem = new NE_MenuItem($this->user->lang('Import / Export'),"index.php?fuse=admin&amp;view=ViewImportPlugins");
                    $menuItem->addViews(array('ViewImportPlugins', 'ViewExport','ViewExportPlugins'));
                    $this->addItem($menuItem);
                }
           }
    }
}

?>
