Exemplo n.º 1
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  *
  * @return CultureFeed_Uitpas_CardSystem
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $card_system = new static();
     $card_system->id = $object->xpath_int('id');
     $card_system->name = $object->xpath_str('name');
     $card_system->distributionKeys = array();
     foreach ($object->xpath('distributionKeys/distributionKey') as $distributionKey) {
         $card_system->distributionKeys[] = CultureFeed_Uitpas_DistributionKey::createFromXML($distributionKey, FALSE);
     }
     return $card_system;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getDistributionKeysForOrganizer($cdbid)
 {
     $result = $this->oauth_client->consumerGetAsXML('uitpas/distributionkey/organiser/' . $cdbid, array());
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $distribution_keys = array();
     foreach ($xml->xpath('/response/cardSystems/cardSystem') as $cardSystemXml) {
         $cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($cardSystemXml);
         $objects = $cardSystemXml->xpath('distributionKeys/distributionKey');
         foreach ($objects as $object) {
             $distributionKey = CultureFeed_Uitpas_DistributionKey::createFromXML($object);
             $distributionKey->cardSystem = $cardSystem;
             $distribution_keys[] = $distributionKey;
         }
     }
     $total = count($distribution_keys);
     return new CultureFeed_ResultSet($total, $distribution_keys);
 }
Exemplo n.º 3
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $event = new CultureFeed_Uitpas_Event_CultureEvent();
     $event->cdbid = $object->xpath_str('cdbid');
     $event->locationId = $object->xpath_str('locationId');
     $event->locationName = $object->xpath_str('locationName');
     $event->organiserId = $object->xpath_str('organiserId');
     $event->organiserName = $object->xpath_str('organiserName');
     $event->city = $object->xpath_str('city');
     $event->checkinAllowed = $object->xpath_bool('checkinAllowed');
     $event->checkinConstraint = CultureFeed_Uitpas_Event_CheckinConstraint::createFromXML($object->xpath('checkinConstraint', false));
     $event->checkinConstraintReason = $object->xpath_str('checkinConstraintReason');
     $event->checkinStartDate = $object->xpath_time('checkinStartDate');
     $event->checkinEndDate = $object->xpath_time('checkinEndDate');
     $event->buyConstraintReason = $object->xpath_str('buyConstraintReason');
     $event->price = $object->xpath_float('price');
     $event->tariff = $object->xpath_float('tariff');
     $event->title = $object->xpath_str('title');
     $object->registerXPathNamespace('cdb', CultureFeed_Cdb_Default::CDB_SCHEME_URL);
     $calendar_xml = $object->xpath('cdb:calendar', false);
     if (!empty($calendar_xml)) {
         $event->calendar = CultureFeed_Uitpas_Calendar::createFromXML($calendar_xml);
     }
     $event->numberOfPoints = $object->xpath_int('numberOfPoints');
     $event->gracePeriodMonths = $object->xpath_int('gracePeriodMonths');
     $event->cardSystems = array();
     foreach ($object->xpath('cardSystems/cardSystem') as $cardSystem) {
         $event->cardSystems[] = CultureFeed_Uitpas_CardSystem::createFromXML($cardSystem);
     }
     $event->ticketSales = array();
     foreach ($object->xpath('ticketSales/ticketSale') as $ticketSale) {
         $event->ticketSales[] = CultureFeed_Uitpas_Event_TicketSale_Opportunity::createFromXml($ticketSale);
     }
     $event->distributionKey = array();
     foreach ($object->xpath('distributionKeys/distributionKey') as $distributionKey) {
         $event->distributionKey[] = CultureFeed_Uitpas_DistributionKey::createFromXML($distributionKey);
     }
     return $event;
 }