| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | class BrowseCountriesPage extends BrowseAbstractPage | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |      * Standard SS static | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |     public static $icon = "geobrowser/images/treeicons/BrowseCountriesPage"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |      * Standard SS static | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     public static $allowed_children = array("BrowseRegionsPage"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      * Standard SS static | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     public static $default_child = "BrowseRegionsPage"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * Standard SS static | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     public static $default_parent = "BrowseContinentsPage"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * Standard SS static | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     public static $can_be_root = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * Standard SS static | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     public static $db = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         "Country" => "Varchar(50)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         "ISO2" => "Varchar(2)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         "Internet" => "Varchar(2)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         "Capital" => "Varchar(25)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         "NationalitySingular" => "Varchar(35)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         "NationalityPlural" => "Varchar(35)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         "Currency" => "Varchar(30)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         "CurrencyCode" => "Varchar(3)" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         "Population" => "Int" , | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         "AdditionalTitle" => "Varchar(50)" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * Standard SS Static | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     public static $defaults = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         "ShowInMenus" => false | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * Standard SS Method | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 57 |  |  |      **/ | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |     public function getCMSFields() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |         $fields = parent::getCMSFields(); | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |         return $fields; | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     public function GeoLevelName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         return "Countries"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     public function GeoLevelNumber() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         return 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      * Standard SS Method | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * Setup records | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     public function requireDefaultRecords() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         parent::requireDefaultRecords(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         $parents = DataObject::get("BrowseCountriesPage"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         if ($parents && isset($_GET["geobuild"]) && $_GET["geobuild"] && $this->allowBrowseChildren()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |             foreach ($parents as $parent) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |                 if ($parent->HiddenDataID) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |                     echo "<li>creating regions for ".$parent->Title."<ul>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |                     $regions = $this->getDataFromTable("regions", "CountryID = ".$parent->HiddenDataID, "Region"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |                     foreach ($regions as $region) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |                         if (!DataObject::get("BrowseRegionsPage", "{$bt}BrowseAbstractPage{$bt}.{$bt}HiddenDataID{$bt} = ".$region["RegionID"])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |                             $page = new BrowseRegionsPage(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |                             $page->CreateRegion($region, $parent); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |                             $page->destroy(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |                     echo "</ul></li>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |                     if (isset($_GET["geobuild"])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |                         debug::show("Parent does not exist"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |      * Create a country based on an array and a Continent Parent | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |      **/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     public function CreateCountry(array $country, BrowseContinentsPage $parent) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |         if ($parent && isset($country["Country"])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |             $name = htmlentities($country["Country"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |             if ($name) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |                 if (isset($_GET["geobuild"])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |                     echo "<li>creating ".$name."</li>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |                 $this->ParentID = $parent->ID; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |                 $this->Title = $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |                 $this->MetaTitle = $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |                 $this->MenuTitle = $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |                 $this->HiddenDataID = $country["CountryID"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |                 $this->ISO2 = $country["ISO2"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |                 $this->Internet = $country["Internet"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |                 $this->Capital = htmlentities($country["Capital"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |                 $this->NationalitySingular = htmlentities($country["NationalitySingular"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |                 $this->NationalityPlural = htmlentities($country["NationalityPlural"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |                 $this->Currency = $country["Currency"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |                 $this->CurrencyCode = $country["CurrencyCode"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |                 $this->Population = $country["Population"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |                 $this->AdditionalTitle = htmlentities($country["Title"]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |                 $this->CreateChildren = $parent->CreateAllChildren; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |                 $this->CreateAllChildren = $parent->CreateAllChildren; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |                 $this->writeToStage('Stage'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |                 $this->publish('Stage', 'Live'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |                 $this->flushCache(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |                 if (isset($_GET["geobuild"])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |                     debug::show("name does not exist"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             if (isset($_GET["geobuild"])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |                 debug::show("Parent does not exist"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | class BrowseCountriesPage_Controller extends BrowseAbstractPage_Controller | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 153 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 154 |  |  |  | 
            
                        
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.