/** * Render Google markers * @author Howard <*****@*****.**> * @static * @param array $wpl_properties * @return array */ public static function render_markers($wpl_properties) { $listings = wpl_global::return_in_id_array(wpl_global::get_listings()); $markers = array(); $geo_points = array(); $i = 0; foreach ($wpl_properties as $key => $property) { if ($key == 'current' and !count($property)) { continue; } /** skip to next if address is hidden **/ if (!$property['raw']['show_address']) { continue; } if (!$property['raw']['googlemap_lt'] or !$property['raw']['googlemap_ln']) { $LatLng = wpl_locations::update_LatLng(NULL, $property['raw']['id']); $property['raw']['googlemap_lt'] = $LatLng[0]; $property['raw']['googlemap_ln'] = $LatLng[1]; } if (isset($geo_points[$property['raw']['googlemap_lt'] . ',' . $property['raw']['googlemap_ln']])) { $j = $geo_points[$property['raw']['googlemap_lt'] . ',' . $property['raw']['googlemap_ln']]; $markers[$j]['pids'] .= ',' . $property['raw']['id']; $markers[$j]['gmap_icon'] = 'multiple.png'; continue; } $markers[$i]['id'] = $property['raw']['id']; $markers[$i]['googlemap_lt'] = $property['raw']['googlemap_lt']; $markers[$i]['googlemap_ln'] = $property['raw']['googlemap_ln']; $markers[$i]['title'] = $property['raw']['googlemap_title']; $markers[$i]['pids'] = $property['raw']['id']; $markers[$i]['gmap_icon'] = (isset($listings[$property['raw']['listing']]['gicon']) and $listings[$property['raw']['listing']]['gicon']) ? $listings[$property['raw']['listing']]['gicon'] : 'default.png'; $geo_points[$property['raw']['googlemap_lt'] . ',' . $property['raw']['googlemap_ln']] = $i; $i++; } return $markers; }