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

154 lines
7.6 KiB
PHP

<?php
/** \file scripts\page\menu_user_info.php
* \brief DI webinterface menu user script.
* \author Rob Schalken, Core|Vision
* \version 1.0
* \date 17-10-2008
*
* This file contains the menu user info script. This file displays user info.
*/
//== Required settings ======================
if (is_valid_action("user_info")) {
$_PAGE_INFO['page_title'] = "user info menu";
if ((isset($_GET['login'])) && (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id']))) {
$_PAGE_INFO['shortcut_menu_buttons']= array(_("Project overview"), $_PAGE_INFO['HIST_MAIN'], _("Realtime status"), _("Use equipment"), _("Project report"), _("GPS track"));
$_PAGE_INFO['shortcut_menu_links'] = array("page/project", "page/menu&page_project=" . $_GET['page_project'], "page/menu_rt&action=lance_rt&page_project=" . $_GET['page_project'], "page/menu_lance_use&action=lance_use&page_project=" . $_GET['page_project'], "page/menu_report_info&action=project_report&page_project=" . $_GET['page_project'], "page/menu_report_info&action=gps_report&page_project=" . $_GET['page_project']);
$_PAGE_INFO['shortcut_menu_rights'] = array("", "", "menu:realtime_status", "menu:lans", "menu:rapportages&menu:rapportages:projecten,menu:rapportages:root", "menu:rapportages&menu:rapportages:gps,menu:rapportages:root");
}
else if (isset($_SESSION[$_PAGE_INFO['id']]['main_menu'])) {
$_PAGE_INFO['history_menu_buttons'] = array("Project overview", $_PAGE_INFO['HIST_MAIN'], "User maintenance", "User search (info)");
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_user", "page/menu_user_search");
}
else {
$_PAGE_INFO['history_menu_buttons'] = array(_("Project overview"));
$_PAGE_INFO['history_menu_links'] = array("page/project");
}
$menu = "menu:gebruikers:overzicht";
$rights = "menu:gebruikers:root,menu:gebruikers&menu:gebruikers:zoeken";
$title = "User info";
}
else if (is_valid_action("user_new")) {
$_PAGE_INFO['page_title'] = "user new menu";
$_PAGE_INFO['history_menu_buttons'] = array("Project overview", $_PAGE_INFO['HIST_MAIN'], "User maintenance");
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_user");
$menu = "menu:gebruikers:nieuw";
$rights = "menu:gebruikers:root,menu:gebruikers&menu:gebruikers:wijzigen";
$title = "Add user";
}
else if (is_valid_action("user_change")) {
$_PAGE_INFO['page_title'] = "user change menu";
$_PAGE_INFO['history_menu_buttons'] = array("Project overview", $_PAGE_INFO['HIST_MAIN'], "User maintenance", "User search (change)");
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_user", "page/menu_user_search");
$menu = "menu:gebruikers:wijzigen";
$rights = "menu:gebruikers:root,menu:gebruikers&menu:gebruikers:wijzigen";
$title = "Change user";
}
else if (is_valid_action("user_change_password")) {
$_PAGE_INFO['page_title'] = "user change password menu";
$_PAGE_INFO['history_menu_buttons'] = array("Project overview", $_PAGE_INFO['HIST_MAIN'], "User maintenance");
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_user");
$menu = "menu:gebruikers:wijzigen_wachtwoord";
$rights = "menu:gebruikers:root,menu:gebruikers";
$title = "Change password";
}
else if (is_valid_action("user_change_pin")) {
$_PAGE_INFO['page_title'] = "user change verification PIN menu";
$_PAGE_INFO['history_menu_buttons'] = array("Project overview", $_PAGE_INFO['HIST_MAIN'], "User maintenance");
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_user");
$menu = "menu:gebruikers:wijzigen_pin";
$rights = "menu:gebruikers:root,menu:gebruikers";
$title = "Change verification PIN";
}
else if (is_valid_action("cust_new")) {
$_PAGE_INFO['page_title'] = "user new menu";
$_PAGE_INFO['history_menu_buttons'] = array("Project overview", $_PAGE_INFO['HIST_MAIN'], _("Company maintenance"), _("Add company"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_cust", "page/menu_cust_info");
$menu = "menu:gebruikers:nieuw";
$rights = "menu:gebruikers:root,menu:gebruikers&menu:gebruikers:wijzigen";
$title = "Add contact";
}
else if (is_valid_action("cust_change")) {
$_PAGE_INFO['page_title'] = "user change menu";
$_PAGE_INFO['history_menu_buttons'] = array("Project overview", $_PAGE_INFO['HIST_MAIN'], _("Company maintenance"), _("Company search (change)"), _("Change company"));
$_PAGE_INFO['history_menu_links'] = array("page/project", "page/menu", "page/menu_cust", "page/menu_cust_search", "page/menu_cust_info");
$menu = "menu:gebruikers:wijzigen";
$rights = "menu:gebruikers:root,menu:gebruikers&menu:gebruikers:wijzigen";
$title = _("Change contact");
}
//===========================================
// Verify project/rights and log
if (Ver_Rights_Project_Log($rights, $menu)) {
// Check action
if (is_valid_action("user_info", "user_change", "cust_change", "user_change_password","user_change_pin")) {
// Check if this is a recall action
if ((!$_SESSION[$_PAGE_INFO['id']]['recall_counter']) || (isset($_GET['login']))) {
// Login info redirect?
if (isset($_GET['login'])) {
// Login info and clear all search filters
$_SESSION[$_PAGE_INFO['id']]['search']['user'] = array();
$_SESSION[$_PAGE_INFO['id']]['search']['user']['id'] = $_SESSION[$_PAGE_INFO['id']]['login']['user']['id'];
}
if (isset($_SESSION[$_PAGE_INFO['id']]['search']['user']['id'])) {
// Log user-user action (use log entry from Ver_Rights_Project_Log function)
db_log_user_user($_SESSION[$_PAGE_INFO['id']]['search']['user']['id']);
// Retrieve user data
$row_user = db_fetch_user($_SESSION[$_PAGE_INFO['id']]['search']['user']['id'], "", 1);
if (is_array($row_user)) {
$_SESSION[$_PAGE_INFO['id']]['user_info'] = $row_user;
if (is_valid_action("user_change", "cust_change")) {
// User with switching rights on released project?
if (is_array(db_fetch_user_projects($_SESSION[$_PAGE_INFO['id']]['search']['user']['id'], "schakelen", "rc", 0, "vrijgegeven"))) {
// Alert!
$_SESSION[$_PAGE_INFO['id']]['errormsg']['text'] = "It is not possible to change safety critical information because this user has been assigned to a released project";
$_SESSION[$_PAGE_INFO['id']]['errormsg']['type'] = "alert";
}
}
}
else {
// ID not valid!!! => Redirect back to search menu
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=page/menu_user_search");
}
}
else {
// ID not valid!!! => Redirect back to search menu
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=page/menu_user_search");
}
}
}
// Store title
$_SESSION[$_PAGE_INFO['id']]['title'] = $title;
// Add calendar to header
$extra_header_HTML = "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "calender.js\"></script>\n";
// Show page header
print_xml_header(0, $extra_header_HTML);
// Include info content
include("menu_user_info_content.php");
// Show page footer
print_page_footer();
}
?>