]> git.mxchange.org Git - shipsimu.git/blobdiff - ship-simu/application/ship-simu/main/class_BasePersonell.php
(no commit message)
[shipsimu.git] / ship-simu / application / ship-simu / main / class_BasePersonell.php
diff --git a/ship-simu/application/ship-simu/main/class_BasePersonell.php b/ship-simu/application/ship-simu/main/class_BasePersonell.php
deleted file mode 100644 (file)
index 6f78c65..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-<?php
-// What every kind of personell have
-class BasePersonell extends BaseFrameworkSystem implements Personellizer {
-       // Maximum/minimum age
-       private $MIN_AGE = 21;
-       private $MAX_AGE = 40;
-
-       // Male/female
-       private $gender     = ""; // M=Male, F=Female, empty=uninitialized
-
-       // Year/month/day of birth
-       private $yearBirth  = 0;
-       private $monthBirth = 0;
-       private $dayBirth   = 0;
-
-       // Surname/family name
-       private $surname    = "";
-       private $family     = "";
-
-       // Employed?
-       private $employed   = false;
-
-       // Married?
-       private $married    = false;
-
-       // Her/his salary
-       private $salary     = 0.00;
-
-       // Constructor
-       private function __construct ($class) {
-               // Call parent constructor
-               parent::constructor($class);
-
-               // Debug message
-               if ((defined('DEBUG_PERSONELL')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[PersonellBase:] Konstruktor erreicht.<br />\n");
-
-               // Beschreibung setzen
-               $this->setPartDescr("Personal");
-       }
-
-       // Calls the constructor
-       public function constructor ($class) {
-               $this->__construct($class);
-       }
-
-       // Remove min/max ages
-       public final function removeMinMaxAge () {
-               if (defined('DEBUG_PERSONELL')) $this->getDebugInstance()->output(sprintf("[%s:%d] Minimum-/Maximum-Alter entfernt.<br />\n",
-                       __CLASS__,
-                       __LINE__
-               ));
-               unset($this->MIN_AGE);
-               unset($this->MAX_AGE);
-       }
-
-       // Generates a birthday based on MAX_AGE/MIN_AGE and the current date
-       public final function createBirthday () {
-               // Is the birthday already set?
-               if ($this->isDateValid($this->yearBirth, $this->monthBirth, $this->dayBirth)) return false;
-
-               // Get current year
-               $currYear = date("Y", time());
-
-               // Generate random year/month/day
-               $year = mt_rand(($currYear - $this->MIN_AGE), ($currYear - $this->MAX_AGE));
-               $month = 0;
-               $day = 0;
-               while (!$this->isDateValid($year, $month, $day)) {
-                       $month = mt_rand(1, 12);
-                       switch ($month) {
-                       case 1:
-                       case 3:
-                       case 5:
-                       case 7:
-                       case 8:
-                       case 10:
-                       case 12:
-                               $day   = mt_rand(1, 31);
-                               break;
-
-                       case 4:
-                       case 6:
-                       case 9:
-                       case 11:
-                               $day   = mt_rand(1, 30);
-                               break;
-
-                       case 2: // February
-                               if ($year % 4 == 0) {
-                                       // Is a "Schaltjahr"
-                                       $day = mt_rand(1, 29);
-                               } else {
-                                       // Regular year
-                                       $day = mt_rand(1, 28);
-                               }
-                               break;
-                       } // switch - END
-               } // while - END
-
-               // Set the new birthday
-               $this->setBirthday($year, $month, $day);
-       }
-
-       // Is the current day valid?
-       public final function isDateValid ($year, $month, $day) {
-               // Create timestamp
-               $stamp = mktime(0, 0, 0, $month, $day, $year);
-
-               // Get year/month/day back
-               $y = date("Y", $stamp);
-               $m = date("m", $stamp);
-               $d = date("d", $stamp);
-
-               // Compare all
-               return (($y == $year) && ($m == $month) && ($d == $day));
-       }
-
-       // Employed?
-       public final function isEmployed () {
-               return $this->employed;
-       }
-
-       // Married?
-       public final function isMarried () {
-               return $this->married;
-       }
-
-       // Male?
-       public final function isMale () {
-               return ($this->gender == "M");
-       }
-
-       // Female
-       public final function isFemale () {
-               return ($this->gender == "F");
-       }
-
-       // Setter for surname
-       public final function setSurname ($surname) {
-               $this->surname = (string) $surname;
-       }
-
-       // Getter for surname
-       public function getSurname () {
-               return $this->surname;
-       }
-
-       // Setter for family name
-       public final function setFamily ($family) {
-               $this->family = (string) $family;
-       }
-
-       // Getter for family name
-       public final function getFamily () {
-               return $this->family;
-       }
-
-       // Setter for gender
-       public final function setGender ($gender) {
-               // Set random gender here
-               if (($gender == "M") || ($gender == "F") || ((empty($gender)) && ($this->getSurname() == ""))) {
-                       $this->gender = $gender;
-               } else {
-                       throw new WrongGenderSpecifiedException($gender, self::EXCEPTION_GENDER_IS_WRONG);
-               }
-       }
-
-       // Getter for gender
-       public final function getGender () {
-               return $this->gender;
-       }
-
-       // Setter for employment status
-       public final function setEmployed ($employed) {
-               $this->employed = (boolean) $employed;
-       }
-
-       // Setter for marriage status
-       public final function setMarried ($married) {
-               $this->married = (boolean) $married;
-       }
-
-       // Getter for salary
-       public final function getSalary () {
-               return $this->salary;
-       }
-
-       // Increase salary
-       public final function increaseSalary ($add) {
-               $this->salary += (float) abs($add);
-       }
-
-       // Decrease salary
-       public final function decreaseSalary ($sub) {
-               $this->salary -= (float) abs($sub);
-       }
-
-       // Setter for birthday
-       public final function setBirthday ($year, $month, $day) {
-               $this->yearBirth  = (int) abs($year);
-               $this->monthBirth = (int) abs($month);
-               $this->dayBirth   = (int) abs($day);
-       }
-
-       // Remove gender
-       public function removeGender () {
-               unset($this->gender);
-       }
-
-       // Remove both names
-       public function removeNames () {
-               unset($this->surname);
-               unset($this->family);
-       }
-
-       // Remove complete birthday
-       public function removeBirthday () {
-               unset($this->yearBirth);
-               unset($this->monthBirth);
-               unset($this->dayBirth);
-       }
-
-       // Remove salary
-       public function removeSalary () {
-               unset($this->salary);
-       }
-
-       // Remove employment status
-       public function removeEmployed () {
-               unset($this->employed);
-       }
-
-       // Remove marrital status
-       public function removeMarried () {
-               unset($this->married);
-       }
-}
-
-// [EOF]
-?>