id = $id; $this->organization = $organization; $this->department = $department; $this->title = $title; $this->degree = $degree; $this->forename = $forename; $this->surname = $surname; $this->street = $street; $this->streetNumber = $streetNumber; $this->postalCode = $postalCode; $this->city = $city; } /** * Get the value of Id * * * @return int * */ public function getID() { return $this->id; } /** * Set the value of Id * * * @param int id * */ public function setID($id) { $this->id = $id; } /** * Get the value of Organization * * * @return string * */ public function getOrganization() { return $this->organization; } /** * Set the value of Organization * * * @param string organization * */ public function setOrganization($organization) { $this->organization = $organization; } /** * Get the string of Department * * * @return mixed * */ public function getDepartment() { return $this->department; } /** * Set the value of Department * * * @param string department * */ public function setDepartment($department) { $this->department = $department; } /** * Get the value of Title * * * @return string * */ public function getTitle() { return $this->title; } /** * Set the value of Title * * * @param string title * */ public function setTitle($title) { $this->title = $title; } /** * Get the value of Degree * * * @return string * */ public function getDegree() { return $this->degree; } /** * Set the value of Degree * * * @param mixed degree * */ public function setDegree($degree) { $this->degree = $degree; } /** * Get the value of Forename * * * @return string * */ public function getForename() { return $this->forename; } /** * Set the value of Forename * * * @param string forename * */ public function setForename($forename) { $this->forename = $forename; } /** * Get the value of Surname * * * @return string * */ public function getSurname() { return $this->surname; } /** * Set the value of Surname * * * @param string surname * */ public function setSurname($surname) { $this->surname = $surname; } /** * Get the value of Street * * * @return string * */ public function getStreet() { return $this->street; } /** * Set the value of Street * * * @param string street * */ public function setStreet($street) { $this->street = $street; } /** * Get the value of Street Number * * * @return string * */ public function getStreetNumber() { return $this->streetNumber; } /** * Set the value of Street Number * * * @param string streetNumber * */ public function setStreetNumber($streetNumber) { $this->streetNumber = $streetNumber; } /** * Get the value of Postal Code * * * @return string * */ public function getPostalCode() { return $this->postalCode; } /** * Set the value of Postal Code * * * @param string postalCode * */ public function setPostalCode($postalCode) { $this->postalCode = $postalCode; } /** * Get the value of City * * * @return string * */ public function getCity() { return $this->city; } /** * Set the value of City * * * @param string city * */ public function setCity($city) { $this->city = $city; } /** * Get All Contacts by User ID * * @param int userID ID of User * * @return Array(Contact) Array with selected Contacts * */ public static function getAllContactsByUserID($userID) { global $db; $contacts = $db->selectQuery("SELECT * FROM `contacts` WHERE `user_id` = " . $userID . ";"); $return = array(); if(!$contacts) { return false; } foreach($contacts as $contact) { $return[] = new Contact($contact->id, $contact->organization, $contact->department, $contact->title, $contact->degree, $contact->forename, $contact->surname, $contact->street, $contact->street_number, $contact->postal_code, $contact->city); } return $return; } /** * Get Contact by Contact ID * * @param int contactID ID of Contact * * @return Contact Selected Contact * */ public static function getContactByID($contactID) { global $db; $contacts = $db->selectQuery("SELECT * FROM `contacts` WHERE `id` = " . $contactID . ";"); $return = array(); if(!$contacts) { return false; } foreach($contacts as $contact) { $return[] = new Contact($contact->id, $contact->organization, $contact->department, $contact->title, $contact->degree, $contact->forename, $contact->surname, $contact->street, $contact->street_number, $contact->postal_code, $contact->city); } return $return[0]; } /** * Get communications by Contact ID * * @param int contactID ID of Contact * * @return Array Selected communications * */ public static function getCommunicationsByContactID($contactID) { global $db; $communications = $db->selectQuery("SELECT * FROM `contacts_fields` WHERE `contact_id` = " . $contactID . " ORDER BY `type` ASC;"); $return = array(); if(!$communications) { return false; } foreach($communications as $communication) { $return[] = array("id" => $communication->id, "type" => $communication->type, "name" => $communication->name, "value" => $communication->value); } return $return; } } ?>