/** * Save the activity then the employee types */ function save() { # first save the activity parent::save(); # check whether any errors occured if ($this->hasError()) { return false; } # add the new employee types $query = "INSERT INTO activityemployeetypes (effectivedate, activityid, employeetypeid, datecreated, createdby) VALUES "; foreach ($this->getEmployeeType() as $value) { # generate an SQL statement for the employee types for the activities $query .= "(NOW(), '" . $this->getID() . "', '" . $value . "', NOW(), '" . $this->getCreatedBy() . "'), "; } # remove the last comma and space $query = substr($query, 0, -2); $result = $this->getDB()->executeQuery($query); if (!$result) { # add the error message to the string $this->setError($this->getDB()->getError()); return false; } # return the id of the activity return $this->getID(); }