All pastes #708408 Raw Edit

Stuff

public text v1 · immutable
#708408 ·published 2007-09-23 20:21 UTC
rendered paste body
	<cffunction name="getMarkersBrowse" access="remote" returntype="any">
		<cfargument name="searchstr" required="no" hint="searchstr" displayname="Keyword to search for">
		<cfargument name="car_make" required="no" hint="car_make" displayname="The Car Make if defined">
		<cfargument name="searchzip" required="no" hint="searchzip" displayname="Zip code if user is not dragging the map">
		<cfargument name="radiusmiles" required="no" hint="radiusmiles" displayname="Search within this mile radius.">
		<cfargument name="searchview" required="no" hint="searchview" displayname="Search through what type FALSE=members TRUE=Cars.">
		<cfargument name="lat" required="no" hint="Latitude" displayname="Current Map Centered Latitude">
		<cfargument name="lng" required="no" hint="Longitude" displayname="Current Map Centered Longitude">
		<cfargument name="zoomlvl" required="no" hint="Zoom" displayname="Current Map Zoom Level">
		<cfset var getBrowseQueryResultsTMP = "" />
		<cfset var getBrowseQueryResults = "" />
		<cfset var GeoBoxed = "" />

		<cfset GeoBoxed = CreateObject("component","geo").GeoBox(arguments.lat,arguments.lng,arguments.radiusmiles)>

		<CFQUERY NAME="getBrowseQueryResults" DATASOURCE="streets">
	SELECT
markers.id,
markers.streetsid,
markers.address1,
markers.address2,
markers.city,
markers.state,
markers.zip,
markers.country,
markers.eventdate,
markers.iconid,
markers.latitude,
markers.longitude,
markers.lonlatmatch,
markers.markerdetails,
markers.markername,
markers.view,
icontypes.id AS IconTypesID,
icontypes.IconImgPath,
icontypes.IconImgName
	FROM markers
	LEFT JOIN icontypes ON markers.iconid = icontypes.ID
	WHERE
markers.latitude
	BETWEEN
#geoboxed.latmin#
	AND
#geoboxed.latmax#
	AND
markers.longitude
	BETWEEN
#geoboxed.lonmin#
	AND
#geoboxed.lonmax#
	AND
markers.view = 6
	AND
(
	markers.streetsid = 0
OR
	(markers.streetsid IN(select id FROM users WHERE users.username LIKE '%#arguments.searchstr#%' OR users.name LIKE '%#arguments.searchstr#%'))
OR
	(markers.streetsid IN(select userid FROM garage WHERE garage.car_name LIKE '%#arguments.searchstr#%'))
OR
	(markers.streetsid IN(select streetsid FROM garagedescriptions WHERE garagedescriptions.details LIKE '%#arguments.searchstr#%'))
OR
	(markers.streetsid IN(select userid FROM garage WHERE garage.car_make LIKE '%#arguments.car_make#%'))
)
GROUP BY markers.streetsid
        </CFQUERY>

<cfset adby = "0">
<cfset ucounter = 1>

<cfoutput query="getBrowseQueryResults">

<CFQUERY NAME="getBrowseQueryResultss" dbtype="query">
SELECT ID,LATITUDE,LONGITUDE FROM getBrowseQueryResultsTMP
WHERE ID = #id#
ORDER BY ID
</CFQUERY>

<cfif getBrowseQueryResultss.LATITUDE EQ LATITUDE or getBrowseQueryResultss.LONGITUDE EQ LONGITUDE>
	<cfset setqueryrowlat = QuerySetCell(getBrowseQueryResults, "LATITUDE", LATITUDE+adby, ucounter)>
	<cfset setqueryrowlon = QuerySetCell(getBrowseQueryResults, "LONGITUDE", LONGITUDE+adby, ucounter)>
<cfset adby = adby+.000005000000>
</cfif>

<cfset ucounter = ucounter+1>
</cfoutput>

		<cfreturn getBrowseQueryResults />
	</cffunction>