if (ossim_error()) { $response['error'] = TRUE; $response['msg'] = ossim_get_error(); } else { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { switch ($action) { case 1: $response = delete_map($conn, $data); if ($return['error'] == FALSE) { unset($_SESSION['riskmap']); $config = new User_config($conn); $user = Session::get_session_user(); $default_map = $config->get($user, "riskmap", 'simple', 'main'); if (strcasecmp($default_map, $data) == 0) { //Save new default map in the PHP Session $map = get_first_map_available($conn); if (map_exists($map)) { $_SESSION['riskmap'] = $map; set_default_map($conn, $map); } } } break; case 2: $response = set_default_map($conn, $data); //Save default map in the PHP Session if ($return['error'] == FALSE) { $_SESSION['riskmap'] = $data; } break; case 3:
/** * This function returns the current map selected by the user * * @param object $conn Database access object * * @return string */ function get_current_map($conn) { $map = ''; if (GET('back_map') != '') { $map = GET('back_map'); } elseif (POST('map') != '') { $map = POST('map'); } elseif (GET('map') != '') { $map = GET('map'); } elseif ($_SESSION['riskmap'] != '') { $map = $_SESSION['riskmap']; } else { $config = new User_config($conn); $user = Session::get_session_user(); $map = $config->get($user, 'riskmap', 'simple', 'main'); if (empty($map)) { //No default map selected, we get the first available map $map = get_first_map_available($conn); } } return $map; }