<?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=Presets&amp;group=general");
                $menuItem->addViews(array(
                    "ViewPresets",
                    "ViewBillingTypes",
                    "ViewTaxOverview",
                    "ViewAddTaxRules",
                    "ViewListCoupons",
                    "ViewCurrencies",
                    "ViewEmailRoutings",
                    "ViewDepartments",
                    "ViewEscalations",
                    "ViewTicketTypes"
                ));
                $menuItem->addPermissions("admin_edit_settings");
                $this->addItem($menuItem);

                if ($this->user->getGroupId() == ROLE_SUPERADMIN) {
                    //Staff / Clients
                    $menuItem = new NE_MenuItem($this->user->lang("Staff / Clients"),"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
                $menuItem = new NE_MenuItem($this->user->lang("Products / Addons"),"index.php?fuse=admin&amp;view=viewProducts");
                $menuItem->addViews(array('ViewviewProducts','ViewviewAddons','ViewviewCustomFieldsForProduct'));
                $menuItem->addPermissions('admin_view_packagetypes');
                $this->addItem($menuItem);

                //Files
                if($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
               $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);

                //Email Template Menu Item
                $menuItem = new NE_MenuItem($this->user->lang('E-mails'),"index.php?fuse=admin&amp;view=Admin_Emails");
                $menuItem->addViews(array("Admin_Emails"));
                $menuItem->addPermissions("admin_edit_settings");
                $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 ( $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);
                }

                //Encryption (passphrase)
                if($this->user->hasPermission("admin_edit_passphrase")){
                    $menuItem = new NE_MenuItem($this->user->lang('Encryption'),"index.php?fuse=admin&amp;view=DisplayPassphraseInfo");
                    $menuItem->addViews(array('DisplayEncryptDomainPasswords','DisplayPassphraseInfo'));
                    $menuItem->addPermissions("admin_edit_passphrase");
                    $this->addItem($menuItem);
                }

           }

    }

}

?>
