Example #1
0
function get_top_menu_options($user_role)
{
    # Returns list links to php pages accessible by $user_role
    # Called from perms_check.php
    global $LIS_TECH_RO, $LIS_TECH_RW, $LIS_ADMIN, $LIS_SUPERADMIN, $LIS_COUNTRYDIR, $LIS_CLERK;
    global $LIS_001, $LIS_010, $LIS_011, $LIS_100, $LIS_101, $LIS_110, $LIS_111, $LIS_TECH_SHOWPNAME;
    # Global variables from includes/db_constants.php
    global $SERVER, $ON_ARC;
    $page_list = array();
    $page_list[LangUtil::getPageTitle("home")] = "home.php";
    if ($user_role == $LIS_CLERK) {
        $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
        $page_list[LangUtil::getPageTitle("search")] = "search.php";
    } else {
        if ($user_role == $LIS_TECH_RW || $user_role == $LIS_TECH_SHOWPNAME) {
            $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
            $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
            $page_list[LangUtil::getPageTitle("search")] = "search.php";
            $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
            $page_list["Inventory"] = "stock_add.php";
            $id = get_lab_config_id($_SESSION['user_id']);
            if ($id == 0) {
                $lab_config_list = get_lab_configs($_SESSION['user_id']);
                $id = $lab_config_list[0]->id;
            }
            //$page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "data_backup?id=".$id;
            $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "backupDataUI.php?id=" . $id;
        } else {
            if ($user_role == $LIS_TECH_RO || $user_role == $LIS_TECH_SHOWPNAME) {
                $page_list[LangUtil::getPageTitle("search")] = "search.php";
                $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
            } else {
                if ($user_role == $LIS_ADMIN) {
                    # ...
                    $page_list[LangUtil::getPageTitle("lab_config_home")] = "lab_configs.php";
                    $page_list[LangUtil::getPageTitle("catalog")] = "catalog.php";
                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                    if ($SERVER != $ON_ARC) {
                        if (User::onlyOneLabConfig($_SESSION['user_id'], $_SESSION['user_level'])) {
                            # Back up data option
                            $lab_config_list = get_lab_configs($_SESSION['user_id']);
                            //$page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "data_backup?id=".$lab_config_list[0]->id;
                            $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "backupDataUI.php?id=" . $lab_config_list[0]->id;
                        }
                    }
                    //$page_list["Inventory"]="stock_add.php";
                    # ...
                } else {
                    if ($user_role == $LIS_SUPERADMIN || $user_role == $LIS_COUNTRYDIR) {
                        $page_list[LangUtil::getPageTitle("lab_configs")] = "lab_configs.php";
                        $page_list[LangUtil::getPageTitle("lab_admins")] = "lab_admins.php";
                        $page_list[LangUtil::getPageTitle("catalog")] = "country_catalog.php";
                        $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                    } else {
                        if (false) {
                            switch ($user_role) {
                                case $LIS_001:
                                    # Reports only
                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                    break;
                                case $LIS_010:
                                    # Results only
                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                    break;
                                case $LIS_011:
                                    # Results and reports
                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                    break;
                                case $LIS_100:
                                    # Regn only
                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                    break;
                                case $LIS_101:
                                    # Regn and Reports
                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                    break;
                                case $LIS_110:
                                    # Regn and Results
                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                    break;
                                case $LIS_111:
                                    # All three
                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                    break;
                            }
                        }
                    }
                }
            }
        }
    }
    # Currently Disabled. Uncomment if required
    # $page_list[LangUtil::getPageTitle("help")] = "help.php";
    return $page_list;
}
Example #2
0
<?php

