3 // Die Schiffsbesatzung
4 class CompanyEmployee extends SimulatorPersonell {
6 private $employeeList = null;
9 private function __construct () {
10 // Call parent constructor
11 parent::constructor(__CLASS__);
14 if ((((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
15 $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\n",
22 $this->setPartDescr("Firmenangestellte(r)");
25 $this->createUniqueID();
28 $this->removeSystemArray();
31 // Generate a specified amount of personell
32 public static function createCompanyEmployee ($surname, $family, $gender, $year, $month, $day, $married, $salary) {
34 $personellInstance = new CompanyEmployee();
37 if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) {
38 $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Der/Die Angestellte <strong>%s %s</strong> wird angelegt.<br />\n",
46 // Ist the given birthday valid?
47 if ($personellInstance->isDateValid($year, $month, $day)) {
49 $personellInstance->setBirthday($year, $month, $day);
51 // Something is wrong ...
52 throw new BirthdayInvalidException(array($year, $month, $day), self::EXCEPTION_BIRTH_DATE_IS_INVALID);
55 // Set as employed/marrital status
56 $personellInstance->setEmployed(true);
57 $personellInstance->setMarried($married);
59 // Set surname/family/gender
60 $personellInstance->setSurname($surname);
61 $personellInstance->setFamily($family);
62 $personellInstance->setGender($gender);
65 $personellInstance->increaseSalary($salary);
68 $personellInstance->removeEmployeeList();
69 $personellInstance->removeMinMaxAge();
71 // Return prepared instance
72 return $personellInstance;
75 // Remove the employee list
76 private function removeEmployeeList () {
77 if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) {
78 $this->getDebugInstance()->output(sprintf("[%s:%d] Angestellten-List entfernt.<br />\n",
83 unset($this->employeeList);
89 public function saveObjectToDatabase () {
90 parent::saveObjectToDatabase();
94 * Limits this object with an ObjectLimits instance
96 public function limitObject (ObjectLimits $limitInstance) {
97 parent::limitObject($limitInstance);