for handling city lots.
'core' updated to latest commit.
Signed-off-by: Roland Haeder <roland@mxchange.org>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?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]
-?>
* 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
*
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?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]
-?>
--- /dev/null
+<?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]
+?>
* 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
*
* 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
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?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]
-?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?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]
-?>
* 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
*
-Subproject commit d939a8df01d12151255dc67950f1336fa215e2ab
+Subproject commit 23aa45d4a6205e26184190ca446316d06a9b4648
--- /dev/null
+Deny from all