Source of file BrowseSuburbPage.php
Size: 2,726 Bytes - Last Modified: 2021-12-23T10:41:46+00:00
/var/www/docs.ssmods.com/process/src/code/BrowseSuburbPage.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 | <?php /** * There is no data for this page. * We can use Google Maps to choose suburbs...? * * **/ class BrowseSuburbPage extends BrowseAbstractPage { /** * Standard SS Static **/ public static $icon = "geobrowser/images/treeicons/BrowseSuburbPage"; /** * Standard SS static **/ public static $db = array( "Longitude" => "Double(12,7)", "Lattitude" => "Double(12,7)" ); /** * Standard SS Static **/ public static $default_parent = "BrowseCitiesPage"; /** * Standard SS Static **/ public static $can_be_root = false; /** * Standard SS Static **/ public static $defaults = array( "ShowInMenus" => false ); /** * Standard SS method * CMS Fields **/ public function getCMSFields() { $fields = parent::getCMSFields(); return $fields; } /** * Name of the level. **/ public function GeoLevelName() { return "Suburbs"; } /** * number of the level. **/ public function GeoLevelNumber() { return 4; } /** * Creates a region... called from BrowseCountriesPage * *@param Array $googleMapAddressArray - array of google Map Address Data *@param Object $parent - a BrowseCountriesPage object *@return Object | false - returns the BrowseSuburbPage if there is one. * **/ public static function create_suburb($googleMapAddressArray, BrowseCitiesPage $parent) { if ($parent && isset($googleMapAddressArray["LocalityName"]) && isset($googleMapAddressArray[0]) && isset($googleMapAddressArray[1])) { $name = htmlentities($googleMapAddressArray["LocalityName"]); if ($name) { $page = DataObject::get("BrowseSuburbPage", "\"Title\" = '".$name."' AND \"ParentID\" = ".$parent->ID); if (!$page) { $page = new BrowseSuburbPage(); $page->ParentID = $parent->ID; $page->Title = $name; $page->MetaTitle = $name; $page->MenuTitle = $name; $page->Longitude = $googleMapAddressArray[0]; $page->Latitude = $googleMapAddressArray[1]; $page->writeToStage('Stage'); $page->publish('Stage', 'Live'); $page->flushCache(); } $page = DataObject::get("BrowseSuburbPage", "\"Title\" = '".$name."' AND \"ParentID\" = ".$parent->ID); } } } } class BrowseSuburbPage_Controller extends BrowseAbstractPage_Controller { } |