/**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_Event_TicketSale_Opportunity
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $opportunity = new CultureFeed_Uitpas_Event_TicketSale_Opportunity();
     $opportunity->type = CultureFeed_Uitpas_Event_TicketSale_Opportunity::TYPE_DEFAULT;
     if (isset($object['type'])) {
         $opportunity->type = (string) $object['type'];
     }
     $opportunity->buyConstraintReason = $object->xpath_str('buyConstraintReason', FALSE);
     foreach ($object->xpath('priceClasses/priceClass') as $priceClass) {
         $opportunity->priceClasses[] = CultureFeed_Uitpas_Event_PriceClass::createFromXml($priceClass);
     }
     $couponElement = $object->xpath('ticketSaleCoupon', FALSE);
     if ($couponElement instanceof CultureFeed_SimpleXMLElement) {
         $opportunity->ticketSaleCoupon = CultureFeed_Uitpas_Event_TicketSale_Coupon::createFromXml($couponElement);
     }
     $remainingForEventElement = $object->xpath('remainingForEvent', FALSE);
     if ($remainingForEventElement instanceof CultureFeed_SimpleXMLElement) {
         $opportunity->remainingForEvent = CultureFeed_Uitpas_PeriodConstraint::createFromXml($remainingForEventElement);
     }
     $remainingTotalElement = $object->xpath('remainingTotal', FALSE);
     if ($remainingTotalElement instanceof CultureFeed_SimpleXMLElement) {
         $opportunity->remainingTotal = CultureFeed_Uitpas_PeriodConstraint::createFromXml($remainingTotalElement);
     }
     return $opportunity;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $price = new CultureFeed_Uitpas_Passholder_UitpasPrice();
     $price->id = $object->xpath_str('id');
     $price->reason = $object->xpath_str('reason');
     $price->kansenStatuut = $object->xpath_bool('kansenstatuut');
     $price->price = $object->xpath_float('price');
     $price->cardType = $object->xpath_str('cardType');
     $ageRange = $object->xpath('ageRange', FALSE);
     if ($ageRange) {
         $ageFrom = $ageRange->xpath_int('ageFrom', FALSE);
         if ($ageFrom) {
             $price->ageRange->ageFrom = $ageFrom;
         }
         $ageTo = $ageRange->xpath_int('ageTo', FALSE);
         if ($ageTo) {
             $price->ageRange->ageTo = $ageTo;
         }
     }
     $voucherType = $object->xpath('voucherType', FALSE);
     if ($voucherType) {
         $price->voucherType = new CultureFeed_Uitpas_Passholder_VoucherType();
         $name = $voucherType->xpath_str('name', FALSE);
         if ($name) {
             $price->voucherType->name = $name;
         }
         $prefix = $voucherType->xpath_str('prefix', FALSE);
         if ($prefix) {
             $price->voucherType->prefix = $prefix;
         }
     }
     $price->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($object->xpath('cardSystem', FALSE));
     return $price;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $result = new self();
     $result->passholder = CultureFeed_Uitpas_Passholder::createFromXML($xml->xpath('passHolder', false));
     foreach ($xml->xpath('actions/action') as $action) {
         $result->addActionFromXML($action);
     }
     return $result;
 }
Example #4
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  * @return self
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $identity = new static();
     $cardXml = $object->xpath('card', false);
     $identity->card = CultureFeed_Uitpas_Passholder_Card::createFromXml($cardXml);
     $passHolderXml = $object->xpath('passHolder', false);
     if ($passHolderXml instanceof CultureFeed_SimpleXMLElement) {
         $identity->passHolder = CultureFeed_Uitpas_Passholder::createFromXML($passHolderXml);
     }
     $groupPassXml = $object->xpath('groupPass', false);
     if ($groupPassXml instanceof CultureFeed_SimpleXMLElement) {
         $identity->groupPass = CultureFeed_Uitpas_GroupPass::createFromXml($groupPassXml);
     }
     return $identity;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_WelcomeAdvantageResponse
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $response = new self();
     $response->code = $xml->xpath_str('code');
     $response->promotion = CultureFeed_Uitpas_Passholder_WelcomeAdvantage::createFromXML($xml->xpath('promotion', false));
     return $response;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $eventActions = new self();
     $eventActions->passholder = CultureFeed_Uitpas_Passholder::createFromXML($xml->xpath('passHolder', FALSE));
     $eventActions->welcomeAdvantages = CultureFeed_Uitpas_Passholder_WelcomeAdvantageResultSet::createFromXML($xml->xpath('welcomeAdvantages', FALSE), 'welcomeAdvantage');
     $eventActions->pointsPromotions = CultureFeed_Uitpas_Passholder_PointsPromotionResultSet::createFromXML($xml->xpath('pointsPromotions', FALSE), 'pointsPromotion');
     $eventCheckin = $xml->xpath('eventCheckin', FALSE);
     if ($eventCheckin instanceof CultureFeed_SimpleXMLElement) {
         $eventActions->eventCheckin = CultureFeed_Uitpas_Passholder_EventCheckin::createFromXML($eventCheckin);
     }
     $eventBuyTicket = $xml->xpath('eventBuyTicket', FALSE);
     if ($eventBuyTicket instanceof CultureFeed_SimpleXMLElement) {
         $eventActions->eventBuyTicket = CultureFeed_Uitpas_Passholder_EventBuyTicket::createFromXML($eventBuyTicket);
     }
     return $eventActions;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_Passholder_CardSystemSpecific
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $cardSystemSpecific = new self();
     $cardSystemSpecific->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXml($object->xpath('cardSystem', false));
     $currentCard = $object->xpath('currentCard', false);
     if ($currentCard instanceof CultureFeed_SimpleXMLElement) {
         $cardSystemSpecific->currentCard = CultureFeed_Uitpas_Passholder_Card::createFromXML($currentCard);
     }
     $cardSystemSpecific->emailPreference = $object->xpath_str('emailPreference');
     $cardSystemSpecific->smsPreference = $object->xpath_str('smsPreference');
     $cardSystemSpecific->kansenStatuut = $object->xpath_bool('kansenStatuut');
     $cardSystemSpecific->kansenStatuutExpired = $object->xpath_bool('kansenStatuutExpired');
     $cardSystemSpecific->kansenStatuutEndDate = $object->xpath_time('kansenStatuutEndDate');
     $cardSystemSpecific->kansenStatuutInGracePeriod = $object->xpath_bool('kansenStatuutInGracePeriod');
     $cardSystemSpecific->status = $object->xpath_str('status');
     return $cardSystemSpecific;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $distribution_key = new CultureFeed_Uitpas_DistributionKey();
     $distribution_key->id = $object->xpath_int('id');
     $distribution_key->name = $object->xpath_str('name');
     $distribution_key->conditions = array();
     foreach ($object->xpath('conditions/condition') as $condition) {
         $distribution_key->conditions[] = CultureFeed_Uitpas_DistributionKey_Condition::createFromXML($condition, FALSE);
     }
     foreach ($object->xpath('priceClasses/priceClass') as $priceClass) {
         $distribution_key->priceClasses[] = CultureFeed_Uitpas_Event_PriceClass::createFromXML($priceClass);
     }
     $distribution_key->tariff = $object->xpath_str('tariff');
     $distribution_key->automatic = $object->xpath_bool('automatic');
     $distribution_key->sameRegion = $object->xpath_bool('sameRegion');
     return $distribution_key;
 }
Example #9
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  *
  * @return self
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $instance = new static();
     $instance->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($object->xpath('cardSystem', FALSE));
     $instance->uitpasNumber = $object->xpath_str('uitpasNumber');
     $instance->status = $object->xpath_str('status');
     $instance->type = $object->xpath_str('cardType');
     return $instance;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $card_counter = new CultureFeed_Uitpas_Counter_CardCounter();
     $card_counter->status = $object->xpath_str('status');
     $card_counter->kansenstatuut = $object->xpath_bool('kansenstatuut');
     $card_counter->count = $object->xpath_int('count');
     $card_counter->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($object->xpath('cardSystem', FALSE));
     return $card_counter;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml, $promotionElementName = 'promotion')
 {
     $advantages = array();
     $objects = $xml->xpath('promotions/' . $promotionElementName);
     $total = $xml->xpath_int('total');
     foreach ($objects as $object) {
         $advantages[] = CultureFeed_Uitpas_Passholder_WelcomeAdvantage::createFromXML($object);
     }
     return new self($total, $advantages);
 }
 /**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_PointsPromotionsResponse
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $response = new self();
     $response->code = $xml->xpath_str('code');
     $response->promotion = CultureFeed_Uitpas_Passholder_PointsPromotion::createFromXML($xml->xpath('promotion', false));
     if ($response->code === 'ACTION_NOT_ALLOWED') {
         $response->cashInState = $xml->xpath_str('cashInState');
     }
     return $response;
 }
Example #13
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;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $xml
  * @return Culturefeed_Uitpas_Passholder_ExecuteEventActionsResultAction
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $xml)
 {
     $action = new self();
     $action->actionType = $xml->xpath_str('actionType');
     switch ($action->actionType) {
         case self::TYPE_CHECKIN:
             $action->checkinResponse = CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_CheckinResponse::createFromXML($xml->xpath('checkinResponse', false));
             break;
         case self::TYPE_BUYTICKET:
             $action->buyTicketResponse = CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_BuyTicketResponse::createFromXML($xml->xpath('buyTicketResponse', false));
             break;
         case self::TYPE_CASHIN_POINTSPROMOTION:
             $action->pointsPromotionsResponse = CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_PointsPromotionsResponse::createFromXML($xml->xpath('pointsPromotionsResponse', false));
             break;
         case self::TYPE_CASHIN_WELCOMEADVANTAGE:
             $action->welcomeAdvantageResponse = CultureFeed_Uitpas_Passholder_ExecuteEventActionsResult_WelcomeAdvantageResponse::createFromXML($xml->xpath('welcomeAdvantageResponse', false));
             break;
     }
     return $action;
 }
Example #15
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $object->registerXPathNamespace('cdb', CultureFeed_Cdb_Default::CDB_SCHEME_URL);
     $calendar = new CultureFeed_Uitpas_Calendar();
     foreach ($object->xpath('cdb:periods/cdb:period') as $timeObject) {
         $timeObject->registerXPathNamespace('cdb', CultureFeed_Cdb_Default::CDB_SCHEME_URL);
         $period = new CultureFeed_Uitpas_Calendar_Period();
         $period->datefrom = $timeObject->xpath_time('cdb:datefrom');
         $period->dateto = $timeObject->xpath_time('cdb:dateto');
         $calendar->addPeriod($period);
     }
     foreach ($object->xpath('cdb:timestamps/cdb:timestamp') as $timeObject) {
         $timeObject->registerXPathNamespace('cdb', CultureFeed_Cdb_Default::CDB_SCHEME_URL);
         $timestamp = new CultureFeed_Uitpas_Calendar_Timestamp();
         $timestamp->date = $timeObject->xpath_time('cdb:date');
         $timestamp->timestart = $timeObject->xpath_str('cdb:timestart');
         $timestamp->timeend = $timeObject->xpath_str('cdb:timeend');
         $calendar->addTimestamp($timestamp);
     }
     return $calendar;
 }
Example #16
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $device = new CultureFeed_Uitpas_Counter_Device();
     $device->name = $object->xpath_str('name');
     $device->consumerKey = $object->xpath_str('consumerKey');
     $device->status = $object->xpath_str('status');
     $device->cdbid = $object->xpath_str('cdbid');
     foreach ($object->xpath('balies/balie') as $balie) {
         $device->counters[] = CultureFeed_Uitpas_Counter::createFromXml($balie);
     }
     return $device;
 }
Example #17
0
 /**
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_Event_TicketSale_Coupon
  */
 public static function createFromXml(CultureFeed_SimpleXMLElement $object)
 {
     $coupon = new CultureFeed_Uitpas_Event_TicketSale_Coupon();
     $coupon->id = $object->xpath_str('id', FALSE);
     $coupon->name = $object->xpath_str('name', FALSE);
     $coupon->description = $object->xpath_str('description', FALSE);
     $coupon->validFrom = $object->xpath_time('validFrom');
     $coupon->validTo = $object->xpath_time('validTo');
     $exchangeConstraintElement = $object->xpath('exchangeConstraint', FALSE);
     if ($exchangeConstraintElement instanceof CultureFeed_SimpleXMLElement) {
         $coupon->exchangeConstraint = CultureFeed_Uitpas_PeriodConstraint::createFromXML($exchangeConstraintElement);
     }
     $buyConstraintElement = $object->xpath('buyConstraint', FALSE);
     if ($buyConstraintElement instanceof CultureFeed_SimpleXMLElement) {
         $coupon->buyConstraint = CultureFeed_Uitpas_PeriodConstraint::createFromXML($buyConstraintElement);
     }
     $remainingTotalElement = $object->xpath('remainingTotal', FALSE);
     if ($remainingTotalElement instanceof CultureFeed_SimpleXMLElement) {
         $coupon->remainingTotal = CultureFeed_Uitpas_PeriodConstraint::createFromXML($remainingTotalElement);
     }
     return $coupon;
 }
 /**
  * @param string $code.
  * @param CultureFeed_SimpleXMLElement $xml
  *
  * @return self
  */
 public static function createFromXML($code, $xml)
 {
     $message = $xml->xpath_str('/response/message');
     $exception = new static($message, $code);
     if ($code == 'INSZ_ALREADY_USED') {
         $exception->cardSystemLinks = array();
         foreach ($xml->xpath('cardSystemLinks/cardSystemLink') as $cardSystemLink) {
             $cardSystemId = $cardSystemLink->xpath_int('cardSystem/id', FALSE);
             $exception->cardSystemLinks[$cardSystemId] = CultureFeed_Uitpas_CardInfo::createFromXml($cardSystemLink, FALSE);
         }
         $exception->userId = $xml->xpath_str('/response/userId');
     }
     return $exception;
 }
