src.dualinventive.com/mtinfo/dist/webroot/rc-4.05/scripts/page/menu_system.php

155 lines
12 KiB
PHP

<?php
/** \file scripts\page\menu_system.php
* \brief DI webinterface menu system script.
* \author Rob Schalken, Core|Vision
* \version $Revision: 26247 $
* \date $Date: 2016-02-29 10:40:22 +0100 (Mon, 29 Feb 2016) $
*
* This file contains the menu system
*
*/
//== Required settings ======================
if (is_valid_action("system_overview")) {
$_PAGE_INFO['page_title'] = _("system maintenance menu");
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN']);
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu");
//Button text //Page (including next action) // Rights needed
$_PAGE_INFO['menu_items'] = array( array(_("Equipment type maintenance"), "page/menu_system&action=equipment_overview", "menu:systeemonderhoud:materieeltype"),
array(_("Workorder templates"), "page/menu_system&action=workorder_template_menu", "menu:systeemonderhoud:service"),
array(_("Message of the day"), "page/menu_system_info&action=system_motd", "menu:systeemonderhoud:motd"),
array(_("Help maintenance"), "page/menu_system_info&action=help", "menu:systeemonderhoud:help-onderhoud"));
$title = _("System maintenance");
$menu = "menu:systeemonderhoud";
$matrix = array('matrix' => 1);
}
else if( is_valid_action("equipment_overview") ) {
$_PAGE_INFO['page_title'] = _("equipment type maintenance menu");
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("System maintenance"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_system&action=system_overview");
//Button text //Page (including next action) // Rights needed
$_PAGE_INFO['menu_items'] = array( array(_("Search equipment type") ,"page/menu_system_search&action=equipment_info" ,"menu:systeemonderhoud:materieeltype"),
array(_("Add equipment type") ,"page/menu_system_search&action=equipment_new" ,"menu:systeemonderhoud:materieeltype"),
array(_("Change equipment type") ,"page/menu_system_search&action=equipment_change" ,"menu:systeemonderhoud:materieeltype"),
array(_("Delete equipment type") ,"page/menu_system_search&action=equipment_delete" ,"menu:systeemonderhoud:materieeltype"));
$title = _("Equipment type maintenance");
$menu = "menu:systeemonderhoud:materieel_type";
$matrix = array('matrix' => 1);
}
else if (is_valid_action("workorder_template_menu")) {
$_PAGE_INFO['page_title'] = _("workorder template maintenance menu");
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("System maintenance"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_system&action=system_overview");
//Button text //Page (including next action) // Rights needed
$_PAGE_INFO['menu_items'] = array( array(_("System components"), "page/menu_system&action=workorder_template_menu/system_components", "menu:systeemonderhoud:service"),
array(_("Versions"), "page/menu_system&action=workorder_template_menu/versions", "menu:systeemonderhoud:service"),
array(_("Change log"), "page/menu_system&action=workorder_template_menu/changelog", "menu:systeemonderhoud:service"),
array(_("Workorder items"), "page/menu_system&action=workorder_template_menu/workorder_items", "menu:systeemonderhoud:service"),
array(_("Overview"), "page/menu_report_system&action=workorder_template_overview", "menu:systeemonderhoud:service") );
$title = _("Workorder template maintenance");
$menu = "menu:systeemonderhoud";
$matrix = array('matrix' => 1);
}
else if (is_valid_action("workorder_template_menu/system_components")) {
$_PAGE_INFO['page_title'] = _("workorder template maintenance menu - system components");
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("System maintenance"), _("Workorder template maintenance"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_system&action=system_overview", "page/menu_system&action=workorder_template_menu");
//Button text //Page (including next action) // Rights needed
$_PAGE_INFO['menu_items'] = array( array(_("Search system component"), "page/menu_syscomp_search&action=system_component_info", "menu:systeemonderhoud:service"),
array(_("Add system component"), "page/menu_syscomp_search&action=system_component_new", "menu:systeemonderhoud:service"),
array(_("Duplicate system component"), "page/menu_syscomp_search&action=system_component_duplicate","menu:systeemonderhoud:service"),
array(_("Change system component"), "page/menu_syscomp_search&action=system_component_change", "menu:systeemonderhoud:service"),
array(_("Delete system component"), "page/menu_syscomp_search&action=system_component_delete", "menu:systeemonderhoud:service") );
$title = _("Workorder template maintenance - System components");
$menu = "menu:systeemonderhoud";
$matrix = array('matrix' => 1, 'style' => "width: 272px");
}
else if (is_valid_action("workorder_template_menu/versions")) {
$_PAGE_INFO['page_title'] = _("workorder template maintenance menu - versions");
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("System maintenance"), _("Workorder template maintenance"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_system&action=system_overview", "page/menu_system&action=workorder_template_menu");
//Button text //Page (including next action) // Rights needed
$_PAGE_INFO['menu_items'] = array( array(_("Search version"), "page/menu_version_search&action=version_info", "menu:systeemonderhoud:service"),
array(_("Add version"), "page/menu_syscomp_search&action=version_new", "menu:systeemonderhoud:service"),
array(_("Duplicate version"), "page/menu_version_search&action=version_duplicate", "menu:systeemonderhoud:service"),
array(_("Change version"), "page/menu_version_search&action=version_change", "menu:systeemonderhoud:service"),
array(_("Delete version"), "page/menu_version_search&action=version_delete", "menu:systeemonderhoud:service") );
$title = _("Workorder template maintenance - Versions");
$menu = "menu:systeemonderhoud";
$matrix = array('matrix' => 1);
}
else if (is_valid_action("workorder_template_menu/changelog")) {
$_PAGE_INFO['page_title'] = _("workorder template maintenance menu - change log");
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("System maintenance"), _("Workorder template maintenance"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_system&action=system_overview", "page/menu_system&action=workorder_template_menu");
//Button text //Page (including next action) // Rights needed
$_PAGE_INFO['menu_items'] = array( array(_("Search change log item"), "page/menu_changelog_search&action=changelog_info", "menu:systeemonderhoud:service"),
array(_("Add change log item"), "page/menu_version_search&action=changelog_new", "menu:systeemonderhoud:service"),
array(_("Duplicate change log item"),"page/menu_changelog_search&action=changelog_duplicate", "menu:systeemonderhoud:service"),
array(_("Change change log item"), "page/menu_changelog_search&action=changelog_change", "menu:systeemonderhoud:service"),
array(_("Delete change log item"), "page/menu_changelog_search&action=changelog_delete", "menu:systeemonderhoud:service") );
$title = _("Workorder template maintenance - Change log");
$menu = "menu:systeemonderhoud";
$matrix = array('matrix' => 1);
}
else if (is_valid_action("workorder_template_menu/workorder_items")) {
$_PAGE_INFO['page_title'] = _("workorder template maintenance menu - workorder items");
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("System maintenance"), _("Workorder template maintenance"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_system&action=system_overview", "page/menu_system&action=workorder_template_menu");
//Button text //Page (including next action) // Rights needed
$_PAGE_INFO['menu_items'] = array( array(_("Search workorder item"), "page/menu_woitem_search&action=workorder_item_info", "menu:systeemonderhoud:service"),
array(_("Add workorder item"), "page/menu_woitem_search&action=workorder_item_new", "menu:systeemonderhoud:service"),
array(_("Duplicate workorder item"), "page/menu_woitem_search&action=workorder_item_duplicate", "menu:systeemonderhoud:service"),
array(_("Change workorder item"), "page/menu_woitem_search&action=workorder_item_change", "menu:systeemonderhoud:service"),
array(_("Delete workorder item"), "page/menu_woitem_search&action=workorder_item_delete", "menu:systeemonderhoud:service") );
$title = _("Workorder template maintenance - Workorder items");
$menu = "menu:systeemonderhoud";
$matrix = array('matrix' => 1);
}
else {
// Possible abuse: redirect page back to login page
force_logout(_("No valid rights"), "Invalid action: " . $_SESSION[$_PAGE_INFO['id']]['action']);
}
//===========================================
// Clear previous session info
unset($_SESSION[$_PAGE_INFO['id']]['action']);
unset($_SESSION[$_PAGE_INFO['id']]['recall']);
// Verify project/rights and log
if (Ver_Rights_Project_Log("menu:systeemonderhoud", $menu)) {
// Store title
$_SESSION[$_PAGE_INFO['id']]['title'] = $title;
// Show page header
print_page_header();
// Collect menu items
for ($i = 0; $i < (sizeof($_PAGE_INFO['menu_items'])); $i++) {
// Retrieve button text
$menu_items[$i] = $_PAGE_INFO['menu_items'][$i][0];
// Verify menu rights and available link => enable/disable
if ((db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], $_PAGE_INFO['menu_items'][$i][2])) && (!empty($_PAGE_INFO['menu_items'][$i][1]))) {
$menu_rights[$i] = 1;
}
else {
$menu_rights[$i] = 0;
}
// Retrieve button link
$menu_links[$i] = "?id=" . $_PAGE_INFO['id'] . "&href=" . $_PAGE_INFO['menu_items'][$i][1];
}
// Display main menu
print_menu($title, $menu_items, $menu_links, $menu_rights, $matrix);
// Show page footer
print_page_footer();
}
?>