Example #1
0
 /**
  * Withdraw link for an production.
  *
  * @param CultureFeed_Cdb_Item_Production $production
  *   Production where the link will be removed for.
  * @param string $link
  *   Link to remove.
  */
 public function removeLinkFromProduction(CultureFeed_Cdb_Item_Production $production, $link)
 {
     $this->removeLink('production', $production->getCdbId(), $link);
 }
Example #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;
 }
Example #3
0
 /**
  * Parse a given xml element to an CultureFeed_Cdb_Item_Base.
  * @param SimpleXMLElement $xmlElement
  *   XML element from the item to parse.
  */
 public static function parseItem(SimpleXMLElement $xmlElement)
 {
     // Return the correct cdb item.
     switch ($xmlElement->getName()) {
         case 'event':
             return CultureFeed_Cdb_Item_Event::parseFromCdbXml($xmlElement);
         case 'production':
             return CultureFeed_Cdb_Item_Production::parseFromCdbXml($xmlElement);
         case 'actor':
             return CultureFeed_Cdb_Item_Actor::parseFromCdbXml($xmlElement);
         default:
             return NULL;
     }
 }