]> git.mxchange.org Git - city.git/commitdiff
Introduced "entities" to bundle lots and sections + added some (not-used) classes
authorRoland Haeder <roland@mxchange.org>
Sat, 1 Aug 2015 13:11:24 +0000 (15:11 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 1 Aug 2015 13:12:12 +0000 (15:12 +0200)
for handling city lots.

'core' updated to latest commit.

Signed-off-by: Roland Haeder <roland@mxchange.org>
36 files changed:
application/city/interfaces/database/frontend/city_entities/.htaccess [new file with mode: 0644]
application/city/interfaces/database/frontend/city_entities/lots/.htaccess [new file with mode: 0644]
application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsWrapper.php [new file with mode: 0644]
application/city/interfaces/database/frontend/city_entities/sections/.htaccess [new file with mode: 0644]
application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsWrapper.php [new file with mode: 0644]
application/city/interfaces/database/frontend/city_sections/.htaccess [deleted file]
application/city/interfaces/database/frontend/city_sections/class_CitySectionsWrapper.php [deleted file]
application/city/interfaces/manager/city/class_ManageableCity.php
application/city/interfaces/manager/city_entities/.htaccess [new file with mode: 0644]
application/city/interfaces/manager/city_entities/class_ManageableCityEntities.php [new file with mode: 0644]
application/city/interfaces/manager/city_entities/lots/.htaccess [new file with mode: 0644]
application/city/interfaces/manager/city_entities/lots/class_ManageableCityLots.php [new file with mode: 0644]
application/city/interfaces/manager/city_entities/sections/.htaccess [new file with mode: 0644]
application/city/interfaces/manager/city_entities/sections/class_ManageableCitySections.php [new file with mode: 0644]
application/city/interfaces/manager/city_sections/.htaccess [deleted file]
application/city/interfaces/manager/city_sections/class_ManageableCitySections.php [deleted file]
application/city/interfaces/manager/class_Manageable.php [new file with mode: 0644]
application/city/interfaces/manager/region/class_ManageableRegion.php
application/city/interfaces/manager/region/class_ManageableRegionMap.php
application/city/main/database/frontend/city_entities/.htaccess [new file with mode: 0644]
application/city/main/database/frontend/city_entities/lots/.htaccess [new file with mode: 0644]
application/city/main/database/frontend/city_entities/lots/class_CityLotsDatabaseWrapper.php [new file with mode: 0644]
application/city/main/database/frontend/city_entities/sections/.htaccess [new file with mode: 0644]
application/city/main/database/frontend/city_entities/sections/class_CitySectionsDatabaseWrapper.php [new file with mode: 0644]
application/city/main/database/frontend/city_sections/.htaccess [deleted file]
application/city/main/database/frontend/city_sections/class_CitySectionsDatabaseWrapper.php [deleted file]
application/city/main/manager/city_entities/.htaccess [new file with mode: 0644]
application/city/main/manager/city_entities/lots/.htaccess [new file with mode: 0644]
application/city/main/manager/city_entities/lots/class_CityLotsManager.php [new file with mode: 0644]
application/city/main/manager/city_entities/sections/.htaccess [new file with mode: 0644]
application/city/main/manager/city_entities/sections/class_CitySectionsManager.php [new file with mode: 0644]
application/city/main/manager/city_sections/.htaccess [deleted file]
application/city/main/manager/city_sections/class_CitySectionsManager.php [deleted file]
application/city/main/manager/class_BaseManager.php
core
db/city_lots/.htaccess [new file with mode: 0644]

diff --git a/application/city/interfaces/database/frontend/city_entities/.htaccess b/application/city/interfaces/database/frontend/city_entities/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/interfaces/database/frontend/city_entities/lots/.htaccess b/application/city/interfaces/database/frontend/city_entities/lots/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsWrapper.php b/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsWrapper.php
new file mode 100644 (file)
index 0000000..7455c38
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * An interface for city lots (database) wrapper
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface CityLotsWrapper extends DatabaseWrapper {
+       /**
+        * Checks if the given city id is found in lots table
+        *
+        * @param       $cityId         City id to check
+        * @return      $isFound        Whether the city id is found
+        */
+       function ifCityHasLots ($cityId);
+}
+
+// [EOF]
+?>
diff --git a/application/city/interfaces/database/frontend/city_entities/sections/.htaccess b/application/city/interfaces/database/frontend/city_entities/sections/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsWrapper.php b/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsWrapper.php
new file mode 100644 (file)
index 0000000..e96eacc
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * An interface for city sections (database) wrapper
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface CitySectionsWrapper extends DatabaseWrapper {
+       /**
+        * Checks if the given city id is found in sections table
+        *
+        * @param       $cityId         City id to check
+        * @return      $isFound        Whether the city id is found
+        */
+       function ifCityHasSections ($cityId);
+
+       /**
+        * Expands the sections table with initial data for given city id
+        *
+        * @param       $cityId         City id to check
+        * @return      $ids            Sections ids from initial expansion
+        */
+       function doInitialCityExpansion ($cityId);
+}
+
+// [EOF]
+?>
diff --git a/application/city/interfaces/database/frontend/city_sections/.htaccess b/application/city/interfaces/database/frontend/city_sections/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/city/interfaces/database/frontend/city_sections/class_CitySectionsWrapper.php b/application/city/interfaces/database/frontend/city_sections/class_CitySectionsWrapper.php
deleted file mode 100644 (file)
index 6075615..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * An interface for city sections (database) wrapper
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface CitySectionsWrapper extends DatabaseWrapper {
-       /**
-        * Checks if the given city id is found in sections table
-        *
-        * @param       $cityId         City id to check
-        * @return      $isFound        Whether the city id is found
-        */
-       function ifCityHasSections ($cityId);
-
-       /**
-        * Expands the sections table with initial data for given city id
-        *
-        * @param       $cityId         City id to check
-        * @return      void
-        */
-       function doInitialCityExpansion ($cityId);
-}
-
-// [EOF]
-?>
index 206e4d442a1c6b08e6d631da327b770dd076e43e..66d91556286b3cad0613d47b865eb594f05b0ed1 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-interface ManageableCity extends FrameworkInterface {
+interface ManageableCity extends Manageable {
        /**
         * Checks whether the current user has already founded a city
         *
diff --git a/application/city/interfaces/manager/city_entities/.htaccess b/application/city/interfaces/manager/city_entities/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/interfaces/manager/city_entities/class_ManageableCityEntities.php b/application/city/interfaces/manager/city_entities/class_ManageableCityEntities.php
new file mode 100644 (file)
index 0000000..127201a
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/**
+ * An interface entities manager
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ManageableCityEntities extends Manageable {
+       /**
+        * Checks whether at least one map requires expansion
+        *
+        * @return      $requiresExpansion      Whether a map requires expansion
+        */
+       function isMapPendingExpansion ();
+
+       /**
+        * Expands any map that requires expansion
+        *
+        * @return      void
+        */
+       function expandMaps ();
+}
+
+// [EOF]
+?>
diff --git a/application/city/interfaces/manager/city_entities/lots/.htaccess b/application/city/interfaces/manager/city_entities/lots/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/interfaces/manager/city_entities/lots/class_ManageableCityLots.php b/application/city/interfaces/manager/city_entities/lots/class_ManageableCityLots.php
new file mode 100644 (file)
index 0000000..696727e
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface lots manager
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ManageableCityLots extends ManageableCityEntities {
+}
+
+// [EOF]
+?>
diff --git a/application/city/interfaces/manager/city_entities/sections/.htaccess b/application/city/interfaces/manager/city_entities/sections/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/interfaces/manager/city_entities/sections/class_ManageableCitySections.php b/application/city/interfaces/manager/city_entities/sections/class_ManageableCitySections.php
new file mode 100644 (file)
index 0000000..ec8c661
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/**
+ * An interface sections manager
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ManageableCitySections extends ManageableCityEntities {
+       /**
+        * Checks whether at least one map requires expansion
+        *
+        * @return      $requiresExpansion      Whether a map requires expansion
+        */
+       function isMapPendingExpansion ();
+
+       /**
+        * Expands any map that requires expansion
+        *
+        * @return      void
+        */
+       function expandMaps ();
+}
+
+// [EOF]
+?>
diff --git a/application/city/interfaces/manager/city_sections/.htaccess b/application/city/interfaces/manager/city_sections/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/city/interfaces/manager/city_sections/class_ManageableCitySections.php b/application/city/interfaces/manager/city_sections/class_ManageableCitySections.php
deleted file mode 100644 (file)
index e38f337..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * An interface sections manager
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface ManageableCitySections extends FrameworkInterface {
-       /**
-        * Checks whether at least one map requires expansion
-        *
-        * @return      $requiresExpansion      Whether a map requires expansion
-        */
-       function isMapPendingExpansion ();
-
-       /**
-        * Expands any map that requires expansion
-        *
-        * @return      void
-        */
-       function expandMaps ();
-}
-
-// [EOF]
-?>
diff --git a/application/city/interfaces/manager/class_Manageable.php b/application/city/interfaces/manager/class_Manageable.php
new file mode 100644 (file)
index 0000000..5daf798
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * A general interface for all manager classes
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Manageable extends FrameworkInterface {
+}
+
+// [EOF]
+?>
index 1e5b7a905992245f167191dbdc97a92dd8275d88..9452bb61438e5db78e336f1a9b1a09dd839a932b 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-interface ManageableRegion extends FrameworkInterface {
+interface ManageableRegion extends Manageable {
        /**
         * Checks whether the current user has already founded a region
         *
index 41dca2c5d721170969414272e252a972849910d6..e8f596a500b50205ee6ca37d8a24a6c08570ae48 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-interface ManageableRegionMap extends FrameworkInterface {
+interface ManageableRegionMap extends Manageable {
        /**
         * Creates a map, if not found yet, for given result which should contain
         * data about the region in question
diff --git a/application/city/main/database/frontend/city_entities/.htaccess b/application/city/main/database/frontend/city_entities/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/database/frontend/city_entities/lots/.htaccess b/application/city/main/database/frontend/city_entities/lots/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/database/frontend/city_entities/lots/class_CityLotsDatabaseWrapper.php b/application/city/main/database/frontend/city_entities/lots/class_CityLotsDatabaseWrapper.php
new file mode 100644 (file)
index 0000000..cafd007
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+/**
+ * A database wrapper for city lots
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class CityLotsDatabaseWrapper extends BaseDatabaseWrapper implements CityLotsWrapper, Registerable {
+       // Constants for database table names
+       const DB_TABLE_CITY_LOTS = 'city_lots';
+
+       // Section id, an referenced city id and lot id
+       const DB_COLUMN_CITY_ID                = 'city_id';
+       const DB_COLUMN_LOT_ID                 = 'lot_id';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this database wrapper by a provided user class
+        *
+        * @return      $wrapperInstance        An instance of the created wrapper class
+        */
+       public static final function createCityLotsDatabaseWrapper () {
+               // Get a new instance
+               $wrapperInstance = new CityLotsDatabaseWrapper();
+
+               // Set (primary!) table name
+               $wrapperInstance->setTableName(self::DB_TABLE_CITY_LOTS);
+
+               // Return the instance
+               return $wrapperInstance;
+       }
+
+       /**
+        * Checks if the given city id is found in lots table
+        *
+        * @param       $cityId         City id to check
+        * @return      $isFound        Whether the city id is found
+        */
+       public function ifCityHasLots ($cityId) {
+               // Get search instance
+               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+               // Search for 'city_id'
+               $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
+
+               /*
+                * Only one entry is enough to find, else this query could run very\
+                * long on large maps.
+                */
+               $searchInstance->setLimit(1);
+
+               // Execute it on database instance
+               $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+               // Check if there is one entry
+               $isFound = ($resultInstance->next() == 1);
+
+               // Return result
+               return $isFound;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/database/frontend/city_entities/sections/.htaccess b/application/city/main/database/frontend/city_entities/sections/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/database/frontend/city_entities/sections/class_CitySectionsDatabaseWrapper.php b/application/city/main/database/frontend/city_entities/sections/class_CitySectionsDatabaseWrapper.php
new file mode 100644 (file)
index 0000000..007129d
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+/**
+ * A database wrapper for city sections
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class CitySectionsDatabaseWrapper extends BaseDatabaseWrapper implements CitySectionsWrapper, Registerable {
+       // Constants for database table names
+       const DB_TABLE_CITY_SECTIONS = 'city_sections';
+
+       // Section id, an referenced city id and lot id
+       const DB_COLUMN_SECTION_ID             = 'city_section_id';
+       const DB_COLUMN_CITY_ID                = 'city_id';
+       const DB_COLUMN_LOT_ID                 = 'lot_id';
+
+       // Section and sub type (e.g. residential, hut)
+       const DB_COLUMN_SECTION_TYPE           = 'section_type';
+       const DB_COLUMN_SECTION_SUB_TYPE       = 'section_sub_type';
+
+       // X-Y-Z position
+       const DB_COLUMN_SECTION_POSITION_X     = 'section_position_x';
+       const DB_COLUMN_SECTION_POSITION_Y     = 'section_position_y';
+       const DB_COLUMN_SECTION_POSITION_Z     = 'section_position_z';
+
+       // Connected neigbouring sections
+       const DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID  = 'section_neighbour_west_id';
+       const DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID  = 'section_neighbour_east_id';
+       const DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID = 'section_neighbour_north_id';
+       const DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID = 'section_neighbour_south_id';
+       const DB_COLUMN_SECTION_NEIGHBOUR_UP_ID    = 'section_neighbour_up_id';
+       const DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID  = 'section_neighbour_down_id';
+
+       // Other settings:
+       // Reserved section (see documentation)
+       const DB_COLUMN_SECTION_RESERVED       = 'section_reserved';
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this database wrapper by a provided user class
+        *
+        * @return      $wrapperInstance        An instance of the created wrapper class
+        */
+       public static final function createCitySectionsDatabaseWrapper () {
+               // Get a new instance
+               $wrapperInstance = new CitySectionsDatabaseWrapper();
+
+               // Set (primary!) table name
+               $wrapperInstance->setTableName(self::DB_TABLE_CITY_SECTIONS);
+
+               // Return the instance
+               return $wrapperInstance;
+       }
+
+       /**
+        * Checks if the given city id is found in sections table
+        *
+        * @param       $cityId         City id to check
+        * @return      $isFound        Whether the city id is found
+        */
+       public function ifCityHasSections ($cityId) {
+               // Get search instance
+               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+               // Search for 'city_id'
+               $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
+
+               /*
+                * Only one entry is enough to find, else this query could run very\
+                * long on large maps.
+                */
+               $searchInstance->setLimit(1);
+
+               // Execute it on database instance
+               $resultInstance = $this->doSelectByCriteria($searchInstance);
+
+               // Check if there is one entry
+               $isFound = ($resultInstance->next() == 1);
+
+               // Return result
+               return $isFound;
+       }
+
+       /**
+        * Expands the sections table with initial data for given city id
+        *
+        * @param       $cityId         City id to check
+        * @return      $ids            Sections ids from initial expansion
+        */
+       public function doInitialCityExpansion ($cityId) {
+               // Make sure this city has no sections
+               assert(!$this->ifCityHasSections($cityId));
+
+               // @TODO Unfinished
+               $this->partialStub('cityId=' . $cityId . ' - UNFINISHED!');
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/database/frontend/city_sections/.htaccess b/application/city/main/database/frontend/city_sections/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/city/main/database/frontend/city_sections/class_CitySectionsDatabaseWrapper.php b/application/city/main/database/frontend/city_sections/class_CitySectionsDatabaseWrapper.php
deleted file mode 100644 (file)
index bb9effe..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/**
- * A database wrapper for city informations
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class CitySectionsDatabaseWrapper extends BaseDatabaseWrapper implements CitySectionsWrapper, Registerable {
-       // Constants for database table names
-       const DB_TABLE_CITY_SECTIONS = 'city_sections';
-
-       // Section id, an referenced city id and lot id
-       const DB_COLUMN_SECTION_ID             = 'city_section_id';
-       const DB_COLUMN_CITY_ID                = 'city_id';
-       const DB_COLUMN_LOT_ID                 = 'lot_id';
-
-       // Section and sub type (e.g. residential, hut)
-       const DB_COLUMN_SECTION_TYPE           = 'section_type';
-       const DB_COLUMN_SECTION_SUB_TYPE       = 'section_sub_type';
-
-       // X-Y-Z position
-       const DB_COLUMN_SECTION_POSITION_X     = 'section_position_x';
-       const DB_COLUMN_SECTION_POSITION_Y     = 'section_position_y';
-       const DB_COLUMN_SECTION_POSITION_Z     = 'section_position_z';
-
-       // Connected neigbouring sections
-       const DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID  = 'section_neighbour_west_id';
-       const DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID  = 'section_neighbour_east_id';
-       const DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID = 'section_neighbour_north_id';
-       const DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID = 'section_neighbour_south_id';
-       const DB_COLUMN_SECTION_NEIGHBOUR_UP_ID    = 'section_neighbour_up_id';
-       const DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID  = 'section_neighbour_down_id';
-
-       // Other settings:
-       // Reserved section (see documentation)
-       const DB_COLUMN_SECTION_RESERVED       = 'section_reserved';
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this database wrapper by a provided user class
-        *
-        * @return      $wrapperInstance        An instance of the created wrapper class
-        */
-       public static final function createCitySectionsDatabaseWrapper () {
-               // Get a new instance
-               $wrapperInstance = new CitySectionsDatabaseWrapper();
-
-               // Set (primary!) table name
-               $wrapperInstance->setTableName(self::DB_TABLE_CITY_SECTIONS);
-
-               // Return the instance
-               return $wrapperInstance;
-       }
-
-       /**
-        * Checks if the given city id is found in sections table
-        *
-        * @param       $cityId         City id to check
-        * @return      $isFound        Whether the city id is found
-        */
-       public function ifCityHasSections ($cityId) {
-               // Get search instance
-               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
-               // Search for 'city_id'
-               $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId);
-
-               /*
-                * Only one entry is enough to find, else this query could run very\
-                * long on large maps.
-                */
-               $searchInstance->setLimit(1);
-
-               // Execute it on database instance
-               $resultInstance = $this->doSelectByCriteria($searchInstance);
-
-               // Check if there is one entry
-               $isFound = ($resultInstance->next() == 1);
-
-               // Return result
-               return $isFound;
-       }
-
-       /**
-        * Expands the sections table with initial data for given city id
-        *
-        * @param       $cityId         City id to check
-        * @return      void
-        */
-       public function doInitialCityExpansion ($cityId) {
-               // Make sure this city has no sections
-               assert(!$this->ifCityHasSections($cityId));
-
-               // @TODO Unfinished
-               $this->partialStub('cityId=' . $cityId . ' - UNFINISHED!');
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/city/main/manager/city_entities/.htaccess b/application/city/main/manager/city_entities/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/manager/city_entities/lots/.htaccess b/application/city/main/manager/city_entities/lots/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/manager/city_entities/lots/class_CityLotsManager.php b/application/city/main/manager/city_entities/lots/class_CityLotsManager.php
new file mode 100644 (file)
index 0000000..5e25cc4
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+/**
+ * A city lots manager
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class CityLotsManager extends BaseFrameworkSystem implements ManageableCityLots, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $managerInstance        An instance of a ManageableCityLots class
+        */
+       public final static function createCityLotsManager () {
+               // Get new instance
+               $managerInstance = new CityLotsManager();
+
+               // Get database wrapper
+               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_lots_db_wrapper_class');
+
+               // And set it here
+               $managerInstance->setWrapperInstance($wrapperInstance);
+
+               // Return the prepared instance
+               return $managerInstance;
+       }
+
+       /**
+        * Checks whether at least one map requires expansion
+        *
+        * @return      $requiresExpansion      Whether a map requires expansion
+        * @todo        0% done
+        */
+       public function isMapPendingExpansion () {
+               // Default is no expansion is needed
+               $requireExpansion = FALSE;
+
+               // First, a simple check if the lots table contains any entries at all
+               if ($this->getWrapperInstance()->countTotalRows() == 0) {
+                       // This definedly requires expansion
+                       $requireExpansion = TRUE;
+               } // END - if
+
+               // Return status
+               return $requireExpansion;
+       }
+
+       /**
+        * Expands any map that requires expansion
+        *
+        * @return      void
+        * @todo 0% done
+        */
+       public function expandMaps () {
+               // Get a city info wrapper instance
+               $cityWrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
+
+               // Get all city ids from it
+               $cityIds = $cityWrapperInstance->getAllCityIds();
+
+               // Now check all ids
+               foreach ($cityIds as $cityId) {
+                       // Does this id have any lots
+                       if (!$this->getWrapperInstance()->ifCityHasLots($cityId)) {
+                               // Nothing found, so it is a brand-new city that needs first initialization
+                               $sections = $this->getWrapperInstance()->doInitialCityExpansion($cityId);
+                       } else {
+                               // @TODO Maybe some expansion is needed
+                       }
+               } // END - foreach
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/manager/city_entities/sections/.htaccess b/application/city/main/manager/city_entities/sections/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/city/main/manager/city_entities/sections/class_CitySectionsManager.php b/application/city/main/manager/city_entities/sections/class_CitySectionsManager.php
new file mode 100644 (file)
index 0000000..fda32de
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+/**
+ * A city sections manager
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2015 City Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+class CitySectionsManager extends BaseFrameworkSystem implements ManageableCitySections, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $managerInstance        An instance of a ManageableCitySections class
+        */
+       public final static function createCitySectionsManager () {
+               // Get new instance
+               $managerInstance = new CitySectionsManager();
+
+               // Get database wrapper
+               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_sections_db_wrapper_class');
+
+               // And set it here
+               $managerInstance->setWrapperInstance($wrapperInstance);
+
+               // Return the prepared instance
+               return $managerInstance;
+       }
+
+       /**
+        * Checks whether at least one map requires expansion
+        *
+        * @return      $requiresExpansion      Whether a map requires expansion
+        * @todo        0% done
+        */
+       public function isMapPendingExpansion () {
+               // Default is no expansion is needed
+               $requireExpansion = FALSE;
+
+               // First, a simple check if the sections table contains any entries at all
+               if ($this->getWrapperInstance()->countTotalRows() == 0) {
+                       // This definedly requires expansion
+                       $requireExpansion = TRUE;
+               } // END - if
+
+               // Return status
+               return $requireExpansion;
+       }
+
+       /**
+        * Expands any map that requires expansion
+        *
+        * @return      void
+        * @todo 0% done
+        */
+       public function expandMaps () {
+               // Get a city info wrapper instance
+               $cityWrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
+
+               // Get all city ids from it
+               $cityIds = $cityWrapperInstance->getAllCityIds();
+
+               // Now check all ids
+               foreach ($cityIds as $cityId) {
+                       // Does this id have any sections
+                       if (!$this->getWrapperInstance()->ifCityHasSections($cityId)) {
+                               // Nothing found, so it is a brand-new city that needs first initialization
+                               $sections = $this->getWrapperInstance()->doInitialCityExpansion($cityId);
+                       } else {
+                               // @TODO Maybe some expansion is needed
+                       }
+               } // END - foreach
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/city/main/manager/city_sections/.htaccess b/application/city/main/manager/city_sections/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/city/main/manager/city_sections/class_CitySectionsManager.php b/application/city/main/manager/city_sections/class_CitySectionsManager.php
deleted file mode 100644 (file)
index b05ab91..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-/**
- * A city sections manager
- *
- * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2015 City Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-class CitySectionsManager extends BaseFrameworkSystem implements ManageableCitySections, Registerable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this class
-        *
-        * @return      $managerInstance        An instance of a ManageableCitySections class
-        */
-       public final static function createCitySectionsManager () {
-               // Get new instance
-               $managerInstance = new CitySectionsManager();
-
-               // Get database wrapper
-               $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_sections_db_wrapper_class');
-
-               // And set it here
-               $managerInstance->setWrapperInstance($wrapperInstance);
-
-               // Return the prepared instance
-               return $managerInstance;
-       }
-
-       /**
-        * Checks whether at least one map requires expansion
-        *
-        * @return      $requiresExpansion      Whether a map requires expansion
-        * @todo        0% done
-        */
-       public function isMapPendingExpansion () {
-               // Default is no expansion is needed
-               $requireExpansion = FALSE;
-
-               // First, a simple check if the sections table contains any entries at all
-               if ($this->getWrapperInstance()->countTotalRows() == 0) {
-                       // This definedly requires expansion
-                       $requireExpansion = TRUE;
-               } // END - if
-
-               // Return status
-               return $requireExpansion;
-       }
-
-       /**
-        * Expands any map that requires expansion
-        *
-        * @return      void
-        * @todo 0% done
-        */
-       public function expandMaps () {
-               // Get a city info wrapper instance
-               $cityWrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
-
-               // Get all city ids from it
-               $cityIds = $cityWrapperInstance->getAllCityIds();
-
-               // Now check all ids
-               foreach ($cityIds as $cityId) {
-                       // Does this id have any sections
-                       if (!$this->getWrapperInstance()->ifCityHasSections($cityId)) {
-                               // Nothing found, so it is a brand-new city that needs first initialization
-                               $this->getWrapperInstance()->doInitialCityExpansion($cityId);
-                       } else {
-                               // @TODO Maybe some expansion is needed
-                       }
-               } // END - foreach
-       }
-}
-
-// [EOF]
-?>
index 69de06b703d1abdb43cc464a17899873d8c6596c..ec3e690ee19bd34db433dd0916fcfbddc0d5424d 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseManager extends BaseCitySystem implements Registerable {
+class BaseManager extends BaseCitySystem implements Manageable, Registerable {
        /**
         * Protected constructor
         *
diff --git a/core b/core
index d939a8df01d12151255dc67950f1336fa215e2ab..23aa45d4a6205e26184190ca446316d06a9b4648 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit d939a8df01d12151255dc67950f1336fa215e2ab
+Subproject commit 23aa45d4a6205e26184190ca446316d06a9b4648
diff --git a/db/city_lots/.htaccess b/db/city_lots/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all