public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->options = $options;
     $medicalCenter = $this->options['data'];
     $status = InstitutionMedicalCenterStatus::getStatusList();
     if (!$medicalCenter instanceof InstitutionMedicalCenter) {
         throw new \Exception(__CLASS__ . ' expects data to be instance of InstitutionMedicalCenter');
     }
     $this->institution = $medicalCenter->getInstitution();
     if (!$medicalCenter->getId()) {
         $medicalCenter->setWebsites($this->institution->getWebsites());
         $medicalCenter->setSocialMediaSites($this->institution->getSocialMediaSites());
         $medicalCenter->setAddress($this->institution->getAddress1());
         $medicalCenter->setAddressHint($this->institution->getAddressHint());
         $medicalCenter->setContactEmail($this->institution->getContactEmail());
     }
     $imcProperty = new InstitutionMedicalCenterProperty();
     $this->_add($builder, 'name', 'text', array('label' => 'Name'));
     $this->_add($builder, 'description', 'textarea', array('label' => 'Short Description Of The Clinic', 'attr' => array('rows' => 4)));
     $this->_add($builder, 'businessHours', 'fancy_business_hours');
     $this->_add($builder, 'state', 'state_list', array('label' => 'State or Province', 'disabled' => 'disabled', 'virtual' => true));
     $this->_add($builder, 'contactEmail', 'email', array('label' => 'Email'));
     $this->_add($builder, 'contactDetails', 'collection', array('label' => 'Clinic Phone Number', 'type' => 'simple_contact_detail'));
     $this->_add($builder, 'status', 'choice', array('label' => 'Status', 'choices' => $status));
     $this->_add($builder, 'websites', 'website_custom_field', array('label' => 'Clinic Website', 'required' => false));
     $this->_add($builder, 'socialMediaSites', 'social_media_sites_custom_field', array('attr' => array('value' => $this->institution->getSocialMediaSites())));
     $this->_add($builder, 'address', 'detailed_street_address', array('label' => 'Address', 'attr' => array('value' => $this->institution->getAddress1())));
     $this->_add($builder, 'addressHint', 'text', array('label' => 'Helpful hint for getting there?', 'required' => false));
     $this->_add($builder, 'timeZone', 'text', array('label' => 'Timezone', 'virtual' => true, 'disabled' => 'disabled'));
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->options = $options;
     $medicalCenter = $this->options['data'];
     $status = InstitutionMedicalCenterStatus::getStatusList();
     if (!$medicalCenter instanceof InstitutionMedicalCenter) {
         throw new \Exception(__CLASS__ . ' expects data to be instance of InstitutionMedicalCenter');
     }
     $this->institution = $medicalCenter->getInstitution();
     $imcProperty = new InstitutionMedicalCenterProperty();
     $this->_add($builder, 'name', 'text', array('label' => 'Clinic Name'));
     $this->_add($builder, 'description', 'textarea', array('label' => 'Short description of the clinic', 'attr' => array('rows' => 4), 'required' => false));
     $this->_add($builder, 'isAlwaysOpen', 'choice', array('choices' => array(1 => 'Open 24 hours a day 7 days a week', 0 => 'Specific Schedule'), 'expanded' => true));
     $this->_add($builder, 'businessHours', 'fancy_business_hours');
     $this->_add($builder, 'city', 'text', array('disabled' => 'disabled', 'virtual' => true, 'attr' => array('value' => $this->institution->getCity())));
     $this->_add($builder, 'zipCode', 'text', array('label' => 'Zip / Postal Code ', 'disabled' => 'disabled', 'virtual' => true, 'attr' => array('value' => $this->institution->getZipCode())));
     $this->_add($builder, 'state', 'text', array('label' => 'State or Province', 'disabled' => 'disabled', 'virtual' => true, 'attr' => array('value' => $this->institution->getState())));
     $this->_add($builder, 'country', 'text', array('label' => 'Country', 'disabled' => 'disabled', 'virtual' => true, 'attr' => array('value' => $this->institution->getCountry())));
     $this->_add($builder, 'contactEmail', 'text', array('label' => 'Email Address', 'required' => false));
     $this->_add($builder, 'contactDetails', 'collection', array('label' => 'Phone Number', 'type' => 'simple_contact_detail'));
     $this->_add($builder, 'status', 'choice', array('label' => 'Status', 'choices' => $status));
     if (!$medicalCenter->getId()) {
         $medicalCenter->setWebsites($this->institution->getWebsites());
     }
     $this->_add($builder, 'websites', 'website_custom_field', array('label' => 'Website', 'required' => false));
     $this->_add($builder, 'socialMediaSites', 'social_media_sites_custom_field');
     $this->_add($builder, 'address', 'detailed_street_address', array('constraints' => array(new NotBlank(array('message' => 'Please provide a valid address.')))));
     $this->_add($builder, 'addressHint', 'text', array('label' => 'Helpful hint for getting there?', 'required' => false));
     $this->_add($builder, 'timeZone', 'text', array('label' => 'Timezone', 'virtual' => true, 'disabled' => 'disabled'));
     $this->_add($builder, 'services', 'institutionServices_list', array('mapped' => false, 'centers' => true));
     $this->_add($builder, 'awards', 'institutionGlobalAwards_list', array('mapped' => false, 'centers' => true));
     $this->_add($builder, 'coordinates', 'hidden', array('attr' => array('value' => $medicalCenter->getCoordinates() ? $medicalCenter->getCoordinates() : $this->institution->getCoordinates())));
 }
 function setFilterOptions()
 {
     $statusFilterOptions = array(ListFilter::FILTER_KEY_ALL => ListFilter::FILTER_LABEL_ALL);
     if (isset($this->queryParams['isInstitutionContext']) && $this->queryParams['isInstitutionContext']) {
         $statusFilterOptions += InstitutionMedicalCenterStatus::getStatusListForInstitutionContext();
     } else {
         $statusFilterOptions += InstitutionMedicalCenterStatus::getStatusList();
     }
     $this->setStatusFilterOption($statusFilterOptions);
 }
 public function getStatusLabel(InstitutionMedicalCenter $institutionMedicalCenter)
 {
     $statuses = InstitutionMedicalCenterStatus::getStatusList();
     return \array_key_exists($institutionMedicalCenter->getStatus(), $statuses) ? $statuses[$institutionMedicalCenter->getStatus()] : '';
 }
 /**
  * @PreAuthorize("hasAnyRole('SUPER_ADMIN', 'CAN_VIEW_INSTITUTIONS')")
  */
 public function viewNewlyAddedClinicsAction()
 {
     $criteria = array('isFromInternalAdmin' => null, 'status' => InstitutionMedicalCenterStatus::DRAFT);
     $centers = $this->getDoctrine()->getRepository('InstitutionBundle:InstitutionMedicalCenter')->findBy($criteria);
     $params = array('institutionMedicalCenters' => $centers, 'statusList' => InstitutionMedicalCenterStatus::getStatusList());
     return $this->render('AdminBundle:Institution:newlyAddedClinics.html.twig', $params);
 }