Opening times added (still a lot partial stubs)
authorRoland Häder <roland@mxchange.org>
Sat, 29 Aug 2009 19:01:54 +0000 (19:01 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 29 Aug 2009 19:01:54 +0000 (19:01 +0000)
12 files changed:
.gitattributes
application/ship-simu/config.php
application/ship-simu/main/bank/class_BaseBank.php [new file with mode: 0644]
application/ship-simu/main/bank/class_MoneyBank.php [deleted file]
application/ship-simu/main/bank/money/class_MoneyBank.php [new file with mode: 0644]
application/ship-simu/main/opening/.htaccess [new file with mode: 0644]
application/ship-simu/main/opening/bank/.htaccess [new file with mode: 0644]
application/ship-simu/main/opening/bank/class_MoneyBankRealtimeOpening.php [new file with mode: 0644]
application/ship-simu/main/opening/class_ [new file with mode: 0644]
application/ship-simu/main/opening/class_BaseOpening.php [new file with mode: 0644]
application/ship-simu/main/user/class_ShipSimuBaseUser.php
application/ship-simu/templates/de/code/action_ship_simu_login_company.ctp

index 97850f8..08601a2 100644 (file)
@@ -80,7 +80,8 @@ application/ship-simu/main/actions/web/class_WebShipSimuLoginRefillAction.php -t
 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
@@ -159,6 +160,11 @@ application/ship-simu/main/menu/class_ShipSimuRegisterMenu.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
index 1c7a25d..d79be7e 100644 (file)
@@ -520,5 +520,11 @@ $cfg->setConfigEntry('login_area_menu_class', 'ShipSimuLoginAreaMenu');
 // 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]
 ?>
diff --git a/application/ship-simu/main/bank/class_BaseBank.php b/application/ship-simu/main/bank/class_BaseBank.php
new file mode 100644 (file)
index 0000000..1eaecfa
--- /dev/null
@@ -0,0 +1,60 @@
+<?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]
+?>
diff --git a/application/ship-simu/main/bank/class_MoneyBank.php b/application/ship-simu/main/bank/class_MoneyBank.php
deleted file mode 100644 (file)
index a065f35..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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]
-?>
diff --git a/application/ship-simu/main/bank/money/class_MoneyBank.php b/application/ship-simu/main/bank/money/class_MoneyBank.php
new file mode 100644 (file)
index 0000000..1e9a510
--- /dev/null
@@ -0,0 +1,94 @@
+<?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]
+?>
diff --git a/application/ship-simu/main/opening/.htaccess b/application/ship-simu/main/opening/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/opening/bank/.htaccess b/application/ship-simu/main/opening/bank/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/ship-simu/main/opening/bank/class_MoneyBankRealtimeOpening.php b/application/ship-simu/main/opening/bank/class_MoneyBankRealtimeOpening.php
new file mode 100644 (file)
index 0000000..752d5b7
--- /dev/null
@@ -0,0 +1,63 @@
+<?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]
+?>
diff --git a/application/ship-simu/main/opening/class_ b/application/ship-simu/main/opening/class_
new file mode 100644 (file)
index 0000000..b9f1ce7
--- /dev/null
@@ -0,0 +1,50 @@
+<?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]
+?>
diff --git a/application/ship-simu/main/opening/class_BaseOpening.php b/application/ship-simu/main/opening/class_BaseOpening.php
new file mode 100644 (file)
index 0000000..b37a1e9
--- /dev/null
@@ -0,0 +1,60 @@
+<?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]
+?>
index 5f61809..e26db54 100644 (file)
@@ -34,6 +34,66 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
        }
 
        /**
+        * 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
         *
         * @return      $reached        Wether the user has reached maximum allowed companies to found
@@ -106,31 +166,11 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
                // 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;
@@ -145,31 +185,11 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
                // 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;
@@ -185,33 +205,11 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
                // 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;
@@ -229,37 +227,34 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
                // 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]
index 6e824d4..680dc55 100644 (file)
@@ -43,20 +43,27 @@ if ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('write_applicatio
        $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&uuml;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&uuml;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&uuml;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&uuml;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&auml;ter nochmal versuchen.");
+       $linkInstance->addLinkGroup('moneybank', "Die Spielebank hat geschlossen.");
+       $linkInstance->addLinkNote('moneybank_closed', "Die Spielebank hat derzeit geschlossen. Bitte sp&auml;ter nochmal versuchen.");
 }
 
 // Add link group for refill page