expeditionID = 0; $this->expeditionName = 'Unnamed expedition'; $this->expeditionStart_YYYY = 0; $this->expeditionStart_MM = 0; $this->expeditionStart_DD = 0; $this->expeditionEnd_YYYY = 0; $this->expeditionEnd_MM = 0; $this->expeditionEnd_DD = 0; } // destructor function __destruct() { } //expedition ID functions public function getExpeditionID() { return $this-> expeditionID ; } public function setExpeditionID($new_ExpeditionID) { $this->expeditionID = $new_ExpeditionID; } //expedition name functions public function getExpeditionName() { return $this-> expeditionName ; } public function setExpeditionName($new_ExpeditionName) { $this->expeditionName = $new_ExpeditionName; } //*********************** START date functions ************************ //expeditionStart (date) get-functions public function getExpeditionStart_YYYYMMDD() { return $this-> expeditionStart_YYYYMMDD ; } public function getExpeditionStart_YYYY() { return $this-> expeditionStart_YYYY ; } public function getExpeditionStart_MM() { return $this-> expeditionStart_MM ; } public function getExpeditionStart_DD() { return $this-> expeditionStart_DD ; } //expeditionStart (date) set-function //operates on the date as a whole. public function setExpeditionStart_YYYYMMDD($new_ExpeditionStart_YYYYMMDD) { //first some checks for date validity //mind the type-casts, as the checkdate() function requires integers $this->dateStringLength = strlen($new_ExpeditionStart_YYYYMMDD); $this->yearAsInteger = (int) substr($new_ExpeditionStart_YYYYMMDD,0,4); $this->monthAsInteger = (int) substr($new_ExpeditionStart_YYYYMMDD,4,2); $this->dayAsInteger = (int) substr($new_ExpeditionStart_YYYYMMDD,6,2); if ($this->dateStringLength > 8) { // string too long $this->returnString = "ERROR : given string is longer than 8 characters. Expedition start date should be given in the format YYYYMMDD, without separation characters or blanks. / Given string was : $new_ExpeditionStart_YYYYMMDD"; } elseif (checkdate($this->monthAsInteger, $this->dayAsInteger, $this->yearAsInteger) == FALSE) { //date not valid $this->returnString ="ERROR : given date is not valid. Expedition start date should be given in the format YYYYMMDD. The year should be between 1 and 32767 inclusive. Month should be between 1 and 12 inclusive. Day should be within allowed number of days for the given month. Leap years are taken into account. / Given string was : $new_ExpeditionStart_YYYYMMDD"; } else { // no problems : date is accepted $this->expeditionStart_YYYY = (string) $this->yearAsInteger; $this->expeditionStart_MM = (string) $this->monthAsInteger; $this->expeditionStart_DD = (string) $this->dayAsInteger; $this->expeditionStart_YYYYMMDD = (string) $new_ExpeditionStart_YYYYMMDD; $this->returnString = "Expedition start date set to" . $this->expeditionStart_YYYYMMDD; } return ($this->returnString); } //*********************** END date functions ************************ //expeditionEnd (date) get-functions //get functions operate on the separate //parts of the date (YYYY or MM or DD). public function getExpeditionEnd_YYYY() { return $this-> expeditionEnd_YYYY ; } public function getExpeditionEnd_MM() { return $this-> expeditionEnd_MM ; } public function getExpeditionEnd_DD() { return $this-> expeditionEnd_DD ; } //expeditionEnd (date) set-function //operates on the date as a whole. public function setExpeditionEnd_YYYYMMDD($new_ExpeditionEnd_YYYYMMDD) { //first some checks for date validity //mind the type-casts, as the checkdate() function requires integers $this->dateStringLength = strlen($new_ExpeditionEnd_YYYYMMDD); $this->yearAsInteger = (int) substr($new_ExpeditionEnd_YYYYMMDD,0,4); $this->monthAsInteger = (int) substr($new_ExpeditionEnd_YYYYMMDD,4,2); $this->dayAsInteger = (int) substr($new_ExpeditionEnd_YYYYMMDD,6,2); if ($this->dateStringLength > 8) { // string too long $this->returnString = "ERROR : given string is longer than 8 characters. Expedition start date should be given in the format YYYYMMDD, without separation characters or blanks. / Given string was : $new_ExpeditionEnd_YYYYMMDD"; } elseif (checkdate($this->monthAsInteger, $this->dayAsInteger, $this->yearAsInteger) == FALSE) { //date not valid $this->returnString ="ERROR : given date is not valid. Expedition start date should be given in the format YYYYMMDD. The year should be between 1 and 32767 inclusive. Month should be between 1 and 12 inclusive. Day should be within allowed number of days for the given month. Leap years are taken into account. / Given string was : $new_ExpeditionEnd_YYYYMMDD"; } else { // no problems : date is accepted $this->expeditionEnd_YYYY = $this->yearAsInteger; $this->expeditionEnd_MM = $this->monthAsInteger; $this->expeditionEnd_DD = $this->dayAsInteger; $this->expeditionEnd_YYYYMMDD = $new_ExpeditionEnd_YYYYMMDD; $this->returnString = "Expedition end date set to $this->expeditionEnd_YYYYMMDD"; } return ($this->returnString); } } ?>