Exemple #1
0
 //decode json file
 if (!file_exists("{$zip_folder_path}/data.json")) {
     exit("ERROR: no data json file");
 }
 $pano_video_data = decode_pano_video_json("{$zip_folder_path}/data.json");
 //trans_id_table contain old id as key and new id as value
 $trans_id_table = array();
 //save data to DB and move files to proper location
 //Allocating new Id has to be treated in order, so don't use 'foreach' iteration
 if (array_key_exists('layer', $pano_video_data)) {
     $trans_id_table['layer'] = array();
     for ($i = 0; $i < count($pano_video_data['layer']); $i++) {
         $layer = $pano_video_data['layer'][$i];
         //save old_id and new_id
         $old_id = $layer['layer_id'];
         $new_id = alloc_new_layer_id();
         $trans_id_table['layer'][$old_id] = $new_id;
         //get order for new layer
         $new_order = get_new_order('layer', 'map_id', $project_id);
         $layer['orders'] = $new_order;
         //transform old data into new data
         $layer['map_id'] = $project_id;
         // if tile url is local, move tile images to project
         if (!preg_match("/^https?:\\/\\//", $layer['tile_url'])) {
             //move files from temp diectory to proper location
             $old_tile_path = $layer['tile_url'];
             $new_tile_path = preg_replace("/tile\\/[0-9]*\\//", "project/{$project_id}/tile/{$new_id}/", $old_tile_path);
             $layer['tile_url'] = $new_tile_path;
             $old_tile_folder_path = preg_replace("/[a-zA-Z.{}-]*\$/", "", $old_tile_path);
             $new_tile_folder_path = preg_replace("/[a-zA-Z.{}-]*\$/", "", $new_tile_path);
             //if there hasn't been tile folder, make tile folder
Exemple #2
0
        $data['options']['vtourId'] = $row['vtour_id'];
        $data['options']['initialAth'] = $row['hlookat'];
        $data['options']['initialAtv'] = $row['vlookat'];
        $data['options']['initialFov'] = $row['fov'];
        $data['options']['name'] = $row['pvr_name'];
        $data['options']['pvrPath'] = $row['pvr_path'];
        $data['options']['type'] = "pvr";
    }
    echo json_encode($data, JSON_NUMERIC_CHECK);
}
if ($_GET['req'] == "getNewId") {
    if ($_GET['data']['type'] == "project") {
        echo alloc_new_project_id($_GET['data']['options']['userId']);
    }
    if ($_GET['data']['type'] == "layer") {
        echo alloc_new_layer_id();
    }
    if ($_GET['data']['type'] == "vtour") {
        echo alloc_new_vtour_id();
    }
    if ($_GET['data']['type'] == "pvr") {
        echo alloc_new_pvr_id();
    }
    if ($_GET['data']['type'] == "markerIcon") {
        echo alloc_new_marker_icon_id();
    }
    if ($_GET['data']['type'] == "marker") {
        echo alloc_new_marker_id();
    }
    if ($_GET['data']['type'] == "hotspotIcon") {
        echo alloc_new_hotspot_icon_id();