Changeset 7479 for extensions/GMaps/gmaps_pip.class.inc.php
- Timestamp:
- Oct 29, 2010, 3:01:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GMaps/gmaps_pip.class.inc.php
r7308 r7479 18 18 class GMaps_PIP extends GMaps_root 19 19 { 20 protected $maps = array(); //list of maps21 20 protected $category=array( 22 21 'id' => 0, … … 36 35 protected $picture=array( 37 36 'geolocated' => false, 37 'forceDisplay' => false, 38 38 'coords' => array('lat' => 0, 'lng' => 0), 39 39 'content' => array( … … 155 155 } 156 156 157 if($nb>0 )157 if($nb>0 or $this->forceDisplay>0) 158 158 { 159 159 /* … … 163 163 foreach($this->maps as $keyMap => $map) 164 164 { 165 $scripts[]=" 165 if($nb>0 or 166 $map['forceDisplay']=='y' and ($map['kmlFileUrl']!='' or $map['kmlFileId']!=0) 167 ) 166 168 { 167 id:'iGMapsIcon', 168 zoomLevel:".$map['zoomLevel'].", 169 markerImg:'".$map['marker']."', 170 mapType:'".$map['mapType']."', 171 mapTypeControl:'".$map['mapTypeControl']."', 172 navigationControl:'".$map['navigationControl']."', 173 scaleControl:'".$map['scaleControl']."', 174 streetViewControl:'".$map['streetViewControl']."', 175 kmlFileUrl:'".$map['kmlFileUrl']."', 176 displayType:'".$map['displayType']."', 177 sizeMode:'".$map['sizeMode']."', 178 title:'".addslashes( ($map['title']=='')?l10n('gmaps_geolocation'):$map['title'] )."', 179 markers:[], 180 fitToBounds:true, 181 zoomLevelMaxActivated:".($map['zoomLevelMaxActivated']=='y'?'true':'false')." 182 }"; 183 184 preg_match('/^i(\d+)x(\d+).*/i', basename($map['icon']), $result); 185 $this->category['icon']['iconStyle']=$map['iconStyle']; 186 $this->category['icon']['file']=$map['icon']; 187 $this->category['icon']['width']=isset($result[1])?$result[1]:-1; 188 $this->category['icon']['height']=isset($result[2])?$result[2]:-1; 169 $scripts[]=" 170 { 171 id:'iGMapsIcon', 172 zoomLevel:".$map['zoomLevel'].", 173 markerImg:'".$map['marker']."', 174 mapType:'".$map['mapType']."', 175 mapTypeControl:'".$map['mapTypeControl']."', 176 navigationControl:'".$map['navigationControl']."', 177 scaleControl:'".$map['scaleControl']."', 178 streetViewControl:'".$map['streetViewControl']."', 179 kmlFileUrl:'".$map['kmlFileUrl']."', 180 displayType:'".$map['displayType']."', 181 sizeMode:'".$map['sizeMode']."', 182 title:'".addslashes( ($map['title']=='')?l10n('gmaps_geolocation'):$map['title'] )."', 183 markers:[], 184 fitToBounds:true, 185 zoomLevelMaxActivated:".($map['zoomLevelMaxActivated']=='y'?'true':'false')." 186 }"; 187 188 preg_match('/^i(\d+)x(\d+).*/i', basename($map['icon']), $result); 189 $this->category['icon']['iconStyle']=$map['iconStyle']; 190 $this->category['icon']['file']=$map['icon']; 191 $this->category['icon']['width']=isset($result[1])?$result[1]:-1; 192 $this->category['icon']['height']=isset($result[2])?$result[2]:-1; 193 } 189 194 } 190 191 195 192 196 $template->assign('maps', $this->maps); … … 209 213 gmaps = 210 214 { 215 geolocated:".($nb>0?'true':'false').", 216 forceDisplay:".($nb==0?'true':'false').", 211 217 lang:{ 212 218 boundmap:'".l10n('gmaps_i_boundmap')."', … … 249 255 global $page, $template; 250 256 251 if($this->picture['geolocated']==false ) return(false);257 if($this->picture['geolocated']==false and $this->picture['forceDisplay']==false) return(false); 252 258 253 259 if(isset($this->picture['content']['MP']) and count($this->picture['content']['MP'])>0) … … 258 264 $template->assign('maps', $this->picture['content']['MP']); 259 265 266 $metaTitle=''; 267 foreach($this->picture['content']['MP'] as $map) 268 { 269 if($metaTitle=='') $metaTitle=$map['title']; 270 } 271 260 272 $metadata=array 261 273 ( 262 'TITLE' => l10n('gmaps_geolocation'),274 'TITLE' => ($metaTitle=='')?l10n('gmaps_geolocation'):$metaTitle, 263 275 'lines' => 264 276 array( … … 296 308 gmaps = 297 309 { 310 geolocated:".($this->picture['geolocated']?'true':'false').", 311 forceDisplay:".($this->picture['forceDisplay']?'true':'false').", 298 312 lang:{ 299 313 centermap:'".l10n('gmaps_i_centermap')."', … … 328 342 global $template, $page; 329 343 344 $isGeolocated=true; 345 330 346 if(is_null($jpegMD->getTag('magic.GPS.LatitudeNum')) or 331 347 is_null($jpegMD->getTag('magic.GPS.LongitudeNum')) or 332 $page['section']!='categories') return(false); 333 334 335 $this->picture['geolocated']=true; 336 $this->picture['coords']['lat']=$jpegMD->getTag('magic.GPS.LatitudeNum')->getValue(); 337 $this->picture['coords']['lng']=$jpegMD->getTag('magic.GPS.LongitudeNum')->getValue(); 348 $page['section']!='categories') $isGeolocated=false; 338 349 339 350 … … 347 358 } 348 359 360 if($this->forceDisplay==0 and !$isGeolocated) return(false); 361 362 $this->picture['geolocated']=$isGeolocated; 363 $this->picture['forceDisplay']=!$isGeolocated; 364 if($isGeolocated) 365 { 366 $this->picture['coords']['lat']=$jpegMD->getTag('magic.GPS.LatitudeNum')->getValue(); 367 $this->picture['coords']['lng']=$jpegMD->getTag('magic.GPS.LongitudeNum')->getValue(); 368 } 369 349 370 350 371 foreach($this->maps as $map) 351 372 { 352 if($map['displayType']=='IP') 353 { 354 preg_match('/^i(\d+)x(\d+).*/i', basename($map['icon']), $result); 355 $this->picture['icon']=array( 356 'iconStyle' => $map['iconStyle'], 357 'file' => $map['icon'], 358 'width' => isset($result[1])?$result[1]:-1, 359 'height' => isset($result[2])?$result[2]:-1 373 if($isGeolocated or 374 $map['forceDisplay']=='y' and ($map['kmlFileUrl']!='' or $map['kmlFileId']!=0) 375 ) 376 { 377 if($map['displayType']=='IP') 378 { 379 preg_match('/^i(\d+)x(\d+).*/i', basename($map['icon']), $result); 380 $this->picture['icon']=array( 381 'iconStyle' => $map['iconStyle'], 382 'file' => $map['icon'], 383 'width' => isset($result[1])?$result[1]:-1, 384 'height' => isset($result[2])?$result[2]:-1 385 ); 386 } 387 388 389 $this->picture['content'][$map['displayType']][]=array( 390 'id' => $map['id'], 391 'width' => $map['width'], 392 'height' => $map['height'], 393 'style' => $map['style'], 394 'displayType' => $map['displayType'], 395 'title' => $map['title'], 360 396 ); 397 398 $this->picture['properties'][]=" 399 { 400 id:'iGMaps".(($map['displayType']=='IP')?'Icon':$map['id'])."', 401 zoomLevel:".$map['zoomLevel'].", 402 markerImg:'".$map['marker']."', 403 mapType:'".$map['mapType']."', 404 mapTypeControl:'".$map['mapTypeControl']."', 405 navigationControl:'".$map['navigationControl']."', 406 scaleControl:'".$map['scaleControl']."', 407 streetViewControl:'".$map['streetViewControl']."', 408 kmlFileUrl:'".$map['kmlFileUrl']."', 409 displayType:'".$map['displayType']."', 410 sizeMode:'".$map['sizeMode']."', 411 title:'".addslashes( ($map['title']=='')?l10n('gmaps_geolocation'):$map['title'] )."' 412 }"; 361 413 } 362 363 364 $this->picture['content'][$map['displayType']][]=array(365 'id' => $map['id'],366 'width' => $map['width'],367 'height' => $map['height'],368 'style' => $map['style'],369 'displayType' => $map['displayType']370 );371 372 $this->picture['properties'][]="373 {374 id:'iGMaps".(($map['displayType']=='IP')?'Icon':$map['id'])."',375 zoomLevel:".$map['zoomLevel'].",376 markerImg:'".$map['marker']."',377 mapType:'".$map['mapType']."',378 mapTypeControl:'".$map['mapTypeControl']."',379 navigationControl:'".$map['navigationControl']."',380 scaleControl:'".$map['scaleControl']."',381 streetViewControl:'".$map['streetViewControl']."',382 kmlFileUrl:'".$map['kmlFileUrl']."',383 displayType:'".$map['displayType']."',384 sizeMode:'".$map['sizeMode']."',385 title:'".addslashes( ($map['title']=='')?l10n('gmaps_geolocation'):$map['title'] )."'386 }";387 414 } 388 415 }
Note: See TracChangeset
for help on using the changeset viewer.