/**
* Get locations by map
* @param IGeoMap
* @return array of IGeoMapLocation
*/
public static function GetByMap(IGeoMap $map)
{
global $g_ado_db;
$queryStr = 'SELECT ml.*, l.*, X(l.poi_location) as latitude, Y(l.poi_location) as longitude, ml.id as id
FROM ' . self::TABLE . ' ml
INNER JOIN ' . Geo_Location::TABLE . ' l
ON ml.fk_location_id = l.id
WHERE ml.fk_map_id = ' . $map->getId() . '
ORDER BY ml.rank, ml.id';
$rows = $g_ado_db->GetAll($queryStr);
$mapLocations = array();
foreach ((array) $rows as $row) {
$mapLocation = new self($row);
$row['id'] = $row['fk_location_id'];
$mapLocation->location = new Geo_Location($row);
$mapLocations[] = $mapLocation;
}
return $mapLocations;
}