Skip to main content Help Control Panel

Aubagne HipHop

Tout le Hip Hop d'Aubagne et des alentours

Home «   Server software «  

Documentation: locations/locations.php

Class Locations - The database abstraction layer for locations

Locations are geographical coordinates.

Look at list_by_distance() for the selection of locations based on relative distances. Thanks to Eoin for having provided the adequate formula.

This script is a reference file of this system.

Licence: GNU Lesser General Public License

Auteurs:

delete() - Delete one location in the database and in the file system

function delete($id)



Voir aussi:

delete_for_anchor() - Delete all locations for a given anchor

function delete_for_anchor($anchor)



Voir aussi:

get() - Get one location by id

function &get($id)



Voir aussi:

get_url() - Get the url to view a location

function get_url($id, $action='view')

By default, a relative URL will be provided (e.g. 'locations/view.php?id=512'), which may be not processed correctly by search engines. If the parameter 'with_friendly_urls' has been set to 'Y' in the configuration panel, this function will return an URL parsable by search engines (e.g. 'locations/view.php/512').

Voir aussi:

list_by_date() - List newest locations

function &list_by_date($offset=0, $count=10, $variant='full')

To build a simple box of the newest locations in your main index page, just use the following example:
// side bar with the list of most recent locations
include_once 'locations/locations.php';
$local['title_en'] = 'Most recent locations';
$local['title_fr'] = 'Emplacements récents';
$title i18n::user('title');
$items Locations::list_by_date(010'');
$text Skin::build_list($items'compact');
$context['text'] .= Skin::build_box($title$text'navigation');


You can also display the newest location separately, using Locations::get_newest() In this case, skip the very first location in the list by using Locations::list_by_date(1, 10, '')

Voir aussi:

list_by_date_for_anchor() - List newest locations for one anchor

function &list_by_date_for_anchor($anchor, $offset=0, $count=20, $variant=NULL, $capability='?')



Voir aussi:

list_by_date_for_author() - List newest locations for one author

function &list_by_date_for_author($author_id, $offset=0, $count=20, $variant='date')

list_by_distance() - List nearest locations to one point

function &list_by_distance($latitude, $longitude, $offset=0, $count=20, $variant='compact')

If you are looking for locations near another one, set the offset to one.

Voir aussi:

list_by_distance_for_anchor() - List nearest locations to one anchor

function list_by_distance_for_anchor($anchor, $offset=0, $count=20, $variant='compact')

This function is similar to list_by_distance(), except that it looks for a location for the given anchor first.

Voir aussi:

list_selected() - List selected locations

function &list_selected(&$result, $layout='compact', $capability='?')

Accept following variants:

post() - Post a new location or an updated location

function post($fields)



Voir aussi:

setup() - Create or alter tables for locations

function setup()

Voir aussi:

stat() - Get some statistics

function &stat()



Voir aussi:

stat_for_anchor() - Get some statistics for one anchor

function &stat_for_anchor($anchor)

Tools
Browse the source of this script
Server software