function create_map_url($markerpos, $index, $latitude, $longitude)
 {
     global $googlemap_key;
     $markers = $markerpos['markers'];
     if (empty($markerpos['markers'])) {
         $dzoom = "&zoom=8";
     } else {
         $dzoom = "";
     }
     $markers_str = "markers=color:blue|size:small|";
     $markers_ev_str = "&markers=color:orange|size:small|";
     $sel_marker_str = "";
     foreach ($markers as $i => $marker) {
         $lat = sprintf("%.3f", $marker['lat']);
         $lon = sprintf("%.3f", $marker['lon']);
         $type = strtoupper(typeToLetter($marker['type']));
         if (strcmp($type, 'E') == 0) {
             if ($i != $index) {
                 $markers_ev_str .= "{$lat},{$lon}|";
             } else {
                 $sel_marker_str = "&markers=color:orange|label:{$type}|{$lat},{$lon}|";
             }
         } else {
             if ($i != $index) {
                 $markers_str .= "{$lat},{$lon}|";
             } else {
                 $sel_marker_str = "&markers=color:blue|label:{$type}|{$lat},{$lon}|";
             }
         }
     }
     $google_map = "http://maps.google.com/maps/api/staticmap?center=" . $latitude . "," . $longitude . $dzoom . "&size=350x350&maptype=roadmap&key=" . $googlemap_key . "&sensor=false&" . $markers_str . $markers_ev_str . $sel_marker_str;
     return $google_map;
 }
