class_CompanyEmployee.php

Go to the documentation of this file.
00001 <?php
00024 class CompanyEmployee extends SimulatorPersonell {
00025         // Employeee list
00026         private $employeeList = null;
00027 
00028         // Constructor
00029         protected function __construct () {
00030                 // Call parent constructor
00031                 parent::__construct(__CLASS__);
00032         }
00033 
00034         // Generate a specified amount of personell
00035         public final static function createCompanyEmployee ($surname, $family, $gender, $year, $month, $day, $married, $salary) {
00036                 // Get instance
00037                 $personellInstance = new CompanyEmployee();
00038 
00039                 // Debug message
00040                 if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) {
00041                         $personellInstance->debugOutput(sprintf("[%s:%d] Der/Die Angestellte <strong>%s %s</strong> wird angelegt.",
00042                                 __CLASS__,
00043                                 __LINE__,
00044                                 $surname,
00045                                 $family
00046                         ));
00047                 }
00048 
00049                 // Ist the given birthday valid?
00050                 if ($personellInstance->isDateValid($year, $month, $day) === false) {
00051                         // Something is wrong ...
00052                         throw new BirthdayInvalidException(array($year, $month, $day), self::EXCEPTION_BIRTH_DATE_IS_INVALID);
00053                 } // END - if
00054 
00055                 // Set birthday
00056                 $personellInstance->setBirthday($year, $month, $day);
00057 
00058                 // Set as employed/marrital status
00059                 $personellInstance->setEmployed(true);
00060                 $personellInstance->setMarried($married);
00061 
00062                 // Set surname/family/gender
00063                 $personellInstance->setSurname($surname);
00064                 $personellInstance->setFamily($family);
00065                 $personellInstance->setGender($gender);
00066 
00067                 // Set salary
00068                 $personellInstance->increaseSalary($salary);
00069 
00070                 // Tidy up a little
00071                 $personellInstance->removeEmployeeList();
00072                 $personellInstance->removeMinMaxAge();
00073 
00074                 // Return prepared instance
00075                 return $personellInstance;
00076         }
00077 
00078         // Remove the employee list
00079         private function removeEmployeeList () {
00080                 unset($this->employeeList);
00081         }
00082 }
00083 
00084 // [EOF]
00085 ?>

Generated on Mon Dec 8 01:06:44 2008 for Ship-Simulator by  doxygen 1.5.6