include "../includes/db_lib.php";
$user = get_user_by_id($_SESSION['user_id']);
$country = strtolower($user->country);
$userId = $_SESSION['user_id'];
$labConfigId = get_lab_config_id($userId);
$importPatientId = $_REQUEST['patientId'];
$importlabConfigIdEnd = strpos($importPatientId, "0");
$importLabConfigId = substr($importPatientId, 0, $importlabConfigIdEnd);
/*
$saved_db = DbUtil::switchToCountry($country);
$querySelect = 
	"SELECT * FROM patient ".
	"WHERE patient_id=$importPatientId";
$patientRecord = query_associative_one($querySelect);
DbUtil::switchRestore($saved_db);
*/
$saved_db = DbUtil::switchToLabConfig($importLabConfigId);
$querySelect = "SELECT * FROM specimen " . "WHERE patient_id={$importPatientId}";
$resultset = query_associative_all($querySelect, $rowCount);
foreach ($resultset as $record) {
    $specimenRecords[] = Specimen::getObject($record);
}
foreach ($specimenRecords as $specimenRecord) {
    $querySelect = "SELECT * FROM test " . "WHERE specimen_id={$specimenRecord->specimenId}";
    $resultset = query_associative_all($querySelect, $rowCount);
    foreach ($resultset as $record) {
        $testRecords[] = Test::getObject($record);
    }
}
Example #3
0
function get_top_menu_options($user_role, $user_rwoption = "")
{
    // Returns list links to php pages accessible by $user_role
    // Called from perms_check.php
    global $LIS_TECH_RO, $LIS_TECH_RW, $LIS_ADMIN, $LIS_SUPERADMIN, $LIS_VERIFIER, $LIS_COUNTRYDIR, $LIS_CLERK, $READONLYMODE, $LIS_PHYSICIAN;
    global $LIS_001, $LIS_010, $LIS_011, $LIS_100, $LIS_101, $LIS_110, $LIS_111, $LIS_TECH_SHOWPNAME;
    // Global variables from includes/db_constants.php
    global $SERVER, $ON_ARC;
    $page_list = array();
    $rw_option = array();
    $page_list[LangUtil::getPageTitle("home")] = "home.php";
    $rw_option = explode(',', $user_rwoption);
    // Write Mode starts
    if ($user_role == $LIS_TECH_RW || $user_role == $LIS_001 || $user_role == $LIS_VERIFIER) {
        if (in_array("2", $rw_option)) {
            $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
        }
        if (in_array("3", $rw_option)) {
            $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
        }
        if (in_array("4", $rw_option)) {
            $page_list[LangUtil::getPageTitle("search")] = "search.php";
        }
        if (in_array("5", $rw_option)) {
            $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
        }
        if (in_array("6", $rw_option)) {
            $page_list["Inventory"] = "view_stock.php";
        }
        if (in_array("7", $rw_option)) {
            $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "backupDataUI.php?id=" . $id;
        }
    } else {
        if ($user_role == $READONLYMODE) {
            $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
        } else {
            if ($user_role == $LIS_PHYSICIAN) {
                if (in_array("2", $rw_option)) {
                    $page_list[LangUtil::getPageTitle("regn")] = "doctor_register.php";
                }
                if (in_array("3", $rw_option)) {
                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                }
                if (in_array("4", $rw_option)) {
                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                }
                if (in_array("5", $rw_option)) {
                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                }
                if (in_array("6", $rw_option)) {
                    $page_list["Inventory"] = "view_stock.php";
                }
                if (in_array("7", $rw_option)) {
                    $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "backupDataUI.php?id=" . $id;
                }
                // $page_list [LangUtil::getPageTitle ( "regn" )] = "doctor_register.php";
                // $page_list [LangUtil::getPageTitle ( "reports" )] = "reports.php";
            } else {
                if ($user_role == $LIS_CLERK) {
                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                } else {
                    if ($user_role == $LIS_TECH_RW || $user_role == $LIS_TECH_SHOWPNAME) {
                        $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                        $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                        $page_list[LangUtil::getPageTitle("search")] = "search.php";
                        $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                        $page_list["Inventory"] = "view_stock.php";
                        $id = get_lab_config_id($_SESSION['user_id']);
                        if ($id == 0) {
                            $lab_config_list = get_lab_configs($_SESSION['user_id']);
                            $id = $lab_config_list[0]->id;
                        }
                        // $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "data_backup?id=".$id;
                        $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "backupDataUI.php?id=" . $id;
                    } else {
                        if ($user_role == $LIS_TECH_RO || $user_role == $LIS_TECH_SHOWPNAME) {
                            $page_list[LangUtil::getPageTitle("search")] = "search.php";
                            $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                        } else {
                            if ($user_role == $LIS_ADMIN) {
                                // ...
                                $page_list[LangUtil::getPageTitle("lab_config_home")] = "lab_configs.php";
                                $page_list[LangUtil::getPageTitle("catalog")] = "catalog.php";
                                $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                if ($SERVER != $ON_ARC) {
                                    if (User::onlyOneLabConfig($_SESSION['user_id'], $_SESSION['user_level'])) {
                                        // Back up data option
                                        $lab_config_list = get_lab_configs($_SESSION['user_id']);
                                        // $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "data_backup?id=".$lab_config_list[0]->id;
                                        $page_list[LangUtil::$pageTerms['MENU_BACKUP']] = "backupDataUI.php?id=" . $lab_config_list[0]->id;
                                    }
                                }
                                // $page_list["Inventory"]="stock_add.php";
                                // ...
                            } else {
                                if ($user_role == $LIS_SUPERADMIN || $user_role == $LIS_COUNTRYDIR) {
                                    $page_list[LangUtil::getPageTitle("lab_configs")] = "lab_configs.php";
                                    $page_list[LangUtil::getPageTitle("lab_admins")] = "lab_admins.php";
                                    $page_list[LangUtil::getPageTitle("catalog")] = "country_catalog.php";
                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                } else {
                                    if ($user_role == $LIS_VERIFIER) {
                                        $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                    } else {
                                        if (false) {
                                            switch ($user_role) {
                                                case $LIS_001:
                                                    // Reports only
                                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                                    break;
                                                case $LIS_010:
                                                    // Results only
                                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                                    break;
                                                case $LIS_011:
                                                    // Results and reports
                                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                                    break;
                                                case $LIS_100:
                                                    // Regn only
                                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                                    break;
                                                case $LIS_101:
                                                    // Regn and Reports
                                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                                    break;
                                                case $LIS_110:
                                                    // Regn and Results
                                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                                    break;
                                                case $LIS_111:
                                                    // All three
                                                    $page_list[LangUtil::getPageTitle("regn")] = "find_patient.php";
                                                    $page_list[LangUtil::getPageTitle("results_entry")] = "results_entry.php";
                                                    $page_list[LangUtil::getPageTitle("search")] = "search.php";
                                                    $page_list[LangUtil::getPageTitle("reports")] = "reports.php";
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // Currently Disabled. Uncomment if required
    // $page_list[LangUtil::getPageTitle("help")] = "help.php";
    return $page_list;
}