Changeset 18578 for extensions/rv_gmaps/trunk/map_data.php
- Timestamp:
- Oct 9, 2012, 9:33:42 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_gmaps/trunk/map_data.php
r17468 r18578 31 31 $where_sql = rvm_bounds_to_sql( $page['box'] ); 32 32 33 $img_fields = ' i.id,i.representative_ext,i.name,i.comment,i. path,i.lat,i.lon';33 $img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.lat,i.lon'; 34 34 35 35 $was_flat = @$page['flat']; … … 79 79 $out=''; 80 80 function rvo($s) { 81 global $out; $out.=$s; 81 //global $out; $out.=$s; 82 echo $s; 82 83 } 83 84 84 85 function rvf() { 85 global $out; echo $out; $out=''; 86 ob_flush(); 86 //global $out; echo $out; $out=''; ob_flush(); 87 87 } 88 88 89 89 $start_output = get_moment(); 90 90 91 rvo( '{' );92 91 93 rvo( "\ntitle:".jsgm_str( strip_tags(trigger_event('render_element_description', $page['title']) ) ) ); 94 rvo( ",\n" ); 92 rvo( "{\ntitle:".jsgm_str( strip_tags(trigger_event('render_element_description', $page['title']) ) ) ); 95 93 96 rvo( "page_url:".jsgm_str( duplicate_index_url( array('start'=>0) ) ) ); 97 rvo( ",\n" ); 94 rvo( ",\npage_url:".jsgm_str( duplicate_index_url( array('start'=>0) ) ) ); 98 95 99 rvo( "blowup_url:".jsgm_str( rvm_duplicate_blowup_url( array('start'=>0) ) ) ); 100 rvo( ",\n" ); 96 rvo( ",\nblowup_url:".jsgm_str( rvm_duplicate_blowup_url( array('start'=>0) ) ) ); 101 97 102 rvo( "kml_url:".jsgm_str( rvm_duplicate_kml_index_url( array('start'=>0, 'flat'=>1) ) ) ); 103 rvo( ",\n" ); 98 rvo( ",\nkml_url:".jsgm_str( rvm_duplicate_kml_index_url( array('start'=>0, 'flat'=>1) ) ) ); 104 99 105 rvo( "nb_items:".count($page['items']) ); 106 rvo( ",\n" ); 100 rvo( ",\nnb_items:".count($page['items']) ); 107 101 108 rvo( " bounds:" );102 rvo( ",\nbounds:" ); 109 103 if ( isset($cm) ) 110 104 rvo( jsgm_bounds( $cm->bounds ) ); 111 105 else 112 106 rvo( "null" ); 113 rvo( ",\n" );114 107 108 rvo( ",\n\nnb_clusters:".count($clusters) ); 115 109 116 rvo( "\nnb_clusters:".count($clusters) ); 117 rvo( "," ); 118 119 rvo( "\nimage_clusters:[\n" ); 110 rvo( ",\nimage_clusters:[\n" ); 120 111 $i=0; 121 112 $thumb_params = ImageStdParams::get_by_type(IMG_THUMB); 113 $page_url_model = duplicate_picture_url( 114 array( 115 'image_id' => 123456789, 116 'image_file' => 'dummy_file.txt', 117 'flat' => 1, 118 ), 119 array('start') 120 ); 121 122 122 foreach( $clusters as $c ) 123 123 { 124 124 if ($i) rvo( ",\n\n" ); 125 rvo( "{" ); 126 rvo( 'position:'. jsgm_position( bounds_center($c->bounds) ) ); 127 rvo( ",\n" ); 128 rvo( 'bounds:'. jsgm_bounds( $c->bounds ) ); 129 rvo( ",\n" ); 130 rvo( 'nb_items:'.count($c->items) ); 125 rvo( '{position:'. jsgm_position( bounds_center($c->bounds) ) ); 126 rvo( ",\nbounds:". jsgm_bounds( $c->bounds ) ); 127 rvo( ",\nnb_items:".count($c->items) ); 131 128 rvo( ",\n" ); 132 129 133 130 rvo( 'blowup_url:"'.rvm_duplicate_blowup_url(array('box'=>$c->bounds), array('start') ). '"' ); 134 rvo( ",\n" );135 131 136 132 $max_per_cluster = rvm_get_config_var('nb_images_per_marker',20); … … 139 135 $c->items = array_slice($c->items, 0, $max_per_cluster); 140 136 } 141 rvo( 'items:[');137 rvo( ",\nitems:[" ); 142 138 for ($j=0; $j<count($c->items); $j++) 143 139 { 144 140 $img = $page['items'] [ $c->items[$j] ]; 145 $img['file'] = basename( $img['path'] );146 141 147 $params = array( 148 'image_id' => $img['id'], 149 'image_file' => $img['file'], 150 'flat' => 1, 151 ); 152 $page_url = duplicate_picture_url($params, array('start') ); 142 $page_url = str_replace(array('123456789','dummy_file'), array($img['id'], get_filename_wo_extension($img['file'])), $page_url_model); 153 143 154 144 if ($j) rvo( "," ); 155 rvo( "{" ); 156 rvo( "tn:".jsgm_str( DerivativeImage::url( $thumb_params,$img ) ) ); 145 rvo( "{tn:".jsgm_str( DerivativeImage::url( $thumb_params,$img ) ) ); 157 146 rvo( ",name:".jsgm_str( render_element_name($img) ) ); 158 147 rvo( ",comment:".jsgm_str( render_element_description($img) ) ); … … 160 149 rvo( "}" ); 161 150 } 162 rvo( ']' ); 163 rvo( "\n" ); 164 rvo( "}" ); 151 rvo( "]\n}" ); 165 152 rvf(); 166 153 $i++;
Note: See TracChangeset
for help on using the changeset viewer.