![]() |
||
PHPGeocache ClassThis class is contained in the file PHPGeocache.inc.php and encapsulates most functions. It uses the Geocache.inc.php and Waypoint.inc.php internally which itself use the OCFParser.inc.php and db-mysql.inc.php internally. 1. General Cache FunctionsgetCacheByIDContext: PHPGeocacheRetrieves a Geocache object from the database by the cacheID givenThis method retrieves the dataset from the database, creates a Geocache object and returns that object. Return value Geocache object or FALSE $cacheID is the content of the field "cache_id" in the database table "caches". This is mapped internally to the srcid attribute of the GeoCache object. Usage
$phpgc->getCacheByID($cacheID)
Example
<?php
GCVXFF Haardliner getCacheByNameContext: PHPGeocacheRetrieves a Geocache object from the database by the cache name givenThis method retrieves the dataset from the database, creates a Geocache object and returns that object. Return value Geocache object or FALSE $cacheName is the content of the field "name" in the database table "caches". This is mapped internally to the name attribute of the GeoCache object. Usage
$phpgc->getCacheByName($cacheName)
Example
<?php
GCVXFF Haardliner findCachesContext: PHPGeocacheSearches in the fields name and description for any cache containing the string givenThis method retrieves the datasets from the database, creates Geocache objects and returns them as an array. Return value Array of Geocache objects or FALSE $searchString is the text to be found. Usage
$phpgc->findCaches($searchString)
Example
<?php
(0) GCVXFF Haardliner (1) CSRHEB Rheinelbe X-1 (2) CS7673 A small multi-cache! (3) CS7673 A small multi-cache! getCachesByDistanceContext: PHPGeocacheRetrieves a specific maximum number of geocaches around the coordinates given sorted by distancePlease note that depending on the number of geocaches in your database this query might take some time as the distance calculation is quite time consuming. Return value Array of Geocache objects or FALSE $long and $lat define the center of the radius. $maxCount is the maximum number of results to be returned. $radius defines the radius to be used in kilometers. $onlyActive only returns entries which have the status 'RUN' in the database. $withWaypoints returns all waypoints as well. As this is not always needed this defaults to false. $getOnlyTheseFields defines the fields to be retrieved. If not given, "SELECT *" is used. Usage
$phpgc->getCachesByDistance($long, $lat, $maxCount [, $radius=9999, $onlyActive=true, $withWaypoints=false, $getOnlyTheseFields=array()])
Example
<?php
(0) CSRHEB Rheinelbe X-1 (0.76 km) (1) GCVXFF Haardliner (23.9 km) (2) CS7673 A small multi-cache! (6324.95 km) (3) CS7673 A small multi-cache! (6324.95 km) AddCacheToDBContext: PHPGeocacheAdds the cache given to the databaseThe given cache (reference to a Geocache object) is inserted into the database table "caches". All waypoints are also added to the table "waypoints" automatically and referenced to the cache_id of the caches table. Return value TRUE or FALSE $geocache is a Geocache object. $userID can be given to indicate the userID (integer value) of the user this cache belongs to. Only useful if the application using PHPGeocache has its own user management. $initialStatus is the initial status of the cache in the database table "caches". Can be one of 'RUN', 'PENDING', 'HOLD', 'ARCHIVED', 'DELETE' Usage
$phpgc->addCacheToDB(&$geocache [, $userID=0, $initialStatus="RUN"])
Example
<?php
» Using PHPGeocache » Extending PHPGeocache » PHPGeocache class » Geocache class » Waypoint class » GeocacheDB class »Google Maps API Mashup » API documentation PHPGeocache
|
||
