application/ship-simu/main/actions/web/class_WebShipSimuLoginStatusProblemAction.php -text
application/ship-simu/main/actions/web/class_WebShipSimuLoginWelcomeAction.php -text
application/ship-simu/main/bank/.htaccess -text
-application/ship-simu/main/bank/class_MoneyBank.php -text
+application/ship-simu/main/bank/class_BaseBank.php -text
+application/ship-simu/main/bank/money/class_MoneyBank.php -text
application/ship-simu/main/class_ -text
application/ship-simu/main/class_BasePersonell.php -text
application/ship-simu/main/class_BaseSimulator.php -text
application/ship-simu/main/menu/class_ShipSimuStatusMenu.php -text
application/ship-simu/main/menu/government/.htaccess -text
application/ship-simu/main/menu/government/class_ShipSimuGovernmentFailedAreaMenu.php -text
+application/ship-simu/main/opening/.htaccess -text
+application/ship-simu/main/opening/bank/.htaccess -text
+application/ship-simu/main/opening/bank/class_MoneyBankRealtimeOpening.php -text
+application/ship-simu/main/opening/class_ -text
+application/ship-simu/main/opening/class_BaseOpening.php -text
application/ship-simu/main/parts/.htaccess -text
application/ship-simu/main/parts/class_BaseShipPart.php -text
application/ship-simu/main/parts/maschineroom/.htaccess -text
// CFG: GOVERNMENT-FAILED-AREA-MENU-CLASS
$cfg->setConfigEntry('government_failed_area_menu_class', 'ShipSimuGovernmentFailedAreaMenu');
+// CFG: MONEYBANK-ACTIVATED
+$cfg->setConfigEntry('moneybank_activated', 'Y');
+
+// CFG: MONEYBANK-OPENING-CLASS
+$cfg->setConfigEntry('moneybank_opening_class', 'MoneyBankRealtimeOpening');
+
// [EOF]
?>
--- /dev/null
+<?php
+/**
+ * A general bank class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ * @todo Find an instance for all banks and move the abstract functions there
+ *
+ * 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/>.
+ */
+abstract class BaseBank extends BaseFrameworkSystem {
+ /**
+ * Protected constructor
+ *
+ * @param $className The class' real name
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Checks wether the bank lends more money to the current user
+ *
+ * @return $lendsMoreMoney Wether this bank lends more money to the user
+ */
+ public abstract function ifBankLendsMoreMoney ();
+
+ /**
+ * Checks wethert the current user has maximum allowed credits with this bank
+ *
+ * @return $hasMaximumCredits Wether the user has maximum allowed credits
+ */
+ public abstract function ifUserHasMaxCredits ();
+
+ /**
+ * Checks wether this money bank has opened
+ *
+ * @return $hasOpened Wether this money bank has opened
+ */
+ public abstract function ifMoneyBankHasOpened ();
+}
+
+// [EOF]
+?>
+++ /dev/null
-<?php
-/**
- * A money bank which may lend points to the user
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu 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 MoneyBank extends BaseFrameworkSystem implements Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this money bank class
- *
- * @param $userInstance A class instance of a user object
- * @return $bankInstance An instance of this class
- */
- public final static function createMoneyBank (ManageableAccount $userInstance) {
- // Get a new instance
- $moneyInstance = new MoneyBank();
-
- // Set the user instance
- $moneyInstance->setUserInstance($userInstance);
-
- // Return the prepared instance
- return $moneyInstance;
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+<?php
+/**
+ * A money bank which may lend points to the user
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu 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 MoneyBank extends BaseBank implements Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this money bank class
+ *
+ * @param $userInstance A class instance of a user object
+ * @return $bankInstance An instance of this class
+ */
+ public final static function createMoneyBank (ManageableAccount $userInstance) {
+ // Get a new instance
+ $moneyInstance = new MoneyBank();
+
+ // Set the user instance
+ $moneyInstance->setUserInstance($userInstance);
+
+ // Return the prepared instance
+ return $moneyInstance;
+ }
+
+ /**
+ * Checks wether the bank lends more money to the current user
+ *
+ * @return $lendsMoreMoney Wether this bank lends more money to the user
+ */
+ public function ifBankLendsMoreMoney () {
+ $this->partialStub();
+ }
+
+ /**
+ * Checks wethert the current user has maximum allowed credits with this bank
+ *
+ * @return $hasMaximumCredits Wether the user has maximum allowed credits
+ */
+ public function ifUserHasMaxCredits () {
+ $this->partialStub();
+ }
+
+ /**
+ * Checks wether this money bank has opened
+ *
+ * @return $hasOpened Wether this money bank has opened
+ */
+ public function ifMoneyBankHasOpened () {
+ // Has not opened by default
+ $hasOpened = false;
+
+ // Is the money bank activated in config?
+ if ($this->getConfigInstance()->getConfigEntry('moneybank_activated')) {
+ // Okay, does the user ask within the opening times? To find this out we need a OpeningTimes class
+ $openingInstance = ObjectFactory::createObjectByConfiguredName('moneybank_opening_class', array($this));
+
+ // Then we simply "ask" the opening time instance if the user asks within the opening time
+ $hasOpened = $openingInstance->ifWithinOpeningTimes();
+ } // END - if
+
+ // Return status
+ return $hasOpened;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class for the money bank's opening times
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu 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 MoneyBankRealtimeOpening extends BaseOpening {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this opening time class
+ *
+ * @param $bankInstance An instance of a money bank
+ * @return $openeningInstance An instance of this class
+ */
+ public final static function createMoneyBankRealtimeOpening (BaseBank $bankInstance) {
+ // Get a new instance
+ $openingInstance = new MoneyBankRealtimeOpening();
+
+ // Set the bank instance here
+ $openingInstance->setBankInstance($bankInstance);
+
+ // Return the prepared instance
+ return $openingInstance;
+ }
+
+ /**
+ * Checks wether we are within the opening times
+ *
+ * @return $withinOpeningTimes Wether we are within opening times
+ */
+ public function ifWithinOpeningTimes () {
+ $this->partialStub();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A ??? opening times class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu 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 ???Opening extends BaseOpening {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this opening time class
+ *
+ * @return $openeningInstance An instance of this class
+ */
+ public final static function create???Opening () {
+ // Get a new instance
+ $openeningInstance = new ???Opening();
+
+ // Return the prepared instance
+ return $openeningInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general opening time class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu 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/>.
+ */
+abstract class BaseOpening extends BaseFrameworkSystem {
+ /**
+ * A bank instance
+ */
+ private $bankInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @param $className The class' real name
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Setter for bank instance
+ *
+ * @param $bankInstance An instance of a bank
+ * @return void
+ */
+ protected final function setBankInstance (BaseBank $bankInstance) {
+ $this->bankInstance = $bankInstance;
+ }
+
+ /**
+ * Checks wether we are within the opening times
+ *
+ * @return $withinOpeningTimes Wether we are within opening times
+ */
+ public abstract function ifWithinOpeningTimes ();
+}
+
+// [EOF]
+?>
parent::__construct($className);
}
+ /**
+ * Initializes the bank instance
+ *
+ * @return $bankInstance A bank instance wether just created or from registry
+ */
+ protected function initBankInstance () {
+ // Init instance
+ $bankInstance = null;
+
+ try {
+ // Get a money bank instance from registry
+ $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
+
+ // Is it there?
+ if (is_null($bankInstance)) {
+ // Then create a new one
+ $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this));
+
+ // Store it in registry
+ Registry::getRegistry()->addInstance('money_bank', $bankInstance);
+ } // END - if
+
+ // Return the instance
+ return $bankInstance;
+ }
+
+ /**
+ * Initializes the government instance
+ *
+ * @return $governmentInstance A government instance
+ */
+ protected function initGovernmentInstance () {
+ // Init instance
+ $governmentInstance = null;
+
+ try {
+ // First get a government instance from registry
+ $governmentInstance = Registry::getRegistry()->getInstance('government');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
+
+ // Is it there?
+ if (is_null($governmentInstance)) {
+ // Then create a new one
+ $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this));
+
+ // Store it in registry
+ Registry::getRegistry()->addInstance('government', $governmentInstance);
+ } // END - if
+
+ // Return the prepared instance
+ return $governmentInstance;
+ }
+
/**
* Checks wether the user has reached maximum allowed companies to found
*
// By default they want to help.
$ifGovHelps = true;
- // Init instance
- $governmentInstance = null;
-
- try {
- // First get a government instance from registry
- $governmentInstance = Registry::getRegistry()->getInstance('government');
- } catch (NullPointerException $e) {
- // Instance not found in registry
- // @TODO We should log this exception later
- }
-
- // Is it there?
- if (is_null($governmentInstance)) {
- // Then create a new one
- $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this));
-
- // Store it in registry
- Registry::getRegistry()->addInstance('government', $governmentInstance);
- } // END - if
+ // Initialize government instance
+ $governmentInstance = $this->initGovernmentInstance();
// Then ask the government if they want to pay a "startup help" to the user
- if ($governmentInstance->ifGovernmentAlreadyPayedTraining()) {
- // Training already given!
- $ifGovHelps = false;
- } // END - if
+ $ifGovHelps = ($governmentInstance->ifGovernmentAlreadyPayedTraining());
// Return result here
return $ifGovHelps;
// By default they want to help.
$ifGovHelps = true;
- // Init instance
- $governmentInstance = null;
-
- try {
- // First get a government instance from registry
- $governmentInstance = Registry::getRegistry()->getInstance('government');
- } catch (NullPointerException $e) {
- // Instance not found in registry
- // @TODO We should log this exception later
- }
-
- // Is it there?
- if (is_null($governmentInstance)) {
- // Then create a new one
- $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this));
-
- // Store it in registry
- Registry::getRegistry()->addInstance('government', $governmentInstance);
- } // END - if
+ // Initialize government instance
+ $governmentInstance = $this->initGovernmentInstance();
// Then ask the government if they want to pay a "startup help" to the user
- if ($governmentInstance->ifGovernmentPayedMaxmimumStartupHelp()) {
- // They can't pay anymore to the user (excited amount)
- $ifGovHelps = false;
- } // END - if
+ $ifGovHelps = ($governmentInstance->ifGovernmentPayedMaxmimumStartupHelp());
// Return result here
return $ifGovHelps;
// Per default the money bank cannot pay
$bankLends = false;
- // Init instance
- $bankInstance = null;
-
- try {
- // Get a money bank instance from registry
- $bankInstance = Registry::getRegistry()->getInstance('money_bank');
- } catch (NullPointerException $e) {
- // Instance not found in registry
- // @TODO We should log this exception later
- }
-
- // Is it there?
- if (is_null($bankInstance)) {
- // Then create a new one
- $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this));
-
- // Store it in registry
- Registry::getRegistry()->addInstance('money_bank', $bankInstance);
- } // END - if
+ // Initialize bank instance
+ $bankInstance->initBankInstance();
// Does the money bank lend more money?
- /* UNFINISED:
- if ($bankInstance->ifBankLendsMoreMoney()) {
- // Okay, that they will do
- $bankLends = true;
- } // END - if
- */
+ $bankLends = ($bankInstance->ifBankLendsMoreMoney());
// Return result
return $bankLends;
// For default he can still get money
$hasMaxCredits = false;
- // Init instance
- $bankInstance = null;
-
- try {
- // Get a money bank instance from registry
- $bankInstance = Registry::getRegistry()->getInstance('money_bank');
- } catch (NullPointerException $e) {
- // Instance not found in registry
- // @TODO We should log this exception later
- }
-
- // Is it there?
- if (is_null($bankInstance)) {
- // Then create a new one
- $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this));
-
- // Store it in registry
- Registry::getRegistry()->addInstance('money_bank', $bankInstance);
- } // END - if
+ // Initialize the bank instance
+ $bankInstance = $this->initBankInstance();
// Now check if the user has maximum credits
- /** UNFINISHED PART!
- if ($bankInstance->ifUserHasMaxCredits()) {
- // Yes, he does!
- $hasMaxCredits = true;
- } // END - if
- */
+ $hasMaxCredits = ($bankInstance->ifUserHasMaxCredits());
// Return the result
return $hasMaxCredits;
}
+
+ /**
+ * Checks wether the money bank has opened
+ *
+ * @return $hasOpened Wether the money bank has opened
+ */
+ public function ifMoneyBankHasOpened () {
+ // Default is not opened
+ $hasOpened = false;
+
+ // Initialize the bank instance
+ $bankInstance = $this->initBankInstance();
+
+ // Has this bank opened?
+ $hasOpened = ($bankInstance->ifMoneyBankHasOpened());
+
+ // Return result
+ return $hasOpened;
+ }
}
// [EOF]
$linkInstance->addLinkNote('government_depleted', "Leider kann dir der Staat nicht mehr weiterhelfen, dich zu bewerben, da du zu oft Starthilfen erhalten hast oder ein Training absolviert hast. Hier muss aber noch weiter am Spiel gearbeitet werden. :-)");
}
-// Add link group for money bank
-$linkInstance->addLinkGroup('moneybank', "Leihe dir zu günstigen Zinsen virtuelles Geld aus, wenn du mehr brauchst!");
+// Checks wether the money bank has opened
+if ($linkInstance->getValueInstance()->ifMoneyBankHasOpened()) {
+ // Add link group for money bank
+ $linkInstance->addLinkGroup('moneybank', "Leihe dir zu günstigen Zinsen virtuelles Geld aus, wenn du mehr brauchst!");
-// Add link to moneybank
-if ($linkInstance->getValueInstance()->ifUserAllowedTakeCreditsFromMoneyBank()) {
- // Display link to money bank page
- $linkInstance->addActionLinkById('moneybank', 'virtual_money_bank');
-} elseif ($linkInstance->getValueInstance()->ifUserHasMaximumCreditsWithMoneyBank()) {
- // Maximum credits reached which a money bank can lent
- $linkInstance->addLinkNote('moneybank_depleted', "Die Bank kann dir kein Geld mehr leihen, bitte zahle es auch wieder zurück.");
- $linkInstance->addActionLinkById('moneybank_payback_credits', 'payback_credits_to_money_bank');
+ // Add link to moneybank
+ if ($linkInstance->getValueInstance()->ifUserAllowedTakeCreditsFromMoneyBank()) {
+ // Display link to money bank page
+ $linkInstance->addActionLinkById('moneybank', 'virtual_money_bank');
+ } elseif ($linkInstance->getValueInstance()->ifUserHasMaximumCreditsWithMoneyBank()) {
+ // Maximum credits reached which a money bank can lent
+ $linkInstance->addLinkNote('moneybank_depleted', "Die Spielebank kann dir kein Geld mehr leihen, bitte zahle es auch wieder zurück.");
+ $linkInstance->addActionLinkById('moneybank_payback_credits', 'payback_credits_to_money_bank');
+ } else {
+ // Unexpected state of the bank
+ $linkInstance->addLinkNote('moneybank_error', "Es wurde ein Fehler in der Spielebank erkannt. Bitte melde dies dem Support.");
+ }
} else {
// Money bank is closed!
- $linkInstance->addLinkNote('moneybank_closed', "Die Bank hat derzeit geschlossen. Bitte später nochmal versuchen.");
+ $linkInstance->addLinkGroup('moneybank', "Die Spielebank hat geschlossen.");
+ $linkInstance->addLinkNote('moneybank_closed', "Die Spielebank hat derzeit geschlossen. Bitte später nochmal versuchen.");
}
// Add link group for refill page