Example #19
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $counter = new CultureFeed_Uitpas_Counter_Employee();
     $counter->id = $object->xpath_str('id');
     $counter->consumerKey = $object->xpath_str('consumerKey');
     $counter->name = $object->xpath_str('name');
     $counter->role = $object->xpath_str('role');
     $counter->actorId = $object->xpath_str('actorId');
     foreach ($object->xpath('cardSystems/cardSystem') as $card_system) {
         $cardSystem = CultureFeed_Uitpas_Counter_EmployeeCardSystem::createFromXml($card_system);
         $counter->cardSystems[$cardSystem->id] = $cardSystem;
     }
     return $counter;
 }
Example #20
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $membership = new CultureFeed_Uitpas_Passholder_Membership();
     $membership->id = $object->xpath_str('id');
     $membership->association = CultureFeed_Uitpas_Association::createFromXML($object->xpath('association', false));
     $membership->associationId = $object->xpath_str('association/id');
     $membership->name = $object->xpath_str('association/name');
     $membership->endDate = $object->xpath_time('endDate');
     $membership->renewable = $object->xpath_bool('renewable');
     $membership->newEndDate = $object->xpath_time('newEndDate');
     $membership->renewDate = $object->xpath_time('renewDate');
     $membership->expired = $object->xpath_bool('expired');
     return $membership;
 }
