]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/personell/class_SimulatorPersonell.php
Copyright updated, menu class added for 'home'
[shipsimu.git] / application / ship-simu / main / personell / class_SimulatorPersonell.php
index fc142cf748d9805b36845d3af50fad88e04a13cb..e6236f9571129ee9dd0a121fc4fcd7e3da962d3d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @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
  *
@@ -39,15 +39,6 @@ class SimulatorPersonell extends BasePersonell {
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
-
-               // Set description
-               $this->setObjectDescription("Simulationspersonal");
-
-               // Create unique ID
-               $this->generateUniqueId();
-
-               // Clean-up a little
-               $this->removeSystemArray();
        }
 
        /**
@@ -82,7 +73,7 @@ class SimulatorPersonell extends BasePersonell {
                $personellInstance = new SimulatorPersonell();
 
                // Debug message
-               if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Es werden <strong>%d</strong> Personal bereitgestellt.",
+               if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] Es werden <strong>%d</strong> Personal bereitgestellt.",
                        __CLASS__,
                        __LINE__,
                        $amountPersonell
@@ -97,7 +88,7 @@ class SimulatorPersonell extends BasePersonell {
                }
 
                // Debug message
-               if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] <strong>%d</strong> Personal bereitgestellt.",
+               if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->debugOutput(sprintf("[%s:%d] <strong>%d</strong> Personal bereitgestellt.",
                        __CLASS__,
                        __LINE__,
                        $amountPersonell
@@ -127,64 +118,28 @@ class SimulatorPersonell extends BasePersonell {
         * @throws      InvalidIDFormatException        If the given id number
         *                                                                              $idNumber is invalid
         * @throws      MissingSimulatorIdException             If an ID number was not found
+        * @deprecated
         */
        public final static function createSimulatorPersonellByID ($idNumber) {
-               // Add the class name if it was not found
-               if (count(explode("@", $idNumber)) < 2) {
-                       // Add class name in front of the incomplete ID number
-                       $tempID = sprintf("%s@%s", __CLASS__, $idNumber);
-               } else {
-                       // Use the direct ID number
-                       $tempID = $idNumber;
-               }
-
-               // Validate the ID number
-               if (!preg_match(sprintf("/%s\@([a-f0-9]){32}/i", __CLASS__), $tempID)) {
-                       // Invalid format
-                       throw new InvalidIDFormatException(new SimulatorPersonell(), self::EXCEPTION_ID_IS_INVALID_FORMAT);
-               }
-
                // Get instance
                $personellInstance = new SimulatorPersonell(false);
-
-               // Get database instance
-               $dbInstance = $personellInstance->getDatabaseInstance();
-
-               // Is the unique ID already used? Then it must be there!
-               if (!$dbInstance->isUniqueIdUsed($tempID))  {
-                       // Entry not found!
-                       throw new MissingSimulatorIdException(array($personellInstance, $idNumber), self::EXCEPTION_SIMULATOR_ID_INVALID);
-               }
-
-               // Load the personell list and add it to this object
-               $personellInstance->loadPersonellList($tempID);
-
-               // Clean-up a little
-               $personellInstance->removeGender();
-               $personellInstance->removeNames();
-               $personellInstance->removeBirthday();
-               $personellInstance->removeSalary();
-               $personellInstance->removeEmployed();
-               $personellInstance->removeMarried();
-               $personellInstance->removeNumberFormaters();
-               //$personellInstance->removeCache();
-               $personellInstance->removeSystemArray();
-
-               // Return instance
-               return $personellInstance;
+               $personellInstance->makeDeprecated();
        }
 
        // Create personell list
        public function createPersonellList () {
-               if (is_null($this->personellList)) {
-                       $this->personellList = new FrameworkArrayObject("FakedPersonellList");
-               } else {
+               // Is the list already created?
+               if ($this->personelllList instanceof FrameworkArrayObject) {
+                       // Throw an exception
                        throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID);
-               }
+               } // END - if
+
+               // Initialize the array
+               $this->personellList = new FrameworkArrayObject("FakedPersonellList");
        }
 
        // Remove the personell list
-       private function removePersonellList () {
+       private final function removePersonellList () {
                unset($this->personellList);
        }
 
@@ -226,7 +181,7 @@ class SimulatorPersonell extends BasePersonell {
 
                // The same (last) conditions?
                if (($serialized == $this->cacheCond) && (!is_null($this->cacheCond))) {
-                       if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Gecachte Liste wird verwendet.",
+                       if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Gecachte Liste wird verwendet.",
                                __CLASS__,
                                __LINE__
                        ));
@@ -236,7 +191,7 @@ class SimulatorPersonell extends BasePersonell {
                }
 
                // Output debug message
-               if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...",
+               if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...",
                        __CLASS__,
                        __LINE__
                ));
@@ -365,19 +320,10 @@ class SimulatorPersonell extends BasePersonell {
         * @param       $idNumber       The ID number we shall use for looking up
         *                                              the right data.
         * @return      void
-        * @throws      ContainerItemIsNullException    If a container item is null
-        * @throws      ContainerItemIsNoArrayException If a container item is
-        *                                                                                      not an array
-        * @throws      ContainerMaybeDamagedException  If the container item
-        *                                                                                      is missing the indexes
-        *                                                                                      'name' and/or 'value'
-        * @see         SerializationContainer  A special container class which
-        *                                                                      helps storing only some attributes
-        *                                                                      of a class.
+        * @deprecated
         */
        public function loadPersonellList ($idNumber) {
-               // Cleared because old code
-               $this->partialStub("Cleared because old lost code was used.");
+               $this->makeDeprecated();
        }
 }