/**
  * Fetch a list of recommendations based on a given event.
  *
  * The object should be initialized with the consumer token and user access token of the user who is doing the action.
  *
  * @param string $id
  *   CDBID of the event recommendations should be based on.
  * @param CultureFeed_RecommendationsQuery $query
  *   The query.
  * @return CultureFeed_Recommendation[]
  *   The recommendations.
  *
  * @throws CultureFeed_ParseException
  *   If the result could not be parsed.
  */
 public function getRecommendationsForEvent($id, CultureFeed_RecommendationsQuery $query = NULL)
 {
     $data = array();
     if ($query) {
         $data = $query->toPostData();
     }
     $data['eventId'] = $id;
     $result = $this->oauth_client->consumerGetAsXml('recommendation/event', $data);
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     return self::parseRecommendations($xml);
 }
Example #2
0
 /**
  * @see CultureFeed_Pages::getTimeline()
  */
 public function getTimeline($id, $dateFrom = NULL, $activityTypes = array())
 {
     $params = array();
     if (!empty($dateFrom)) {
         $params['dateFrom'] = $dateFrom;
     }
     if (!empty($activityTypes)) {
         $params['type'] = $activityTypes;
     }
     $result = $this->oauth_client->consumerGetAsXml('page/' . $id . '/timeline', $params);
     try {
         $xmlElement = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     return CultureFeed::parseActivities($xmlElement);
 }
Example #3
0
 public function getCardSystems($permanent = NULL)
 {
     if ($permanent == 'permanent') {
         $result = $this->oauth_client->consumerGetAsXml('uitpas/cardsystem?permanent=true');
     } else {
         $result = $this->oauth_client->consumerGetAsXml('uitpas/cardsystem');
     }
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $cardsystems = array();
     foreach ($xml->cardSystems->cardSystem as $cardSystemXml) {
         $cardsystems[] = CultureFeed_Uitpas_CardSystem::createFromXML($cardSystemXml);
     }
     return $cardsystems;
 }