]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/government/class_SimplifiedGovernment.php
Renamed 'ship-simu' to 'shipsimu' + added 'core' and symlink to core/inc
[shipsimu.git] / application / ship-simu / main / government / class_SimplifiedGovernment.php
diff --git a/application/ship-simu/main/government/class_SimplifiedGovernment.php b/application/ship-simu/main/government/class_SimplifiedGovernment.php
deleted file mode 100644 (file)
index 8999153..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/**
- * A government class with simplified ways...
- *
- * @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
- * @todo               Find an interface for governments
- *
- * 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 SimplifiedGovernment extends BaseFrameworkSystem implements Registerable {
-       // Constants
-       const STATUS_STARTER_HELP    = 'STARTER_HELP';
-       const STATUS_TRAINING        = 'TRAINING';
-
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Creates an instance of this government class by given user instance
-        *
-        * @param       $userInstance           The user instance
-        * @return      $governmentInstance     Instance of the prepared government instance
-        */
-       public static final function createSimplifiedGovernment (ManageableAccount $userInstance) {
-               // Get a new instance
-               $governmentInstance = new SimplifiedGovernment();
-
-               // Set the user instance
-               $governmentInstance->setUserInstance($userInstance);
-
-               // Return the prepared instance
-               return $governmentInstance;
-       }
-
-       /**
-        * Checks wether the government has already payed a training course for te
-        * current user
-        *
-        * @return      $alreadyPayed   Wether the government has already payed
-        * @todo        Needs do check training limit
-        */
-       public function ifGovernmentAlreadyPayedTraining () {
-               // Default is not payed
-               $alreadyPayed = false;
-
-               // Cache startup training limit
-               $trainingLimit = $this->getConfigInstance()->getConfigEntry('government_training_limit');
-
-               // Now get a search criteria and set the user's name as criteria
-               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-               $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_USERID  , $this->getUserInstance()->getUserId());
-               $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_ACTIVITY, self::STATUS_TRAINING);
-               $searchInstance->setLimit(1);
-
-               // Get a wrapper instance
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class');
-
-               // Get result back
-               $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
-
-               // Was the query fine?
-               if ($resultInstance->next()) {
-                       // Get entry
-                       $currEntry = $resultInstance->current();
-
-                       // Entry was found so the government can no more pay a training
-                       $alreadyPayed = true;
-               } // END - if
-
-               // Return the result
-               return $alreadyPayed;
-       }
-
-       /**
-        * Checks wether the government has payed maximum of startup helps to the
-        * current user
-        *
-        * @return      $maximumPayed   Wether the government has already payed
-        * @todo        Needs do check help limit
-        */
-       public function ifGovernmentPayedMaxmimumStartupHelp () {
-               // Default is not payed
-               $maximumPayed = false;
-
-               // Cache startup help limit
-               $helpLimit = $this->getConfigInstance()->getConfigEntry('government_startup_help_limit');
-
-               // Now get a search criteria and set the user's name as criteria
-               $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-               $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_USERID  , $this->getUserInstance()->getUserId());
-               $searchInstance->addCriteria(UserGovernmentDatabaseWrapper::DB_COLUMN_GOV_ACTIVITY, self::STATUS_STARTER_HELP);
-               $searchInstance->setLimit($helpLimit);
-
-               // Get a wrapper instance
-               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class');
-
-               // Get result back
-               $resultInstance = $wrapperInstance->doSelectByCriteria($searchInstance);
-
-               // Was the query fine?
-               if ($resultInstance->next()) {
-                       // Get entry
-                       $currEntry = $resultInstance->current();
-
-                       // Entry found, so lets have a look if this government wants to again...
-                       $maximumPayed = true;
-               } // END - if
-
-               // Return the result
-               return $maximumPayed;
-       }
-}
-
-// [EOF]
-?>