Example #1
0
    /**
     * 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;
    }
Example #2
0
 /**
  * Get locations by map
  * @param IGeoMap
  * @return array of IGeoMapLocation
  */
 public static function GetByMap(IGeoMap $map)
 {
     global $g_ado_db;
     $list_spec = array('map_id' => $map->getId());
     $list_spec_str = serialize($list_spec);
     if (!empty(self::$s_found_maplocations_by_map) && isset(self::$s_found_maplocations_by_map[$list_spec_str])) {
         $list_res_data = self::$s_found_maplocations_by_map[$list_spec_str];
         $list = $list_res_data['list'];
         return $list;
     }
     $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;
     }
     if (empty(self::$s_found_maplocations_by_map)) {
         self::$s_found_maplocations_by_map = array();
     }
     self::$s_found_maplocations_by_map[$list_spec_str] = array('list' => $mapLocations);
     return $mapLocations;
 }