Copyright updated, menu class added for 'home'
[shipsimu.git] / application / ship-simu / main / user / class_ShipSimuBaseUser.php
index 22ccc55..96a107f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @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
  *
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -76,7 +76,7 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
                // Is there an instance?
                if (is_null($pointsInstance)) {
                        // Then create one
                // Is there an instance?
                if (is_null($pointsInstance)) {
                        // Then create one
-                       $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_ppints_class', array($this));
+                       $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this));
 
                        // And store it in registry
                        Registry::getRegistry()->addInstance('points', $pointsInstance);
 
                        // And store it in registry
                        Registry::getRegistry()->addInstance('points', $pointsInstance);
@@ -90,41 +90,72 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
        }
 
        /**
        }
 
        /**
-        * Determines if the goverment can still pay a "startup help" to the user
+        * Determines if government can still pay a "virtual training course" in general
         *
         *
-        * @return      $ifGovHelped    Wether if the goverment has helped the user with startup
+        * @return      $ifGovHelps             Wether if government helps the user with a virtual training course
         */
         */
-       public function ifGovermentPaysStartupHelp () {
-               // By default they have not payed, which is indeed good. ;-)
-               $ifGovHelped = false;
+       public function ifGovernmentPaysTraining () {
+               // By default they want to help.
+               $ifGovHelps = true;
 
 
-               // First get a goverment instance from registry
-               $govermentInstance = Registry::getRegistry()->getInstance('goverment');
+               // First get a government instance from registry
+               $governmentInstance = Registry::getRegistry()->getInstance('government');
 
                // Is it there?
 
                // Is it there?
-               if (is_null($govermentInstance)) {
+               if (is_null($governmentInstance)) {
                        // Then create a new one
                        // Then create a new one
-                       $govermentInstance = ObjectFactory::createObjectByConfiguredName('goverment_class', array($this));
+                       $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this));
 
                        // Store it in registry
 
                        // Store it in registry
-                       Registry::getRegistry()->addInstance('goverment', $govermentInstance);
+                       Registry::getRegistry()->addInstance('government', $governmentInstance);
                } // END - if
 
                } // END - if
 
-               // Then ask the goverment if they want to pay a "startup help" to the user
-               if ($govermentInstance->ifGovermentAlreadyPayedStartupHelp()) {
+               // 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
+
+               // Return result here
+               return $ifGovHelps;
+       }
+
+       /**
+        * Determines if government can still pay a "startup help" to the user
+        *
+        * @return      $ifGovHelps             Wether if government helps the user with some startup money
+        */
+       public function ifGovernmentPaysStartupHelp () {
+               // By default they want to help.
+               $ifGovHelps = true;
+
+               // First get a government instance from registry
+               $governmentInstance = Registry::getRegistry()->getInstance('government');
+
+               // 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
+
+               // 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)
                        // They can't pay anymore to the user (excited amount)
-                       $ifGovHelped = true;
+                       $ifGovHelps = false;
                } // END - if
 
                // Return result here
                } // END - if
 
                // Return result here
-               return $ifGovHelped;
+               return $ifGovHelps;
        }
 
        /**
         * Checks wether the user can take points from the money bank
         *
         * @return      $bankLends      Wether the money bank is able to lend money
        }
 
        /**
         * Checks wether the user can take points from the money bank
         *
         * @return      $bankLends      Wether the money bank is able to lend money
-        * @todo        Need to check the bank if they can generally lend money to the user
+        * @todo        Need to implement MoneyBank::ifBankLendsMoreMoney()
         */
        public function ifUserAllowedTakeCreditsFromMoneyBank () {
                // Per default the money bank cannot pay
         */
        public function ifUserAllowedTakeCreditsFromMoneyBank () {
                // Per default the money bank cannot pay
@@ -143,7 +174,7 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
                } // END - if
 
                // Does the money bank lend more money?
                } // END - if
 
                // Does the money bank lend more money?
-               /** UNFINISHED PART!
+               /* UNFINISED:
                if ($bankInstance->ifBankLendsMoreMoney()) {
                        // Okay, that they will do
                        $bankLends = true;
                if ($bankInstance->ifBankLendsMoreMoney()) {
                        // Okay, that they will do
                        $bankLends = true;