]> git.mxchange.org Git - shipsimu.git/blobdiff - application/shipsimu/main/class_BasePersonell.php
Updated 'core' + renamed 'main' -> 'classes'.
[shipsimu.git] / application / shipsimu / main / class_BasePersonell.php
diff --git a/application/shipsimu/main/class_BasePersonell.php b/application/shipsimu/main/class_BasePersonell.php
deleted file mode 100644 (file)
index 8e08ec3..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/**
- * A general class for personell
- *
- * @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 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
-       protected function __construct ($className) {
-               // Call parent constructor
-               parent::__construct($className);
-       }
-
-       // Remove min/max ages
-       public final function removeMinMaxAge () {
-               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) === false) {
-                       $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;
-                       } // END - switch
-               } // END - while
-
-               // 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 final function removeGender () {
-               unset($this->gender);
-       }
-
-       // Remove both names
-       public final function removeNames () {
-               unset($this->surname);
-               unset($this->family);
-       }
-
-       // Remove complete birthday
-       public final function removeBirthday () {
-               unset($this->yearBirth);
-               unset($this->monthBirth);
-               unset($this->dayBirth);
-       }
-
-       // Remove salary
-       public final function removeSalary () {
-               unset($this->salary);
-       }
-
-       // Remove employment status
-       public final function removeEmployed () {
-               unset($this->employed);
-       }
-
-       // Remove marrital status
-       public final function removeMarried () {
-               unset($this->married);
-       }
-}
-
-// [EOF]
-?>