Renamed 'ship-simu' to 'shipsimu' + added 'core' and symlink to core/inc
[shipsimu.git] / application / ship-simu / main / user / class_ShipSimuBaseUser.php
diff --git a/application/ship-simu/main/user/class_ShipSimuBaseUser.php b/application/ship-simu/main/user/class_ShipSimuBaseUser.php
deleted file mode 100644 (file)
index 75de2c7..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-<?php
-/**
- * A special member class for Ship-Simu
- *
- * @author             Roland Haeder <webmaster@shipsimu.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.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 ShipSimuBaseUser extends BaseUser implements Registerable, Updateable {
-       /**
-        * Protected constructor
-        *
-        * @param       $className      Name of the class
-        * @return      void
-        */
-       protected function __construct ($className) {
-               // Call parent constructor
-               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
-        *
-        * @return      $reached        Wether the user has reached maximum allowed companies to found
-        */
-       public function ifUserCreatedMaximumAllowedCompanies () {
-               // Get max allowed companies to found
-               $maxFound = $this->getConfigInstance()->getConfigEntry('max_allowed_companies_found');
-
-               // Now get a search criteria and set the user's name as criteria
-               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-               $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
-               $searchInstance->setLimit($maxFound);
-
-               // Get a company wrapper
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('company_db_wrapper_class');
-
-               // Do the count-select by criteria
-               $totalRows = $wrapperInstance->doSelectCountByCriteria($searchInstance);
-
-               // Does the user have reached maximum?
-               $reached = ($totalRows >= $maxFound);
-
-               // Return the result
-               return $reached;
-       }
-
-       /**
-        * Checks wether the user has the required amount of points left for the specified action
-        *
-        * @param       $action                 The action or configuration entry plus prefix the user wants to perform
-        * @return      $hasRequired    Wether the user has the required points
-        */
-       public function ifUserHasRequiredPoints ($action) {
-               // Default is that everyone is poor... ;-)
-               $hasRequired = false;
-
-               // Init instance
-               $pointsInstance = null;
-
-               try {
-                       // Get a points instance from registry
-                       $pointsInstance = Registry::getRegistry()->getInstance('points');
-               } catch (NullPointerException $e) {
-                       // Instance not found in registry
-                       // @TODO We should log this exception later
-               }
-
-               // Is there an instance?
-               if (is_null($pointsInstance)) {
-                       // Then create one
-                       $pointsInstance = ObjectFactory::createObjectByConfiguredName('user_points_class', array($this));
-
-                       // And store it in registry
-                       Registry::getRegistry()->addInstance('points', $pointsInstance);
-               } // END - if
-
-               // Just forward this request to the user points class
-               $hasRequired = $pointsInstance->ifUserHasRequiredPoints($action);
-
-               // Return the result
-               return $hasRequired;
-       }
-
-       /**
-        * Determines if government can still pay a "virtual training course" in general
-        *
-        * @return      $ifGovHelps             Wether if government helps the user with a virtual training course
-        */
-       public function ifGovernmentPaysTraining () {
-               // By default they want to help.
-               $ifGovHelps = true;
-
-               // Initialize government instance
-               $governmentInstance = $this->initGovernmentInstance();
-
-               // Then ask the government if they want to pay a "startup help" to the user
-               $ifGovHelps = ($governmentInstance->ifGovernmentAlreadyPayedTraining());
-
-               // 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;
-
-               // Initialize government instance
-               $governmentInstance = $this->initGovernmentInstance();
-
-               // Then ask the government if they want to pay a "startup help" to the user
-               $ifGovHelps = ($governmentInstance->ifGovernmentPayedMaxmimumStartupHelp());
-
-               // Return result here
-               return $ifGovHelps;
-       }
-
-       /**
-        * 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 implement MoneyBank::ifBankLendsMoreMoney()
-        */
-       public function ifUserAllowedTakeCreditsFromMoneyBank () {
-               // Per default the money bank cannot pay
-               $bankLends = false;
-
-               // Initialize bank instance
-               $bankInstance->initBankInstance();
-
-               // Does the money bank lend more money?
-               $bankLends = ($bankInstance->ifBankLendsMoreMoney());
-
-               // Return result
-               return $bankLends;
-       }
-
-       /**
-        * Checks wether the user has maximum credits with the money bank. This
-        * should be done seperately from checking if the user is allowed to take
-        * credits from the bank.
-        *
-        * @return      $hasMaxCredits  Wether the user has maximum credits with the bank
-        * @todo        Need to check the bank if they can lend more money
-        */
-       public function ifUserHasMaximumCreditsWithMoneyBank () {
-               // For default he can still get money
-               $hasMaxCredits = false;
-
-               // Initialize the bank instance
-               $bankInstance = $this->initBankInstance();
-
-               // Now check if the user has maximum credits
-               $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]
-?>