Exemplo n.º 1
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return CultureFeed_Cdb_Data_ProductionDetailList
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     $detailList = new CultureFeed_Cdb_Data_ProductionDetailList();
     if (!empty($xmlElement->productiondetail)) {
         foreach ($xmlElement->productiondetail as $detailElement) {
             $detailList->add(CultureFeed_Cdb_Data_ProductionDetail::parseFromCdbXml($detailElement));
         }
     }
     return $detailList;
 }
Exemplo n.º 2
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement
  *     $xmlElement)
  *
  * @return CultureFeed_Cdb_Item_Production
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     if (empty($xmlElement->categories)) {
         throw new CultureFeed_ParseException('Categories are required for production element');
     }
     if (empty($xmlElement->productiondetails)) {
         throw new CultureFeed_ParseException('Production details are required for production element');
     }
     $attributes = $xmlElement->attributes();
     $production = new CultureFeed_Cdb_Item_Production();
     // Set ID.
     if (isset($attributes['cdbid'])) {
         $production->setCdbId((string) $attributes['cdbid']);
     }
     if (isset($attributes['externalid'])) {
         $production->setExternalId((string) $attributes['externalid']);
     }
     if (isset($event_attributes['availablefrom'])) {
         $production->setAvailableFrom((string) $event_attributes['availablefrom']);
     }
     if (isset($event_attributes['availableto'])) {
         $production->setAvailableTo((string) $event_attributes['availableto']);
     }
     if (isset($event_attributes['createdby'])) {
         $production->setCreatedBy((string) $event_attributes['createdby']);
     }
     if (isset($event_attributes['creationdate'])) {
         $production->setCreationDate((string) $event_attributes['creationdate']);
     }
     if (!empty($xmlElement->agefrom)) {
         $production->setAgeFrom((int) $xmlElement->agefrom);
     }
     // Set organiser.
     if (!empty($xmlElement->organiser)) {
         $production->setOrganiser(CultureFeed_Cdb_Data_Organiser::parseFromCdbXml($xmlElement->organiser));
     }
     // Set categories
     $production->setCategories(CultureFeed_Cdb_Data_CategoryList::parseFromCdbXml($xmlElement->categories));
     // Set production details.
     $production->setDetails(CultureFeed_Cdb_Data_ProductionDetailList::parseFromCdbXml($xmlElement->productiondetails));
     // Set max participants.
     if (!empty($xmlElement->maxparticipants)) {
         $production->setMaxParticipants((int) $xmlElement->maxparticipants);
     }
     // Set booking period.
     if (!empty($xmlElement->bookingperiod)) {
         $production->setBookingPeriod(CultureFeed_Cdb_Data_Calendar_BookingPeriod::parseFromCdbXml($xmlElement->bookingperiod));
     }
     // Set the related events for this production.
     if (!empty($xmlElement->relatedevents) && isset($xmlElement->relatedevents->id)) {
         foreach ($xmlElement->relatedevents->id as $relatedItem) {
             $attributes = $relatedItem->attributes();
             $production->addRelation(new CultureFeed_Cdb_Item_Reference((string) $attributes['cdbid']));
         }
     }
     // Set the keywords.
     self::parseKeywords($xmlElement, $production);
     return $production;
 }