table = $parameter['table']; } /** * Get Person Gender Identifier * * @see WBDatasource_Table::getIdentifier() * @return string */ public function getIdentifier() { return $this->table->getIdentifier(WBDatasource::TABLE_PERSONGENDER, true); } /** * Get Current Gender Id * * @return string */ public function getId() { if (empty($this->gender)) { return ''; } return $this->gender['id']; } /** * Load By Id * * @param string * @return bool true on success */ public function loadById($id) { if ($this->isOK() && $this->getId() == $id) { return true; } $this->gender = array(); $gender = $this->table->get(WBDatasource::TABLE_PERSONGENDER, $id); if (empty($gender)) { return false; } $this->gender = $gender[0]; return true; } /** * Check if Gender Data is Loaded * * @return bool */ public function isOK() { if (empty($this->gender)) { return false; } return true; } /** * Get Hello * * @param array * @return string */ public function getHello($data = array()) { if (!$this->isOK()) { return ''; } $genderSal = ''; $form = array('Hallo'); switch ($this->gender['id']) { case WBDatasource::PERSONGENDER_FEMALE: $genderSal = 'Frau'; break; case WBDatasource::PERSONGENDER_MALE: $genderSal = 'Herr'; break; case WBDatasource::PERSONGENDER_HIDDEN: case WBDatasource::PERSONGENDER_NEUTRAL: case WBDatasource::PERSONGENDER_OTHER: default: break; } if (empty($data['surname'])) { if (!empty($data['forename'])) { $form[] = '{FORENAME}'; } } else { if (!empty($genderSal)) { $form[] = $genderSal; } if (!empty($data['title'])) { $form[] = '{TITLE}'; } if (!empty($data['forename'])) { $form[] = '{FORENAME}'; } if (1 < count($form)) { $form[] = '{SURNAME}'; } } $form = implode(' ', $form); return WBString::populate($form, $data); } }