示例#1
0
 /**
  * Sets the data of a place model based on the data given in $formData.
  *
  * @param tx_seminars_Model_Place $place the place model to set the data
  * @param string $prefix the prefix of the form fields in $formData
  * @param array[] $formData the form data to use for setting the place data
  *
  * @return void
  */
 private static function setPlaceData(tx_seminars_Model_Place $place, $prefix, array $formData)
 {
     $countryUid = (int) $formData[$prefix . 'country'];
     if ($countryUid > 0) {
         try {
             /** @var tx_oelib_Mapper_Country $mapper */
             $mapper = Tx_Oelib_MapperRegistry::get('tx_oelib_Mapper_Country');
             /** @var Tx_Oelib_Model_Country $country */
             $country = $mapper->find($countryUid);
         } catch (Exception $exception) {
             $country = NULL;
         }
     } else {
         $country = NULL;
     }
     $place->setTitle(trim(strip_tags($formData[$prefix . 'title'])));
     $place->setAddress(trim(strip_tags($formData[$prefix . 'address'])));
     $place->setZip(trim(strip_tags($formData[$prefix . 'zip'])));
     $place->setCity(trim(strip_tags($formData[$prefix . 'city'])));
     $place->setCountry($country);
     $place->setHomepage(trim(strip_tags($formData[$prefix . 'homepage'])));
     $place->setDirections(trim($formData[$prefix . 'directions']));
     $place->setNotes(trim(strip_tags($formData[$prefix . 'notes'])));
 }
 /**
  * Formats a place for the thank-you e-mail.
  *
  * @param tx_seminars_Model_Place $place the place to format
  * @param string $newline the newline to use in formatting, must be either LF or '<br />'
  *
  * @return string the formatted place, will not be empty
  */
 private function formatPlace(tx_seminars_Model_Place $place, $newline)
 {
     $address = preg_replace('/[\\n|\\r]+/', ' ', str_replace('<br />', ' ', strip_tags($place->getAddress())));
     $countryName = $place->hasCountry() ? ', ' . $place->getCountry()->getLocalShortName() : '';
     $zipAndCity = trim($place->getZip() . ' ' . $place->getCity());
     return $place->getTitle() . $newline . $address . $newline . $zipAndCity . $countryName;
 }
示例#3
0
 /**
  * @test
  */
 public function setNotesSetsNotes()
 {
     $this->fixture->setNotes('Nothing of interest.');
     self::assertEquals('Nothing of interest.', $this->fixture->getNotes());
 }