All pastes #2076258 Raw Edit

nicdev007

public text v1 · immutable
#2076258 ·published 2011-06-07 16:17 UTC
rendered paste body
function pcmi_create_table()
{
    global $CONFIG, $dbPluginConfigureMenuItems;//sit_plugin_configure_menu_items
    
    $dbPluginConfigureMenuItems = $CONFIG['db_tableprefix']."plugin_configure_menu_items";
    
    $schema = "CREATE TABLE IF NOT EXISTS `$dbPluginConfigureMenuItems` (
              `id` int(10) NOT NULL auto_increment,
              `parent_key` int(10) NOT NULL,
              `child_key` int(10) NOT NULL,
              `name` text NOT NULL,
              `admin_hide` enum('show','hide') NOT NULL default 'show',
              `manager_hide` enum('show','hide') NOT NULL default 'show',
              `user_hide` enum('show','hide') NOT NULL default 'show',
              `admin_movetomain` enum('yes','no') NOT NULL default 'no',
              `manager_movetomain` enum('yes','no') NOT NULL default 'no',
              `user_movetomain` enum('yes','no') NOT NULL default 'no',
              PRIMARY KEY  (`id`)
            ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=216;
              
              INSERT INTO `$dbPluginConfigureMenuItems` (`id`, `parent_key`, `child_key`, `name`, `admin_hide`, `manager_hide`, `user_hide`, `admin_movetomain`, `manager_movetomain`, `user_movetomain`) VALUES
                (1, 0, 10, 'CONFIG[''application_shortname'']', 'show', 'show', 'show', 'no', 'no', 'no'),
                (2, 0, 20, 'strCustomers', 'show', 'show', 'show', 'no', 'no', 'no'),
                (3, 0, 30, 'strSupport', 'show', 'show', 'show', 'no', 'no', 'no'),
                (4, 0, 40, 'strTasks', 'show', 'show', 'show', 'no', 'no', 'no'),
                (5, 0, 50, 'strKnowledgeBase', 'show', 'show', 'show', 'no', 'no', 'no'),
                (6, 0, 60, 'strReports', 'show', 'show', 'show', 'no', 'no', 'no'),
                (7, 0, 70, 'strHelp', 'show', 'show', 'show', 'no', 'no', 'no'),
                (8, 10, 1, 'Dashboard', 'show', 'show', 'show', 'no', 'no', 'no'),
                (9, 10, 10, 'Search', 'show', 'show', 'show', 'no', 'no', 'no'),
                (10, 10, 20, 'MyDetails', 'show', 'show', 'show', 'no', 'no', 'no'),
                (11, 10, 30, 'ControlPanel', 'show', 'show', 'show', 'no', 'no', 'no'),
                (12, 10, 40, 'Users', 'show', 'show', 'show', 'no', 'no', 'no'),
                (13, 10, 50, 'Logout', 'show', 'show', 'show', 'no', 'no', 'no'),
                (14, 1020, 10, 'MyProfile', 'show', 'show', 'show', 'no', 'no', 'no'),
                (15, 1020, 20, 'MySkills', 'show', 'show', 'show', 'no', 'no', 'no'),
                (16, 1020, 30, 'MySubstitutes', 'show', 'show', 'show', 'no', 'no', 'no'),
                (17, 1020, 40, 'MyHolidays', 'show', 'show', 'show', 'no', 'no', 'no'),
                (18, 1020, 50, 'MyDashboard', 'show', 'show', 'show', 'no', 'no', 'no'),
                (19, 1020, 60, 'MyNotifications', 'show', 'show', 'show', 'no', 'no', 'no'),
                (20, 1030, 5, 'Configure', 'show', 'show', 'show', 'no', 'no', 'no'),
                (21, 1030, 10, 'Users', 'show', 'show', 'show', 'no', 'no', 'no'),
                (22, 1030, 20, 'GlobalSignature', 'show', 'show', 'show', 'no', 'no', 'no'),
                (23, 1030, 30, 'Templates', 'show', 'show', 'show', 'no', 'no', 'no'),
                (24, 1030, 40, 'SetPublicHolidays', 'show', 'show', 'show', 'no', 'no', 'no'),
                (25, 1030, 50, 'FTPFilesDB', 'show', 'show', 'show', 'no', 'no', 'no'),
                (26, 1030, 60, 'ServiceLevels', 'show', 'show', 'show', 'no', 'no', 'no'),
                (27, 1030, 70, 'BulkModify', 'show', 'show', 'show', 'no', 'no', 'no'),
                (28, 1030, 80, 'EscalationPaths', 'show', 'show', 'show', 'no', 'no', 'no'),
                (29, 1030, 90, 'ManageDashboardComponents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (30, 1030, 100, 'Notices', 'show', 'show', 'show', 'no', 'no', 'no'),
                (31, 1030, 120, 'SystemActions', 'show', 'show', 'show', 'no', 'no', 'no'),
                (32, 1030, 130, 'Scheduler', 'show', 'show', 'show', 'no', 'no', 'no'),
                (33, 1030, 140, 'FeedbackForms', 'show', 'show', 'show', 'no', 'no', 'no'),
                (34, 1030, 150, 'Journal', 'show', 'show', 'show', 'no', 'no', 'no'),
                (35, 103010, 10, 'ManageUsers103010', 'show', 'show', 'show', 'no', 'no', 'no'),
                (36, 103010, 20, 'AddUser', 'show', 'show', 'show', 'no', 'no', 'no'),
                (37, 103010, 30, 'RolePermissions', 'show', 'show', 'show', 'no', 'no', 'no'),
                (38, 103010, 40, 'UserGroups', 'show', 'show', 'show', 'no', 'no', 'no'),
                (39, 103010, 50, 'EditHolidayEntitlement', 'show', 'show', 'show', 'no', 'no', 'no'),
                (40, 103090, 10, 'AddFeedbackForm', 'show', 'show', 'show', 'no', 'no', 'no'),
                (41, 103090, 20, 'BrowseFeedbackForms', 'show', 'show', 'show', 'no', 'no', 'no'),
                (42, 1040, 10, 'ViewUsers', 'show', 'show', 'show', 'no', 'no', 'no'),
                (43, 1040, 20, 'ListSkills', 'show', 'show', 'show', 'no', 'no', 'no'),
                (44, 1040, 21, 'SkillsMatrix', 'show', 'show', 'show', 'no', 'no', 'no'),
                (45, 1040, 30, 'HolidayPlanner', 'show', 'show', 'show', 'no', 'no', 'no'),
                (46, 1040, 40, 'ApproveHolidays', 'show', 'show', 'show', 'no', 'no', 'no'),
                (47, 20, 10, 'Sites', 'show', 'show', 'show', 'no', 'no', 'no'),
                (48, 20, 20, 'Contacts', 'show', 'show', 'show', 'no', 'no', 'no'),
                (49, 20, 35, 'Maintenance', 'show', 'show', 'show', 'no', 'no', 'no'),
                (50, 20, 30, 'Inventory', 'show', 'show', 'show', 'no', 'no', 'no'),
                (51, 20, 40, 'BrowseFeedback', 'show', 'show', 'show', 'no', 'no', 'no'),
                (52, 2010, 10, 'Browse', 'show', 'show', 'show', 'no', 'no', 'no'),
                (53, 2010, 20, 'NewSite', 'show', 'show', 'show', 'no', 'no', 'no'),
                (54, 2020, 10, 'Browse', 'show', 'show', 'show', 'no', 'no', 'no'),
                (55, 2020, 20, 'NewContact', 'show', 'show', 'show', 'no', 'no', 'no'),
                (56, 2030, 10, 'Browse', 'show', 'show', 'show', 'no', 'no', 'no'),
                (57, 2030, 20, 'NewContract', 'show', 'show', 'show', 'no', 'no', 'no'),
                (58, 2030, 30, 'EditContract', 'show', 'show', 'show', 'no', 'no', 'no'),
                (59, 2030, 40, 'NewReseller', 'show', 'show', 'show', 'no', 'no', 'no'),
                (60, 2030, 41, 'SiteTypes', 'show', 'show', 'show', 'no', 'no', 'no'),
                (61, 2030, 50, 'ShowRenewals', 'show', 'show', 'show', 'no', 'no', 'no'),
                (62, 2030, 60, 'ShowExpiredContracts', 'show', 'show', 'show', 'no', 'no', 'no'),
                (63, 2030, 70, 'Products', 'show', 'show', 'show', 'no', 'no', 'no'),
                (64, 2030, 80, 'Billing', 'show', 'show', 'show', 'no', 'no', 'no'),
                (65, 203010, 10, 'AddVendor', 'show', 'show', 'show', 'no', 'no', 'no'),
                (66, 203010, 20, 'AddProduct', 'show', 'show', 'show', 'no', 'no', 'no'),
                (67, 203010, 30, 'ListProducts', 'show', 'show', 'show', 'no', 'no', 'no'),
                (68, 203010, 35, 'ListSkills', 'show', 'show', 'show', 'no', 'no', 'no'),
                (69, 203010, 40, 'AddSkill', 'show', 'show', 'show', 'no', 'no', 'no'),
                (70, 203010, 50, 'LinkProducts', 'show', 'show', 'show', 'no', 'no', 'no'),
                (71, 203010, 60, 'AddProductQuestion', 'show', 'show', 'show', 'no', 'no', 'no'),
                (72, 203010, 70, 'EditVendor', 'show', 'show', 'show', 'no', 'no', 'no'),
                (73, 30, 10, 'AddIncident', 'show', 'show', 'show', 'no', 'no', 'no'),
                (74, 30, 20, 'MyIncidents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (75, 30, 30, 'AllIncidents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (76, 30, 50, 'HoldingQueue', 'show', 'show', 'show', 'no', 'no', 'no'),
                (77, 40, 10, 'AddTask', 'show', 'show', 'show', 'no', 'no', 'no'),
                (78, 40, 20, 'ViewTasks', 'show', 'show', 'show', 'no', 'no', 'no'),
                (79, 50, 10, 'NewKBArticle', 'show', 'show', 'show', 'no', 'no', 'no'),
                (80, 50, 20, 'Browse', 'show', 'show', 'show', 'no', 'no', 'no'),
                (81, 60, 10, 'MarketingMailshot', 'show', 'show', 'show', 'no', 'no', 'no'),
                (82, 60, 20, 'CustomerExport', 'show', 'show', 'show', 'no', 'no', 'no'),
                (83, 60, 30, 'QueryByExample', 'show', 'show', 'show', 'no', 'no', 'no'),
                (84, 60, 35, 'Incidents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (85, 60, 60, 'SiteProducts', 'show', 'show', 'show', 'no', 'no', 'no'),
                (86, 60, 61, 'SiteProductsMatrix', 'show', 'show', 'show', 'no', 'no', 'no'),
                (87, 60, 65, 'CountContractsByProduct', 'show', 'show', 'show', 'no', 'no', 'no'),
                (88, 60, 70, 'SiteContracts', 'show', 'show', 'show', 'no', 'no', 'no'),
                (89, 60, 80, 'CustomerFeedback', 'show', 'show', 'show', 'no', 'no', 'no'),
                (90, 60, 180, 'EngineerMonthlyActivityTotals', 'show', 'show', 'show', 'no', 'no', 'no'),
                (91, 6050, 10, 'IncidentsBySite', 'show', 'show', 'show', 'no', 'no', 'no'),
                (92, 6050, 20, 'IncidentsByEngineer', 'show', 'show', 'show', 'no', 'no', 'no'),
                (93, 6050, 30, 'SiteIncidents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (94, 6050, 40, 'RecentIncidents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (95, 6050, 50, 'IncidentsLoggedOpenClosed', 'show', 'show', 'show', 'no', 'no', 'no'),
                (96, 6050, 60, 'AverageIncidentDuration', 'show', 'show', 'show', 'no', 'no', 'no'),
                (97, 6050, 70, 'IncidentsBySkill', 'show', 'show', 'show', 'no', 'no', 'no'),
                (98, 6050, 80, 'IncidentsByVendor', 'show', 'show', 'show', 'no', 'no', 'no'),
                (99, 6050, 90, 'EscalatedIncidents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (100, 6050, 100, 'BillableIncidents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (101, 6050, 110, 'IncidentsDailySummary', 'show', 'show', 'show', 'no', 'no', 'no'),
                (102, 70, 10, 'HelpContents', 'show', 'show', 'show', 'no', 'no', 'no'),
                (103, 70, 15, 'GetHelpOnline', 'show', 'show', 'show', 'no', 'no', 'no'),
                (104, 70, 20, 'Translate', 'show', 'show', 'show', 'no', 'no', 'no'),
                (105, 70, 30, 'ReportBug', 'show', 'show', 'show', 'no', 'no', 'no'),
                (106, 70, 40, 'ReleaseNotes', 'show', 'show', 'show', 'no', 'no', 'no'),
                (107, 70, 50, 'HelpAbout', 'show', 'show', 'show', 'no', 'no', 'no')";
        
    $result = mysql_query($schema);
    if (mysql_error())
    {
        echo "<p>Plugin configure menu items failed to install, please run the following SQL statement on the SiT database to create the required schema.</p>";
        echo "<pre>{$schema}</pre>";
        $res = FALSE;
    }
    else $res = TRUE;

    return $res;  
}