Source of file BrowseContinentsPage.php
Size: 3,627 Bytes - Last Modified: 2021-12-23T10:41:46+00:00
/var/www/docs.ssmods.com/process/src/code/BrowseContinentsPage.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 | <?php class BrowseContinentsPage extends BrowseAbstractPage { /** * Standard SS static **/ public static $icon = "geobrowser/images/treeicons/BrowseContinentsPage"; /** * Standard SS static **/ public static $allowed_children = array("BrowseCountriesPage"); /** * Standard SS static **/ public static $default_child = "BrowseCountriesPage"; /** * Standard SS static **/ public static $default_parent = "BrowseWorldPage"; /** * Standard SS Static **/ public static $can_be_root = false; /** * Standard SS Static **/ public static $defaults = array( "ShowInMenus" => true ); /** * name of the level **/ public function GeoLevelName() { return "Continents"; } /** * number of the level **/ public function GeoLevelNumber() { return 0; } /** * Standard SS Method * setup records **/ public function requireDefaultRecords() { $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`"; parent::requireDefaultRecords(); $parents = DataObject::get("BrowseContinentsPage"); if ($parents && isset($_GET["geobuild"]) && $_GET["geobuild"] && $this->allowBrowseChildren()) { foreach ($parents as $parent) { if ($parent->CreateChildren && $parent->HiddenDataID) { echo "<li>creating countries for ".$parent->Title."<ul>"; $countries = $this->getDataFromTable("countries", "ContinentID = ".$parent->HiddenDataID, "Country"); foreach ($countries as $country) { if (!DataObject::get_one("BrowseCountriesPage", "{$bt}HiddenDataID{$bt} = ".$country["CountryID"])) { $page = new BrowseCountriesPage(); $page->CreateCountry($country, $parent); $page->destroy(); } } echo "</ul></li>"; } } } } /** * create a continent * @param array - $contentint, continent data * @param Object - $parent, a BrowseWorldPage object that will be the parent page of the Continent. **/ public function CreateContinent(array $continent, BrowseWorldPage $parent) { $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`"; if ($parent && isset($continent["Continent"])) { $name = htmlentities($continent["Continent"]); if ($name) { if (isset($_GET["geobuild"])) { echo "<li>creating ".$name."</li>"; } $this->ParentID = $parent->ID; $this->Title = $name; $this->MetaTitle = $name; $this->MenuTitle = $name; $this->HiddenDataID = $continent["ContinentID"]; $this->CreateChildren = $parent->CreateAllChildren; $this->CreateAllChildren = $parent->CreateAllChildren; $this->writeToStage('Stage'); $this->publish('Stage', 'Live'); $this->flushCache(); } else { if (isset($_GET["geobuild"])) { debug::show("name does not exist"); } } } else { if (isset($_GET["geobuild"])) { debug::show("Parent does not exist"); } } } } class BrowseContinentsPage_Controller extends BrowseAbstractPage_Controller { } |