public function render_institution_suggestions(Institution $institution) { $suggestions = array(); $isSingleCenter = $this->institutionService->isSingleCenter($institution); $label = $isSingleCenter ? 'clinic' : 'hospital'; if (!$isSingleCenter && !$institution->getInstitutionMedicalCenters()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-medkit icon-2x hca-red pull-left"></i></span>You currently have no centers for your ' . $label . ' yet.'); } if ($isSingleCenter) { $medicalCenter = $this->institutionService->getFirstMedicalCenter($institution); if (!$medicalCenter->getDoctors()->count()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-user-md icon-2x hca-red pull-left"></i></span>You currently dont have doctors for your ' . $label . ' yet.'); } } if (!$institution->getDescription()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-file icon-2x hca-red pull-left"></i></span>You currently have no <b>description</b> for your ' . $label . ' yet.'); } if (!$institution->getLogo()) { if ($institution->getPayingClient()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-h-sign icon-2x hca-red pull-left"></i></span> You have not yet added a <b>logo</b>. Upload it today and help patients make an instant brand connection between your clinic and the treatments you offer.'); } else { $suggestions[] = array('description' => '<span class="span1"><i class="icon-h-sign icon-2x hca-red pull-left"></i></span>Upgrade your listing today and have your <b>logo</b> show on your ' . ($isSingleCenter ? 'clinic page' : 'clinic pages') . '. '); } } if (!$institution->getFeaturedMedia()) { if ($institution->getPayingClient()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-picture icon-2x hca-red pull-left"></i></span>You have not yet uploaded your <b>cover photo</b>. Make use of this space to add a large image to establish your brand and reputation.'); } else { $suggestions[] = array('description' => '<span class="span1"><i class="icon-picture icon-2x hca-red pull-left"></i></span>Upgrade your listing today and have a <b>cover photo</b> show on your ' . ($isSingleCenter ? 'clinic page' : 'clinic pages') . '. Making use of this space to add a large image helps in establishing your brand and reputation.'); } } if ($this->institutionGalleryService->institutionHasPhotos($institution->getId())) { if ($institution->getPayingClient()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-film icon-2x hca-red pull-left"></i></span>You have not yet uploaded <b>photos or videos</b>. Beautiful photos and videos help give users a more complete image of your ' . $label . ', and makes decisions easier and more likely.'); } else { $suggestions[] = array('description' => '<span class="span1"><i class="icon-film icon-2x hca-red pull-left"></i></span>Upgrade your listing today to add <b>photos and videos</b>. Beautiful photos and videos help give users a more complete image of your ' . $label . ', and makes decisions easier and more likely.'); } } if (!$institution->getContactDetails()->count()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-phone icon-2x hca-red pull-left"></i></span>You currently have no <b>contact details</b> for your ' . $label . ' yet.'); } if (!$institution->getSocialMediaSites()) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-group icon-2x hca-red pull-left"></i></span>You currently have no <b>social media sites</b> for your ' . $label . ' yet.'); } if (!$this->institutionService->getAllGlobalAwards($institution)) { $suggestions[] = array('description' => '<span class="span1"><i class="icon-asterisk icon-2x hca-red pull-left"></i></span>You have not yet listed any <b>awards, certifications, affiliations or accreditations</b>. List your certifications and accreditations to help show that your clinics adhere to international standards of quality; list your awards and affiliations to show you are recognized by peers in your industry. '); } return $suggestions; }
public function preExecute() { parent::preExecute(); $this->repository = $this->getDoctrine()->getRepository('InstitutionBundle:InstitutionMedicalCenter'); $this->institutionService = $this->get('services.institution'); $this->request = $this->getRequest(); // NOTE: This code is not necessary anymore and can be remove. if ($imcId = $this->getRequest()->get('imcId', 0)) { $this->institutionMedicalCenter = $this->repository->find($imcId); } // End of note if ($this->isSingleCenter) { $this->institutionMedicalCenter = $this->institutionService->getFirstMedicalCenter($this->institution); } }
/** * Setting up the profile of the Single Center institution * * TODO: * This has a crappy rule where institution name and description will internally be the name and description of the clinic. * * @author acgvelarde * @return */ private function setupProfileSingleCenter(Request $request) { // Set Current Route $this->currentSignUpStep = $this->signUpService->getSingleCenterSignUpStepByRoute($request->attributes->get('_route')); $institutionMedicalCenter = $this->institutionService->getFirstMedicalCenter($this->institution); if (\is_null($institutionMedicalCenter)) { $institutionMedicalCenter = new InstitutionMedicalCenter(); } $this->get('services.contact_detail')->initializeContactDetails($this->institution, array(ContactDetailTypes::PHONE)); $form = $this->createForm(new InstitutionProfileFormType(), $this->institution, array(InstitutionProfileFormType::OPTION_BUBBLE_ALL_ERRORS => false)); if ($this->request->isMethod('POST')) { $formRequestData = $this->request->get($form->getName()); if (isset($formRequestData['medicalProviderGroups'])) { // we always expect 1 medical provider group // if it is empty remove it from the array if (isset($formRequestData['medicalProviderGroups'][0]) && '' == trim($formRequestData['medicalProviderGroups'][0])) { unset($formRequestData['medicalProviderGroups'][0]); } else { $formRequestData['medicalProviderGroups'][0] = str_replace(array("\\'", '\\"'), array("'", '"'), $formRequestData['medicalProviderGroups'][0]); } } // Check If Custom State if (!$formRequestData['state'] && ($stateName = $request->get('custom_state'))) { $stateData = array('name' => $stateName, 'geoCountry' => $formRequestData['country'], 'institutionId' => $this->institution->getId()); if ($state = $this->get('services.location')->addNewState($stateData)) { $formRequestData['state'] = $state->getId(); } } // Check If Custom City if (!(int) $formRequestData['city'] && ($cityName = $request->get('custom_city'))) { $cityData = array('name' => $cityName, 'geoState' => $formRequestData['state'], 'geoCountry' => $formRequestData['country'], 'institutionId' => $this->institution->getId()); if ($city = $this->get('services.location')->addNewCity($cityData)) { $formRequestData['city'] = $city->getId(); } } $form->bind($formRequestData); if ($form->isValid()) { $this->get('services.contact_detail')->removeInvalidContactDetails($this->institution); // set the sign up status of this single center institution $this->_updateInstitutionSignUpStepStatus($this->currentSignUpStep); $form->getData()->setSignupStepStatus($this->currentSignUpStep->getStepNumber()); // save institution and create an institution medical center $this->signUpService->completeProfileOfInstitutionWithSingleCenter($form->getData(), $institutionMedicalCenter); // get the next step redirect url $redirectUrl = $this->generateUrl($this->signUpService->getSingleCenterSignUpNextStep($this->currentSignUpStep)->getRoute(), array('imcId' => $this->institutionService->getFirstMedicalCenter($this->institution)->getId())); $request->getSession()->setFlash('success', "<b>Congratulations!</b> You have setup your Clinic profile."); //set flash message // TODO: Update this when we have formulated a strategy for our event system // We can't use InstitutionBundleEvents; we don't know the consequences of the event firing up other listeners. $this->get('event_dispatcher')->dispatch(MailerBundleEvents::NOTIFICATIONS_HOSPITAL_CREATED, new GenericEvent($this->institution)); return $this->redirect($redirectUrl); } else { $formErrors = $this->get('validator')->validate($form); $request->getSession()->setFlash('error', "We need you to correct some of your input. Please check the fields in red."); //set flash message } } return $this->render('InstitutionBundle:SignUp:setupProfile.singleCenter.html.twig', array('form' => $form->createView(), 'institutionMedicalCenter' => $institutionMedicalCenter, 'medicalProvidersJSON' => $this->getMedicalProviderGroupJSON())); }