Example #21
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $card = new CultureFeed_Uitpas_Passholder_Card();
     $card->city = $object->xpath_str('city');
     $card->uitpasNumber = $object->xpath_str('uitpasNumber/uitpasNumber');
     $card->kansenpas = $object->xpath_bool('kansenpas');
     $card->status = $object->xpath_str('status');
     $card->type = $object->xpath_str('cardType');
     $cardSystemXml = $object->xpath('cardSystem', false);
     if ($cardSystemXml instanceof CultureFeed_SimpleXMLElement) {
         $card->cardSystem = CultureFeed_Uitpas_CardSystem::createFromXML($cardSystemXml);
     } elseif (!is_null($object->xpath_int('cardSystemId'))) {
         $card->cardSystem = new CultureFeed_Uitpas_CardSystem();
         $card->cardSystem->id = $object->xpath_int('cardSystemId');
         $card->cardSystem->name = '';
     }
     return $card;
 }
Example #22
0
 /**
  * @see CultureFee_Messages::getMessageCount().
  */
 public function getMessageCount()
 {
     $result = $this->oauth_client->authenticatedGetAsXml('message/totals');
     try {
         $xmlElement = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $message_count = array();
     $total = $xmlElement->xpath('/response/total');
     if (!$total) {
         return array();
     }
     foreach ($total as $count) {
         $attributes = $count->attributes();
         $message_count[(string) $attributes['type']] = (string) $count;
     }
     return $message_count;
 }
 /**
  * @param CultureFeed_SimpleXMLElement $object
  *
  * @return static
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $instance = new static();
     $instance->id = $object->xpath_int('id');
     $instance->name = $object->xpath_str('name');
     foreach ($object->xpath('cardSystems/cardSystem') as $cardSystemNode) {
         $instance->cardSystems[] = CultureFeed_Uitpas_CardSystem::createFromXML($cardSystemNode);
     }
     $instance->permissionRead = $object->xpath_bool('permissionRead');
     $instance->permissionRegister = $object->xpath_bool('permissionRegister');
     $instance->enddateCalculation = $object->xpath_str('enddateCalculation');
     switch ($instance->enddateCalculation) {
         case CultureFeed_Uitpas_EndDateCalculation::FREE:
             $instance->enddateCalculationFreeDate = $object->xpath_time('enddateCalculationFreeDate');
             break;
         case CultureFeed_Uitpas_EndDateCalculation::BASED_ON_REGISTRATION_DATE:
         case CultureFeed_Uitpas_EndDateCalculation::BASED_ON_DATE_OF_BIRTH:
             $instance->enddateCalculationValidityTime = $object->xpath_int('enddateCalculationValidityTime');
             break;
         default:
     }
     return $instance;
 }
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $promotion = new CultureFeed_Uitpas_Passholder_PointsPromotion();
     $promotion->id = $object->xpath_int('id');
     $promotion->inSpotlight = $object->xpath_bool('inSpotlight');
     $promotion->title = $object->xpath_str('title');
     $promotion->description1 = $object->xpath_str('description1');
     $promotion->description2 = $object->xpath_str('description2');
     $promotion->pictures = $object->xpath_str('pictures/picture', TRUE);
     if (NULL === $promotion->pictures) {
         $promotion->pictures = array();
     }
     $promotion->publicationPeriodBegin = $object->xpath_time('publicationPeriodBegin');
     $promotion->publicationPeriodEnd = $object->xpath_time('publicationPeriodEnd');
     $promotion->points = $object->xpath_int('points');
     $promotion->cashedIn = $object->xpath_bool('cashedIn');
     $promotion->counters = array();
     foreach ($object->xpath('balies/balie') as $counter) {
         $promotion->counters[] = CultureFeed_Uitpas_Passholder_Counter::createFromXML($counter);
     }
     $promotion->creationDate = $object->xpath_time('creationDate');
     $promotion->cashingPeriodBegin = $object->xpath_time('cashingPeriodBegin');
     $promotion->cashingPeriodEnd = $object->xpath_time('cashingPeriodEnd');
     $promotion->validForCities = $object->xpath_str('validForCities/city', TRUE);
     if (NULL === $promotion->validForCities) {
         $promotion->validForCities = array();
     }
     $promotion->maxAvailableUnits = $object->xpath_int('maxAvailableUnits');
     $promotion->unitsTaken = $object->xpath_int('unitsTaken');
     $promotion->cashInState = $object->xpath_str('cashInState');
     $periodConstraint = $object->xpath('periodConstraint', FALSE);
     if (!empty($periodConstraint)) {
         $promotion->periodConstraint = CultureFeed_Uitpas_Passholder_PeriodConstraint::createFromXml($periodConstraint);
     }
     $owningCardSystem = $object->xpath('owningCardSystem', FALSE);
     if ($owningCardSystem instanceof CultureFeed_SimpleXMLElement) {
         $promotion->owningCardSystem = CultureFeed_Uitpas_CardSystem::createFromXml($owningCardSystem);
     }
     $applicableCardSystems = $object->xpath('applicableCardSystems/cardsystem');
     foreach ($applicableCardSystems as $applicableCardSystem) {
         $promotion->applicableCardSystems[] = CultureFeed_Uitpas_CardSystem::createFromXml($applicableCardSystem);
     }
     return $promotion;
 }
Example #25
0
 /**
  * Parse a message from an xml element.
  * @param unknown $xmlElement
  */
 public static function parseFromXml(CultureFeed_SimpleXMLElement $xmlElement)
 {
     $message = new self();
     // General properties.
     $message->id = $xmlElement->xpath_str('id');
     $message->type = $xmlElement->xpath_str('type');
     $message->status = $xmlElement->xpath_str('status');
     $message->creationDate = $xmlElement->xpath_time('creationDate');
     $message->lastReply = $xmlElement->xpath_time('lastReply');
     $message->subject = $xmlElement->xpath_str('subject');
     $message->body = $xmlElement->xpath_str('body');
     $message->role = $xmlElement->xpath_str('role');
     // Parse sender.
     $user = new CultureFeed_User();
     $user->id = $xmlElement->xpath_str('sender/rdf:id');
     $user->nick = $xmlElement->xpath_str('sender/foaf:nick');
     $user->depiction = $xmlElement->xpath_str('sender/foaf:depiction');
     $message->sender = $user;
     // Parse recipients.
     $message->recipients = array();
     $recipientElements = $xmlElement->xpath('recipients/recipient');
     if ($recipientElements) {
         foreach ($recipientElements as $recipientElement) {
             $recipient = new CultureFeed_User();
             $recipient->id = $recipientElement->xpath_str('rdf:id');
             $recipient->nick = $recipientElement->xpath_str('foaf:nick');
             $recipient->depiction = $recipientElement->xpath_str('foaf:depiction');
             $message->recipients[$recipient->id] = $recipient;
         }
     }
     $senderPageId = $xmlElement->xpath_str('senderPageId');
     if ($senderPageId) {
         $page = new CultureFeed_Cdb_Item_Page();
         $page->setId($senderPageId);
         $page->setName($xmlElement->xpath_str('senderPageName'));
         $message->senderPage = $page;
     }
     $recipientPageId = $xmlElement->xpath_str('recipientPageId');
     if ($recipientPageId) {
         $page = new CultureFeed_Cdb_Item_Page();
         $page->setId($recipientPageId);
         $page->setName($xmlElement->xpath_str('recipientPageName'));
         $message->recipientPage = $page;
     }
     // If this is a thread, parse also the child messages.
     $message->children = array();
     $childElements = $xmlElement->xpath('children/message');
     if ($childElements) {
         foreach ($childElements as $childElement) {
             $message->children[] = CultureFeed_Messages_Message::parseFromXml($childElement);
         }
     }
     return $message;
 }
Example #26
0
 public function deleteMembership($uid, $assocationId, $consumer_key_counter = NULL)
 {
     $data = array('uid' => $uid, 'associationId' => $assocationId);
     if ($consumer_key_counter) {
         $data['balieConsumerKey'] = $consumer_key_counter;
     }
     $result = $this->oauth_client->authenticatedPostAsXml('uitpas/passholder/membership/delete', $data);
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $response = CultureFeed_Uitpas_Response::createFromXML($xml->xpath('/response', false));
     return $response;
 }
 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;
 }
 /**
  * Parse the SimpleXML element as a CultureFeed_ResultSet.
  *
  * @param CultureFeed_SimpleXMLElement $element
  *   XML to parse.
  * @return CultureFeed_ResultSet
  *   CultureFeed_ResultSet where the objects are of the CultureFeed_Mailing type.
  */
 protected static function parseMailings(CultureFeed_SimpleXMLElement $element)
 {
     $total = $element->xpath_int('/response/total');
     $mailings = array();
     $objects = $element->xpath('/response/mailings/mailing');
     foreach ($objects as $object) {
         $mailings[] = self::parseMailing($object);
     }
     return new CultureFeed_ResultSet($total, $mailings);
 }
 /**
  * Instantiates a new checkin activity object based on the passed XML representation.
  *
  * @param CultureFeed_SimpleXMLElement $object
  * @return CultureFeed_Uitpas_Event_CheckinActivity
  */
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $checkin = new CultureFeed_Uitpas_Event_CheckinActivity();
     $checkin->id = $object->xpath_str('id');
     $checkin->nodeId = $object->xpath_str('nodeID');
     $checkin->nodeTitle = $object->xpath_str('nodeTitle');
     $checkin->private = $object->xpath_bool('private');
     $checkin->createdVia = $object->xpath_str('createdVia');
     $checkin->points = $object->xpath_int('points');
     $checkin->contentType = $object->xpath_str('contentType');
     $checkin->type = $object->xpath_str('type');
     $checkin->value = $object->xpath_str('value');
     $checkin->userId = $object->xpath_str('userId');
     $checkin->depiction = $object->xpath_str('depiction');
     $checkin->nick = $object->xpath_str('nick');
     $checkin->creationDate = $object->xpath_time('creationDate');
     $checkin->kansenStatuut = $object->xpath_bool('kansenStatuut');
     $checkin->location = $object->xpath_str('location');
     $checkin->organiser = $object->xpath_str('organiser');
     $checkin->userHomeCity = $object->xpath_str('userHomeCity');
     $checkin->userHomeLocationLat = $object->xpath_float('userHomeLocationLat');
     $checkin->userHomeLocationLon = $object->xpath_float('userHomeLocationLon');
     $checkin->firstName = $object->xpath_str('firstName');
     $checkin->lastName = $object->xpath_str('lastName');
     $checkin->userPoints = $object->xpath_int('userPoints');
     $checkin->eventLocationLat = $object->xpath_float('eventLocationLat');
     $checkin->eventLocationLon = $object->xpath_float('eventLocationLon');
     $checkin->gender = $object->xpath_str('gender');
     $organiserCardSystems = $object->xpath('organiserCardSystems/organiserCardSystem');
     foreach ($organiserCardSystems as $organiserCardSystemId) {
         $checkin->organiserCardSystems[] = (int) dom_import_simplexml($organiserCardSystemId)->textContent;
     }
     return $checkin;
 }
Example #30
0
 public static function createFromXML(CultureFeed_SimpleXMLElement $object)
 {
     $counter = new CultureFeed_Uitpas_Counter();
     $counter->id = $object->xpath_str('id');
     $counter->name = $object->xpath_str('name');
     $counter->type = $object->xpath_str('type');
     $counter->street = $object->xpath_str('street');
     $counter->number = $object->xpath_int('number');
     $counter->box = $object->xpath_str('box');
     $counter->postalCode = $object->xpath_str('postalCode');
     $counter->city = $object->xpath_str('city');
     $counter->cityPart = $object->xpath_str('cityPart');
     $counter->telephoneNumber = $object->xpath_str('telephoneNumber');
     $counter->contactPerson = $object->xpath_str('contactPerson');
     $counter->consumerKey = $object->xpath_str('consumerKey');
     foreach ($object->xpath('cardSystems/cardSystem') as $card_system) {
         $cardSystem = CultureFeed_Uitpas_CardSystem::createFromXml($card_system);
         $counter->cardSystems[$cardSystem->id] = $cardSystem;
     }
     return $counter;
 }