/** * @param CultureFeed_SimpleXMLElement $xml * @return CultureFeed_Uitpas_Passholder_EventBuyTicket */ public static function createFromXml(CultureFeed_SimpleXMLElement $xml) { $buyTicket = new self(); $buyTicket->tariff = $xml->xpath_float('tariff'); $buyTicket->price = $xml->xpath_float('price'); $buyTicket->cdbid = $xml->xpath_str('cdbid'); $buyTicket->buyConstraintReason = $xml->xpath_str('buyConstraintReason'); return $buyTicket; }
public static function createFromXML(CultureFeed_SimpleXMLElement $xml) { $response = new self(); $response->code = $xml->xpath_str('code'); $response->price = $xml->xpath_float('price'); $response->id = $xml->xpath_str('id'); $response->tariff = $xml->xpath_float('tariff'); return $response; }
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; }
/** * 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; }
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; }
protected static function parseUser(CultureFeed_SimpleXMLElement $element) { $user = new CultureFeed_User(); $user->id = $element->xpath_str('/foaf:person/rdf:id'); $user->preferredLanguage = $element->xpath_str('/foaf:person/preferredLanguage'); $user->nick = $element->xpath_str('/foaf:person/foaf:nick'); $user->givenName = $element->xpath_str('/foaf:person/foaf:givenName'); $user->familyName = $element->xpath_str('/foaf:person/foaf:familyName'); $user->mbox = $element->xpath_str('/foaf:person/foaf:mbox'); $user->mboxVerified = $element->xpath_bool('/foaf:person/mboxVerified'); $user->gender = $element->xpath_str('/foaf:person/foaf:gender'); $user->dob = $element->xpath_time('/foaf:person/foaf:dob'); $user->hasChildren = $element->xpath_bool('/foaf:person/hasChildren'); $user->depiction = $element->xpath_str('/foaf:person/foaf:depiction'); $user->bio = $element->xpath_str('/foaf:person/bio'); $user->street = $element->xpath_str('/foaf:person/homeAddress/street'); $user->zip = $element->xpath_str('/foaf:person/homeAddress/zip'); $user->city = $element->xpath_str('/foaf:person/homeAddress/city'); $user->country = $element->xpath_str('/foaf:person/homeAddress/country'); $user->lifestyleProfile = $element->xpath_str('/foaf:person/lifestyleProfile'); $user->status = $element->xpath_str('/foaf:person/status'); $user->points = $element->xpath_str('/foaf:person/points'); $user->calendarId = $element->xpath_str('/foaf:person/calendarId'); if ($user->status) { $user->status = strtolower($user->status); } $user->openid = $element->xpath_str('/foaf:person/foaf:openid'); $lat = $element->xpath_float('/foaf:person/homeLocation/geo:lat'); $lng = $element->xpath_float('/foaf:person/homeLocation/geo:long'); if ($lat && $lng) { $user->homeLocation = new CultureFeed_Location($lat, $lng); } $lat = $element->xpath_float('/foaf:person/currentLocation/geo:lat'); $lng = $element->xpath_float('/foaf:person/currentLocation/geo:long'); if ($lat && $lng) { $user->currentLocation = new CultureFeed_Location($lat, $lng); } $accounts = array(); $objects = $element->xpath('/foaf:person/foaf:holdsAccount/foaf:onlineAccount'); foreach ($objects as $object) { $account = new CultureFeed_OnlineAccount(); $account->accountType = $object->xpath_str('accountType'); $account->accountServiceHomepage = $object->xpath_str('foaf:accountServiceHomepage'); $account->accountName = $object->xpath_str('foaf:accountName'); $account->accountNick = $object->xpath_str('accountNick'); $account->accountDepiction = $object->xpath_str('accountDepiction'); $account->private = $object->xpath_bool('private'); $account->publishActivities = $object->xpath_bool('publishActivities'); $accounts[] = $account; } if ($element->xpath_str('/foaf:person/privateNick') !== NULL) { $privacy_config = new CultureFeed_UserPrivacyConfig(); $vars = array('nick', 'givenName', 'familyName', 'mbox', 'gender', 'dob', 'depiction', 'bio', 'homeAddress', 'homeLocation', 'currentLocation', 'openId', 'calendarId'); foreach ($vars as $var) { $privacy = $element->xpath_bool('/foaf:person/private' . ucfirst($var)); if (is_bool($privacy)) { $privacy_config->{$var} = $privacy ? CultureFeed_UserPrivacyConfig::PRIVACY_PRIVATE : CultureFeed_UserPrivacyConfig::PRIVACY_PUBLIC; } } $user->privacyConfig = $privacy_config; } if (!empty($accounts)) { $user->holdsAccount = $accounts; } // Add memberships. $memberships = $element->xpath('/foaf:person/pageMemberships/pageMembership'); $user_memberships = array(); foreach ($memberships as $membership) { $pageId = $membership->xpath_str('page/uid'); if (empty($pageId)) { continue; } $user_membership = new CultureFeed_Pages_Membership(); $page = new CultureFeed_Cdb_Item_Page(); $page->setId($pageId); $page->setName($membership->xpath_str('page/name')); // Set categories $categories_element = $membership->xpath('page/categoryIds/categoryId'); $categories = array(); foreach ($categories_element as $category) { $categories[] = (string) $category; } $page->setCategories($categories); $user_membership->page = $page; $user_membership->validated = $membership->xpath_bool('validated'); $user_membership->role = $membership->xpath_str('role'); $user_membership->relation = $membership->xpath_str('relation'); $user_membership->creationDate = $membership->xpath_time('creationDate'); $user_memberships[] = $user_membership; } if (!empty($user_memberships)) { $user->pageMemberships = $user_memberships; $adminPagesCount = 0; foreach ($user->pageMemberships as $membership) { if ($membership->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) { $adminPagesCount++; } } $user->adminPagesCount = $adminPagesCount; } // Add following pages. $following = $element->xpath('/foaf:person/following/page'); foreach ($following as $object) { $pageId = $object->xpath_str('uid'); if (empty($pageId)) { continue; } $follower = new CultureFeed_Pages_Follower(); $page = new CultureFeed_Cdb_Item_Page(); $page->setId($pageId); $page->setName($object->xpath_str('name')); // Set categories $categories_element = $object->xpath('categoryIds/categoryId'); $categories = array(); foreach ($categories_element as $category) { $categories[] = (string) $category; } $page->setCategories($categories); $follower->page = $page; $follower->user = $user; $follower->creationDate = $object->xpath_time('dateCreated'); $followers[] = $follower; } if (!empty($followers)) { $user->following = $followers; } return $user; }
public static function createFromXML(CultureFeed_SimpleXMLElement $object) { //dpm( print_r( $object , true ) ); $ticket_sale = new CultureFeed_Uitpas_Event_TicketSale(); $ticket_sale->id = $object->xpath_int('id'); $ticket_sale->nodeId = $object->xpath_str('nodeId'); $ticket_sale->nodeTitle = $object->xpath_str('nodeTitle'); $ticket_sale->creationDate = $object->xpath_time('creationDate'); $ticket_sale->createdVia = $object->xpath_str('createdVia'); $ticket_sale->price = $object->xpath_float('price'); $ticket_sale->tariff = $object->xpath_float('tariff'); $ticket_sale->firstName = $object->xpath_str('firstName'); $ticket_sale->lastName = $object->xpath_str('lastName'); $ticket_sale->userId = $object->xpath_str('userId'); $ticket_sale->userHomeCity = $object->xpath_str('userHomeCity'); $ticket_sale->dateOfBirth = $object->xpath_str('dateOfBirth'); $ticket_sale->uitpasNumber = $object->xpath_str('uitpasNumber'); $ticket_sale->status = $object->xpath_str('status'); $xmlTicketSaleCoupon = $object->xpath('ticketSaleCoupon', false); if ($xmlTicketSaleCoupon instanceof SimpleXMLElement) { $ticket_sale->ticketSaleCoupon = CultureFeed_Uitpas_Event_TicketSale_Coupon::createFromXML($xmlTicketSaleCoupon); } return $ticket_sale; }