function location_load_locations in Location 5
Same name and namespace in other branches
- 5.3 location.module \location_load_locations()
- 6.3 location.module \location_load_locations()
- 7.5 location.module \location_load_locations()
- 7.3 location.module \location_load_locations()
- 7.4 location.module \location_load_locations()
1 call to location_load_locations()
- location_nodeapi in ./
location.module - Implementation of hook_nodeapi().
File
- ./
location.module, line 1281
Code
function location_load_locations($type, $node_or_user) {
$res = db_query("SELECT * FROM {location} WHERE type = '%s' AND eid = %d ORDER BY lid", $type, $type == 'user' ? $node_or_user->uid : $node_or_user->vid);
$locations = array();
$location = array();
$index = 0;
while ($row = db_fetch_object($res)) {
$locations[$index] = (array) $row;
if (isset($locations[$index]['latitude'])) {
$locations[$index]['lat'] = $locations[$index]['latitude'];
$locations[$index]['lon'] = $locations[$index]['longitude'];
}
if ($extra = location_invoke_locationapi($locations[$index], 'load')) {
$locations[$index] = array_merge($locations[$index], $extra);
}
$index++;
}
$location = count($locations) ? $locations[0] : array();
return array(
'locations' => $locations,
'location' => $location,
);
}