/** * This will group together all relevant links - clinic website, social media * sites, email, call us, etc in one variable. Its purpose is to make it easier * on the view side to display these links. * * NOTE: It is imperative that this return only the permitted links for each * paying status type. There will be no checking on the view side. * * Rules are here: https://basecamp.com/1876919/projects/3113924-health-care-abroad/todos/55796212-add-interface-to * */ public function getCenterLinks(InstitutionMedicalCenter $center, $url) { $links = array(); //Falls through; order of the elements in $links is significant switch ($center->getPayingClient()) { case PayingStatus::PHOTO_LISTING: case PayingStatus::LOGO_LISTING: case PayingStatus::LINKED_LISTING: $socialMediaSites = json_decode($center->getSocialMediaSites(), true); foreach ($socialMediaSites as $type => $value) { if ($value) { $links[$type] = array('tooltip' => "This hospital is on {$value}"); } } if ($website = $center->getWebsites()) { $links['website'] = array('tooltip' => "Website: {$website}"); } if ($number = $center->getContactNumber()) { $links['contactnumber'] = array('tooltip' => 'Call Us', 'value' => $url); } break; } $links['email'] = array('tooltip' => 'Email Us', 'value' => $url . '#form_feedback'); return $links; }
public function render_institution_medical_center_contact_number(InstitutionMedicalCenter $institutionMedicalCenter) { $contactNumber = \json_decode($institutionMedicalCenter->getContactNumber(), true); if (\is_null($contactNumber) || $contactNumber == '') { return null; } else { if (isset($contactNumber['country_code'])) { if (\preg_match('/^\\+/', $contactNumber['country_code'])) { $contactNumber['country_code'] = \preg_replace('/^\\++/', '+', $contactNumber['country_code']); } else { // append + to country code $contactNumber['country_code'] = '+' . $contactNumber['country_code']; } $result = \implode('-', $contactNumber); } else { if (isset($contactNumber['phone_number'])) { if (\preg_match('/^\\+/', $contactNumber['phone_number']['number'])) { $result = \preg_replace('/^\\++/', '+', $contactNumber['phone_number']['number']); } else { // append + to country code $result = '+' . $contactNumber['phone_number']['number']; } } } } return $result; }
public function saveContactDetail(InstitutionMedicalCenter $center) { $contactIdsArray = array(); $contactNumber = $center->getContactNumber(); $contactNumber = \json_decode($center->getContactNumber(), true); if (\is_array($contactNumber)) { if (isset($contactNumber['number'])) { $contactDetail = new ContactDetail(); $contactDetail->setNumber(isset($contactNumber['country_code']) ? $contactNumber['country_code'] : ''); $contactDetail->setAreaCode(isset($contactNumber['area_code']) ? $contactNumber['area_code'] : ''); $contactDetail->setNumber($contactNumber['number']); $contactDetail->setType(ContactDetailTypes::PHONE); $center->addContactDetail($contactDetail); } } return $center; }