Beispiel #1
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return CultureFeed_Cdb_Data_PeriodList
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     $timestampList = new CultureFeed_Cdb_Data_Calendar_TimestampList();
     if (!empty($xmlElement->timestamp)) {
         foreach ($xmlElement->timestamp as $timestampElement) {
             $timestampList->add(CultureFeed_Cdb_Data_Calendar_Timestamp::parseFromCdbXml($timestampElement));
         }
     }
     return $timestampList;
 }
Beispiel #2
0
 public function testCreateTestEvent20140108()
 {
     $event = new CultureFeed_Cdb_Item_Event();
     $event->setAvailableFrom('2014-01-08T00:00:00');
     $event->setAvailableTo('2014-02-21T00:00:00');
     $event->setCdbId('d53c2bc9-8f0e-4c9a-8457-77e8b3cab3d1');
     $event->setCreatedBy('*****@*****.**');
     $event->setCreationDate('2014-01-08T09:43:52');
     $event->setExternalId('CDB:c2156058-9393-4c95-8821-7787170527c0');
     $event->setIsParent(FALSE);
     $event->setLastUpdated('2014-01-08T09:46:41');
     $event->setLastUpdatedBy('*****@*****.**');
     $event->setOwner('CultuurNet Validatoren');
     $event->setPctComplete(95);
     $event->setPublished();
     $event->setValidator('CultuurNet Validatoren');
     $event->setWfStatus('approved');
     $event->setAgeFrom(5);
     $event->setPrivate(FALSE);
     $calender = new CultureFeed_Cdb_Data_Calendar_TimestampList();
     $calender->add(new CultureFeed_Cdb_Data_Calendar_Timestamp('2014-01-31', '12:00:00', '15:00:00'));
     $calender->add(new CultureFeed_Cdb_Data_Calendar_Timestamp('2014-02-20', '12:00:00', '15:00:00'));
     $event->setCalendar($calender);
     $categories = new CultureFeed_Cdb_Data_CategoryList();
     $categories->add(new CultureFeed_Cdb_Data_Category(CultureFeed_Cdb_Data_Category::CATEGORY_TYPE_THEME, '1.7.6.0.0', 'Griezelfilm of horror'));
     $categories->add(new CultureFeed_Cdb_Data_Category(CultureFeed_Cdb_Data_Category::CATEGORY_TYPE_PUBLICSCOPE, '6.0.0.0', 'Wijk of buurt'));
     $categories->add(new CultureFeed_Cdb_Data_Category(CultureFeed_Cdb_Data_Category::CATEGORY_TYPE_TARGET_AUDIENCE, '2.2.1.0.0', 'Vanaf kleuterleeftijd (3+)'));
     $categories->add(new CultureFeed_Cdb_Data_Category(CultureFeed_Cdb_Data_Category::CATEGORY_TYPE_FLANDERS_REGION, 'reg.1565', '1000 Brussel'));
     $categories->add(new CultureFeed_Cdb_Data_Category('umv', 'umv.7', 'Film'));
     $contactInfo = new CultureFeed_Cdb_Data_ContactInfo();
     $event->setContactInfo($contactInfo);
     $address = new CultureFeed_Cdb_Data_Address();
     $physicalAddress = new CultureFeed_Cdb_Data_Address_PhysicalAddress();
     $address->setPhysicalAddress($physicalAddress);
     $physicalAddress->setCity('Brussel');
     $physicalAddress->setCountry('BE');
     $geo = new CultureFeed_Cdb_Data_Address_GeoInformation('4.350000', '50.850000');
     $physicalAddress->setGeoInformation($geo);
     $physicalAddress->setStreet('Sint-Gislainstraat');
     $physicalAddress->setHouseNumber('62');
     $physicalAddress->setZip(1000);
     $contactInfo->addAddress($address);
     $mail = new CultureFeed_Cdb_Data_Mail('*****@*****.**');
     $contactInfo->addMail($mail);
     $phone = new CultureFeed_Cdb_Data_Phone('123');
     $contactInfo->addPhone($phone);
     $url = new CultureFeed_Cdb_Data_Url('http://www.test.com');
     $contactInfo->addUrl($url);
     $details = new CultureFeed_Cdb_Data_EventDetailList();
     $event->setDetails($details);
     $detailNl = new CultureFeed_Cdb_Data_EventDetail();
     $detailNl->setLanguage('nl');
     $detailNl->setCalendarSummary('vrij 31/01/14 van 12:00 tot 15:00 do 20/02/14 van 12:00 tot 15:00');
     $performers = new CultureFeed_Cdb_Data_PerformerList();
     $performers->add(new CultureFeed_Cdb_Data_Performer('Muzikant', 'Tim Vanhamel'));
     $performers->add(new CultureFeed_Cdb_Data_Performer('Director', 'Jon Dedonder'));
     $detailNl->setPerformers($performers);
     $details->add($detailNl);
     $media = $detailNl->getMedia();
     $media->rewind();
     $file = new CultureFeed_Cdb_Data_File();
     $file->setHLink('http://www.test.com');
     $file->setMediaType(CultureFeed_Cdb_Data_File::MEDIA_TYPE_IMAGEWEB);
     $file->setMain();
     $media->add($file);
     $file = new CultureFeed_Cdb_Data_File();
     $file->setCopyright('Zelf gemaakt');
     $file->setHLink('http://85.255.197.172/images/20140108/9554d6f6-bed1-4303-8d42-3fcec4601e0e.jpg');
     $file->setMediaType('', CultureFeed_Cdb_Data_File::MEDIA_TYPE_PHOTO);
     $file->setFileName('9554d6f6-bed1-4303-8d42-3fcec4601e0e.jpg');
     $media->add($file);
     $price = new CultureFeed_Cdb_Data_Price(4.0);
     $price->setDescription('Extra Korting voor vroegboekers');
     $detailNl->setPrice($price);
 }
