예제 #1
0
}
$query = array("place" => $print['place_woeid']);
$nearby_prints = get_prints($context->db, $context->user, $query, 200);
$nearby_prints = $nearby_prints[0];
if ($nearby_prints) {
    //print var_dump($nearby_prints);
    $rdm_keys = array_rand($nearby_prints, $num_req = 6);
    $rdm_nearby = array();
    foreach ($rdm_keys as $key => $val) {
        $rdm_nearby[] = $nearby_prints[$val];
    }
    $context->sm->assign('nearby_prints', $rdm_nearby);
}
$context->sm->assign('nearby_prints_json', json_encode($nearby_prints));
$context->sm->assign('zoom', $pages[0]['zoom']);
$context->sm->assign('activity', get_print_activity($context->db, $print_id, true));
$context->sm->assign('providers', get_map_providers());
if ($context->type == 'text/html') {
    header("Content-Type: text/html; charset=UTF-8");
    print $context->sm->fetch("atlas.html.tpl");
} elseif ($context->type == 'application/paperwalking+xml') {
    header("Content-Type: application/paperwalking+xml; charset=UTF-8");
    header("Access-Control-Allow-Origin: *");
    print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
    print $context->sm->fetch("atlas.xml.tpl");
} elseif ($context->type == 'application/geo+json' || $context->type == 'application/json') {
    header("Content-Type: application/geo+json; charset=UTF-8");
    echo print_to_geojson($print, $pages) . "\n";
} else {
    header('HTTP/1.1 400');
    die("Unknown type.\n");
예제 #2
0
<?php

require_once '../lib/lib.everything.php';
enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']);
$context = default_context(True);
/**** ... ****/
$print_id = $_GET['print'] ? $_GET['print'] : null;
$print = get_print($context->db, $print_id);
$activity = get_print_activity($context->db, $print_id, false);
if ($_GET['type'] == 'shp') {
    header('Content-Type: application/zip');
    header('Content-Disposition: filename="activity-' . $print['id'] . '.zip"');
    echo activity_to_shpzip($activity, $print['id']);
} elseif ($context->type == 'text/csv') {
    header("Content-Type: text/csv; charset=UTF-8");
    header('Content-Disposition: filename="activity-' . $print['id'] . '.csv"');
    echo activity_to_csv($activity) . "\n";
} elseif ($context->type == 'application/geo+json' || $context->type == 'application/json') {
    header("Content-Type: application/geo+json; charset=UTF-8");
    header('Content-Disposition: filename="activity-' . $print['id'] . '.geojson"');
    echo activity_to_geojson($activity);
} else {
    header('HTTP/1.1 400');
    die("Unknown type.\n");
}