Changeset 7128 for extensions/GMaps/gmaps_ajax.php
- Timestamp:
- Oct 8, 2010, 3:02:29 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GMaps/gmaps_ajax.php
r7125 r7128 72 72 73 73 $_REQUEST['ajaxfct']=='public.maps.init' or 74 $_REQUEST['ajaxfct']=='public.maps.getMarkers' or75 $_REQUEST['ajaxfct']=='public.maps.getMarkerInfos'74 $_REQUEST['ajaxfct']=='public.maps.getMarkers' //or 75 //$_REQUEST['ajaxfct']=='public.maps.getMarkerInfos' 76 76 )) $_REQUEST['ajaxfct']=''; 77 77 … … 234 234 $_REQUEST['ajaxfct']=''; 235 235 } 236 else 237 { 238 if(!isset($_REQUEST['datas']['levelInfo'])) $_REQUEST['datas']['levelInfo']=1; 239 240 if(!($_REQUEST['datas']['levelInfo']==0 or 241 $_REQUEST['datas']['levelInfo']==1)) $_REQUEST['datas']['levelInfo']=1; 242 } 236 243 } 237 244 } … … 246 253 $_REQUEST['ajaxfct']=''; 247 254 } 255 256 248 257 } 249 258 … … 787 796 * 'width' : width of maps in pixels 788 797 * 'height' : height of maps in pixels 798 * 'levelInfo' : 0 = don't return pictures info (name, url, ...) 799 * 1 = return pictures informations 789 800 * @return Array|String : a JSON string of an array of points (nbPictures, lat, lng) 790 801 */ … … 793 804 global $user, $page; 794 805 795 $returned=array(); 806 $returned=array( 807 'markers' => array(), 808 'datas' => array( 809 'nbPhotos' => 0 810 ) 811 ); 796 812 797 813 /* … … 907 923 { 908 924 $coords=array( 909 'nbIm agesTxt' => '',925 'nbImgTxt' => '', 910 926 'nbImages' => 0, 911 'lat itude' => 0,912 'l ongitude' => 0,913 'im agesTnFile' => array(),914 'im agesCatsNames' => array(),915 'im agesName' => array(),916 'im agesCatsUrl' => array(),927 'lat' => 0, // 'lat' rather than 'latitude' 928 'lng' => 0, // 'lng' rather than 'longitude' 929 'imgTn' => array(), 930 'imgCatsNames' => array(), 931 'imgName' => array(), 932 'imgCatsUrl' => array(), 917 933 ); 918 934 … … 938 954 } 939 955 956 if(count($tmpCatsId)<=1) $tmpCatsNames=''; 957 940 958 $coords['nbImages']++; 941 $coords['latitude']+=$point['latitude']; 942 $coords['longitude']+=$point['longitude']; 943 $coords['imagesTnFile'][]=$point['imageTnFile']; 944 $coords['imagesCatsNames'][]=$tmpCatsNames; 945 $coords['imagesName'][]=$point['imageName']; 946 $coords['imagesCatsUrl'][]=$tmpCatsUrl; 947 } 948 $coords['latitude']=$coords['latitude']/count($group); 949 $coords['longitude']=$coords['longitude']/count($group); 950 $coords['uniqueId']=md5($coords['latitude'].$coords['latitude']); 959 960 $coords['lat']+=$point['latitude']; 961 $coords['lng']+=$point['longitude']; 962 963 if($datas['levelInfo']==1) 964 { 965 $coords['imgTn'][]=substr($point['imageTnFile'],12); 966 $coords['imgCatsNames'][]=$tmpCatsNames; 967 $coords['imgName'][]=$point['imageName']; 968 $coords['imgCatsUrl'][]=$tmpCatsUrl; 969 } 970 } 971 $coords['lat']=$coords['lat']/count($group); 972 $coords['lng']=$coords['lng']/count($group); 973 $coords['uniqueId']=md5($coords['lat'].$coords['lng']); 951 974 952 975 if($coords['nbImages']==1) 953 976 { 954 $coords['nbIm agesTxt']=l10n('gmaps_1_picture');977 $coords['nbImgTxt']=l10n('gmaps_1_picture'); 955 978 } 956 979 else 957 980 { 958 $coords['nbImagesTxt']=sprintf(l10n('gmaps_nb_pictures'), $coords['nbImages']); 959 } 960 961 $returned[]=$coords; 962 } 981 $coords['nbImgTxt']=sprintf(l10n('gmaps_nb_pictures'), $coords['nbImages']); 982 } 983 984 985 986 $returned['markers'][]=$coords; 987 $returned['datas']['nbPhotos']+=$coords['nbImages']; 988 } 989 } 990 991 if($returned['datas']['nbPhotos']>1) 992 { 993 $returned['datas']['nbPhotos']=sprintf(l10n('gmaps_nb_pictures'), $returned['datas']['nbPhotos']); 994 } 995 else 996 { 997 $returned['datas']['nbPhotos']=l10n('gmaps_1_picture'); 963 998 } 964 999
Note: See TracChangeset
for help on using the changeset viewer.