]> git.mxchange.org Git - city.git/commitdiff
Added initial database frontend class for city maps + its interface.
authorRoland Haeder <roland@mxchange.org>
Wed, 1 Jul 2015 01:19:52 +0000 (03:19 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 1 Jul 2015 01:31:21 +0000 (03:31 +0200)
Signed-off-by: Roland Haeder <roland@mxchange.org>
12 files changed:
application/city/config.php
application/city/interfaces/database/frontend/city_map/.htaccess [new file with mode: 0644]
application/city/interfaces/database/frontend/city_map/class_CityMapWrapper.php [new file with mode: 0644]
application/city/interfaces/manager/city_map/.htaccess [new file with mode: 0644]
application/city/interfaces/manager/city_map/class_ManageableCityMap.php [new file with mode: 0644]
application/city/interfaces/manager/map/.htaccess [deleted file]
application/city/interfaces/manager/map/class_ManageableMap.php [deleted file]
application/city/main/city_daemon/class_BaseCityDaemon.php
application/city/main/database/frontend/city_map/.htaccess [new file with mode: 0644]
application/city/main/database/frontend/city_map/class_CityMapDatabaseWrapper.php [new file with mode: 0644]
application/city/main/manager/city_map/class_CityMapManager.php
db/city_map/.htaccess [new file with mode: 0644]

index 5e98a6ad9db6cec9d9266deedc56e59b0a60ac94..9f837100d305906157817ab008001599f7f2fc37 100644 (file)
@@ -49,6 +49,9 @@ $cfg->setConfigEntry('region_info_db_wrapper_class', 'RegionInformationDatabaseW
 // CFG: REGION-MAP-DB-WRAPPER-CLASS
 $cfg->setConfigEntry('region_map_db_wrapper_class', 'RegionMapDatabaseWrapper');
 
+// CFG: CITY-MAP-DB-WRAPPER-CLASS
+$cfg->setConfigEntry('city_map_db_wrapper_class', 'CityMapDatabaseWrapper');
+
 // CFG: CITY-INIT-STATE-CLASS
 $cfg->setConfigEntry('city_init_state_class', 'CityInitState');
 
diff --git a/application/city/interfaces/database/frontend/city_map/.htaccess b/application/city/interfaces/database/frontend/city_map/.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_map/class_CityMapWrapper.php b/application/city/interfaces/database/frontend/city_map/class_CityMapWrapper.php
new file mode 100644 (file)
index 0000000..a7017dc
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface for city maps (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 CityMapWrapper extends DatabaseWrapper {
+}
+
+// [EOF]
+?>
diff --git a/application/city/interfaces/manager/city_map/.htaccess b/application/city/interfaces/manager/city_map/.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_map/class_ManageableCityMap.php b/application/city/interfaces/manager/city_map/class_ManageableCityMap.php
new file mode 100644 (file)
index 0000000..dc7172c
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * An interface map 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 ManageableCityMap extends FrameworkInterface {
+       /**
+        * Checks whether at least one map requires expansion
+        *
+        * @return      $requiresExpansion      Whether a map requires expansion
+        */
+       function isMapPendingExpansion ();
+}
+
+// [EOF]
+?>
diff --git a/application/city/interfaces/manager/map/.htaccess b/application/city/interfaces/manager/map/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/city/interfaces/manager/map/class_ManageableMap.php b/application/city/interfaces/manager/map/class_ManageableMap.php
deleted file mode 100644 (file)
index fdea29d..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * An interface map 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 ManageableMap extends FrameworkInterface {
-}
-
-// [EOF]
-?>
index 3aeadce70609c3b45a2e259c6c892594a1f08f94..ed5f3276af7ebe5b8b1a462925c7ac3ddc0ad820 100644 (file)
@@ -260,7 +260,8 @@ class BaseCityDaemon extends BaseCitySystem implements Updateable, AddableCriter
                // Get map manager
                $mapInstance = ManagerFactory::createManagerByType('city_map');
 
-               $this->partialStub('Please add something here.');
+               // Call it's method and return value
+               return $mapInstance->isMapPendingExpansion();
        }
 }
 
diff --git a/application/city/main/database/frontend/city_map/.htaccess b/application/city/main/database/frontend/city_map/.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_map/class_CityMapDatabaseWrapper.php b/application/city/main/database/frontend/city_map/class_CityMapDatabaseWrapper.php
new file mode 100644 (file)
index 0000000..657a86a
--- /dev/null
@@ -0,0 +1,56 @@
+<?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 CityMapDatabaseWrapper extends BaseDatabaseWrapper implements CityMapWrapper, Registerable {
+       // Constants for database table names
+       const DB_TABLE_CITY_MAP = 'city_map';
+
+       /**
+        * 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 createCityMapDatabaseWrapper () {
+               // Get a new instance
+               $wrapperInstance = new CityMapDatabaseWrapper();
+
+               // Set (primary!) table name
+               $wrapperInstance->setTableName(self::DB_TABLE_CITY_MAP);
+
+               // Return the instance
+               return $wrapperInstance;
+       }
+}
+
+// [EOF]
+?>
index 2b5cbe1b9dd7fa3114ece1e52b8dae5331a99319..cfee707da041a18045b89b07e0973443b016f7c0 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 CityMapManager extends BaseFrameworkSystem implements ManageableMap, Registerable {
+class CityMapManager extends BaseFrameworkSystem implements ManageableCityMap, Registerable {
        /**
         * Protected constructor
         *
@@ -35,15 +35,31 @@ class CityMapManager extends BaseFrameworkSystem implements ManageableMap, Regis
        /**
         * Creates an instance of this class
         *
-        * @return      $managerInstance        An instance of a ManageableMap class
+        * @return      $managerInstance        An instance of a ManageableCityMap class
         */
        public final static function createCityMapManager () {
                // Get new instance
                $managerInstance = new CityMapManager();
 
+               // Get database wrapper
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('city_map_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 () {
+               $this->partialStub('Please implement this method.');
+       }
 }
 
 // [EOF]
diff --git a/db/city_map/.htaccess b/db/city_map/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all