$map_zoom = $main_page_map_zoom;
$map_width = $main_page_map_width;
$map_height = $main_page_map_height;
// Read coordinates of the newest caches
$markerpositions = get_marker_positions();
// Generate include file for map with new caches
$google_map = sprintf("//maps.google.com/maps/api/staticmap?center=%F,%F&zoom=%d&size=%dx%d&maptype=roadmap&key=%s&sensor=false", $map_center_lat, $map_center_lon, $map_zoom, $map_width, $map_height, $googlemap_key);
$file_content = '<img src="' . $google_map . '" id="main-cachemap" name="main-cachemap" alt="{{map}}" />';
// Calculate positions for small and large images highlighting recent caches and events
$markers = $markerpositions['markers'];
$small_markers = '';
$big_markers = '';
foreach ($markers as $i => $marker) {
    $markerposleft = lon_offset($marker['lon'], $map_center_lon, $map_width, $map_zoom);
    $markerpostop = lat_offset($marker['lat'], $map_center_lat, $map_height, $map_zoom);
    $type = strtoupper(typeToLetter($marker['type']));
    if (strcmp($type, 'E') == 0) {
        $small_marker = 'mark-small-orange.png';
        $big_marker = 'marker-orangeE.png';
    } else {
        $small_marker = 'mark-small-blue.png';
        $big_marker = 'marker-blue' . $type . '.png';
    }
    $small_markers .= '<img id="smallmark' . $marker['nn'] . '" style="position: absolute; left: ' . ($markerposleft - 7) . 'px; top: ' . ($markerpostop - 21) . 'px; border: none; background-color: transparent;" src="/images/markers/' . $small_marker . '">';
    $big_markers .= '<img id="bigmark' . $marker['nn'] . '" style="position: absolute; left: ' . ($markerposleft - 11) . 'px; top: ' . ($markerpostop - 36) . 'px; border: none; background-color: transparent; visibility: hidden;" src="/images/markers/' . $big_marker . '">';
}
$file_content .= $small_markers . $big_markers;
$n_file = fopen($dynstylepath . "main_cachemap.inc.php", 'w');
fwrite($n_file, $file_content);
fclose($n_file);
//start_newcaches.include
Example #3
0
     tpl_set_var('hidenpa_end', '-->');
     tpl_set_var('npa_content', '');
 } else {
     tpl_set_var('hidenpa_start', '');
     tpl_set_var('hidenpa_end', '');
     tpl_set_var('npa_content', $npa_content);
 }
 //cache data
 list($iconname) = getCacheIcon($usr['userid'], $cache_record['cache_id'], $cache_record['status'], $cache_record['user_id'], $cache_record['icon_large']);
 list($lat_dir, $lat_h, $lat_min) = help_latToArray($cache_record['latitude']);
 list($lon_dir, $lon_h, $lon_min) = help_lonToArray($cache_record['longitude']);
 $tpl_subtitle = htmlspecialchars($cache_record['name'], ENT_COMPAT, 'UTF-8') . ' - ';
 $map_msg = mb_ereg_replace("{target}", urlencode("viewcache.php?cacheid=" . $cache_id), tr('map_msg'));
 tpl_set_var('googlemap_key', $googlemap_key);
 tpl_set_var('map_msg', $map_msg);
 tpl_set_var('typeLetter', typeToLetter($cache_record['type']));
 tpl_set_var('cacheid_urlencode', htmlspecialchars(urlencode($cache_id), ENT_COMPAT, 'UTF-8'));
 tpl_set_var('cachename', htmlspecialchars($cache_record['name'], ENT_COMPAT, 'UTF-8'));
 if ($cache_record['date_alg'] == '') {
     tpl_set_var('icon_titled', '');
 } else {
     $ntitled_cache = $titled_cache_period_prefix . '_titled_cache';
     tpl_set_var('icon_titled', '<img src="tpl/stdstyle/images/free_icons/award_star_gold_1.png" class="icon16" alt="' . tr($ntitled_cache) . '" title="' . tr($ntitled_cache) . '"/>');
 }
 // cache type Mobile add calculate distance
 // todo: poszerzyć tabelkę 'caches' (lub stworzyć nową z relacją)
 //       pole dystans, żeby nie trzeba było za każdym razem zliczać
 //       dystansu.
 if ($cache_record['type'] == GeoCache::TYPE_MOVING) {
     tpl_set_var('moved_icon', $moved_icon);
     /* if (!isset($_REQUEST['cacheid'])) $OpencacheID = $cache_id */
Example #4
0
 function add_single_marker($c_kind, $c_type, $c_lat, $c_long)
 {
     global $fixed_google_map_link;
     $lat = sprintf("%.3f", $c_lat);
     $lon = sprintf("%.3f", $c_long);
     $type = strtoupper(typeToLetter($c_type));
     $kind = $c_kind;
     $single_marker = '';
     if (strcmp($kind, 'TopR') == 0) {
         $single_marker = "&amp;markers=color:0x29BD1A|label:{$type}|{$lat},{$lon}|";
     } else {
         if (strcmp($kind, 'NewL') == 0) {
             $single_marker = "&amp;markers=color:black|label:{$type}|{$lat},{$lon}|";
         }
     }
     return $fixed_google_map_link . $single_marker;
 }
Example #5
0
     tpl_set_var('npa_content', '');
 } else {
     tpl_set_var('hidenpa_start', '');
     tpl_set_var('hidenpa_end', '');
     tpl_set_var('npa_content', $npa_content);
 }
 $icons = $geocache->dictionary->getCacheTypeIcons();
 //cache data
 list($iconname) = getCacheIcon($usr['userid'], $geocache->getCacheId(), $geocache->getStatus(), $geocache->getOwner()->getUserId(), $icons[$geocache->getCacheType()]['icon']);
 list($lat_dir, $lat_h, $lat_min) = help_latToArray($geocache->getCoordinates()->getLatitude());
 list($lon_dir, $lon_h, $lon_min) = help_lonToArray($geocache->getCoordinates()->getLongitude());
 $tpl_subtitle = htmlspecialchars($geocache->getCacheName(), ENT_COMPAT, 'UTF-8') . ' - ';
 $map_msg = mb_ereg_replace("{target}", urlencode("viewcache.php?cacheid=" . $cache_id), tr('map_msg'));
 tpl_set_var('googlemap_key', $googlemap_key);
 tpl_set_var('map_msg', $map_msg);
 tpl_set_var('typeLetter', typeToLetter($geocache->getCacheType()));
 tpl_set_var('cacheid_urlencode', htmlspecialchars(urlencode($cache_id), ENT_COMPAT, 'UTF-8'));
 tpl_set_var('cachename', htmlspecialchars($geocache->getCacheName(), ENT_COMPAT, 'UTF-8'));
 if ($geocache->isTitled()) {
     $ntitled_cache = $titled_cache_period_prefix . '_titled_cache';
     tpl_set_var('icon_titled', '<img src="tpl/stdstyle/images/free_icons/award_star_gold_1.png" class="icon16" alt="' . tr($ntitled_cache) . '" title="' . tr($ntitled_cache) . '"/>');
 } else {
     tpl_set_var('icon_titled', '');
 }
 // cache type Mobile add calculate distance
 if ($geocache->getCacheType() == GeoCache::TYPE_MOVING) {
     tpl_set_var('moved_icon', $moved_icon);
     tpl_set_var('dystans', $geocache->getDistance());
     tpl_set_var('moved', $geocache->getMoveCount());
     tpl_set_var('hidemobile_start', '');
     tpl_set_var('hidemobile_end', '');