Beispiel #3
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement
  *     $xmlElement)
  * @return CultureFeed_Cdb_Item_Event
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     if (empty($xmlElement->calendar)) {
         throw new CultureFeed_Cdb_ParseException('Calendar missing for event element');
     }
     if (empty($xmlElement->categories)) {
         throw new CultureFeed_Cdb_ParseException('Categories missing for event element');
     }
     if (empty($xmlElement->contactinfo)) {
         throw new CultureFeed_Cdb_ParseException('Contact info missing for event element');
     }
     if (empty($xmlElement->eventdetails)) {
         throw new CultureFeed_Cdb_ParseException('Eventdetails missing for event element');
     }
     if (empty($xmlElement->location)) {
         throw new CultureFeed_Cdb_ParseException('Location missing for event element');
     }
     $event_attributes = $xmlElement->attributes();
     $event = new CultureFeed_Cdb_Item_Event();
     CultureFeed_Cdb_Item_Base::parseCommonAttributes($event, $xmlElement);
     if (isset($event_attributes['private'])) {
         $event->setPrivate(filter_var((string) $event_attributes['private'], FILTER_VALIDATE_BOOLEAN));
     }
     if (isset($event_attributes['isparent'])) {
         $event->setIsParent(filter_var((string) $event_attributes['isparent'], FILTER_VALIDATE_BOOLEAN));
     }
     if (isset($event_attributes['pctcomplete'])) {
         $event->setPctComplete(floatval($event_attributes['pctcomplete']));
     }
     if (isset($event_attributes['published'])) {
         $event->setPublished(filter_var((string) $event_attributes['published'], FILTER_VALIDATE_BOOLEAN));
     }
     if (isset($event_attributes['validator'])) {
         $event->setValidator((string) $event_attributes['validator']);
     }
     if (isset($event_attributes['weight'])) {
         $event->setWeight((int) $event_attributes['weight']);
     }
     if (isset($xmlElement->agefrom)) {
         $event->setAgeFrom((int) $xmlElement->agefrom);
     }
     // Set calendar information.
     $calendar_type = key($xmlElement->calendar);
     if ($calendar_type == 'permanentopeningtimes') {
         $event->setCalendar(CultureFeed_Cdb_Data_Calendar_Permanent::parseFromCdbXml($xmlElement->calendar));
     } elseif ($calendar_type == 'timestamps') {
         $event->setCalendar(CultureFeed_Cdb_Data_Calendar_TimestampList::parseFromCdbXml($xmlElement->calendar->timestamps));
     } elseif ($calendar_type == 'periods') {
         $event->setCalendar(CultureFeed_Cdb_Data_Calendar_PeriodList::parseFromCdbXml($xmlElement->calendar));
     }
     // Set categories
     $event->setCategories(CultureFeed_Cdb_Data_CategoryList::parseFromCdbXml($xmlElement->categories));
     // Set contact information.
     $event->setContactInfo(CultureFeed_Cdb_Data_ContactInfo::parseFromCdbXml($xmlElement->contactinfo));
     // Set event details.
     $event->setDetails(CultureFeed_Cdb_Data_EventDetailList::parseFromCdbXml($xmlElement->eventdetails));
     // Set location.
     $event->setLocation(CultureFeed_Cdb_Data_Location::parseFromCdbXml($xmlElement->location));
     // Set organiser
     if (!empty($xmlElement->organiser)) {
         $event->setOrganiser(CultureFeed_Cdb_Data_Organiser::parseFromCdbXml($xmlElement->organiser));
     }
     // Set max participants.
     if (!empty($xmlElement->maxparticipants)) {
         $event->setMaxParticipants((int) $xmlElement->maxparticipants);
     }
     // Set booking period.
     if (!empty($xmlElement->bookingperiod)) {
         $event->setBookingPeriod(CultureFeed_Cdb_Data_Calendar_BookingPeriod::parseFromCdbXml($xmlElement->bookingperiod));
     }
     // Set relations.
     if (!empty($xmlElement->eventrelations) && !empty($xmlElement->eventrelations->relatedproduction)) {
         foreach ($xmlElement->eventrelations->relatedproduction as $relatedProduction) {
             $attributes = $relatedProduction->attributes();
             $event->addRelation(new CultureFeed_Cdb_Item_Reference((string) $attributes['cdbid'], (string) $relatedProduction, (string) $attributes['externalid']));
         }
     }
     self::parseKeywords($xmlElement, $event);
     if (!empty($xmlElement->languages)) {
         $event->setLanguages(CultureFeed_Cdb_Data_LanguageList::parseFromCdbXml($xmlElement->languages));
     }
     return $event;
 }