示例#1
0
 public function quick($talkStub)
 {
     $cache = $this->getCache();
     $talkDb = new TalkDb($cache);
     $talk = $talkDb->load('stub', $talkStub);
     $eventDb = new EventDb($cache);
     $event = $eventDb->load('uri', $talk['event_uri']);
     if (!$event) {
         return \Slim\Slim::getInstance()->notFound();
     }
     $this->application->redirect($this->application->urlFor('talk', array('eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk['slug'])));
 }
示例#2
0
 public function quickById($talkId)
 {
     $cache = $this->getCache();
     $eventDb = new EventDb($cache);
     $talkApi = $this->getTalkApi();
     $talk = $talkApi->getTalkByTalkId($talkId);
     if (!$talk) {
         return \Slim\Slim::getInstance()->notFound();
     }
     $event = $eventDb->load('uri', $talk->getEventUri());
     if (!$event) {
         return \Slim\Slim::getInstance()->notFound();
     }
     $this->application->redirect($this->application->urlFor('talk', array('eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk->getUrlFriendlyTalkTitle())));
 }
示例#3
0
 /**
  * Returns a response array containing an 'events' and 'pagination' element.
  * Each event in this response is also stored in the cache so that a relation
  * can be made between the API URLs and Event entities.
  *
  * @param string $url API Url to query for one or more events. Either a
  *                    listing can be retrieved or a single event.
  * @param array  $queryParams
  *
  * @return array
  */
 public function getCollection($uri, array $queryParams = array())
 {
     $events = (array) json_decode($this->apiGet($uri, $queryParams));
     $meta = array_pop($events);
     $collectionData = array();
     foreach ($events['events'] as $item) {
         $event = new EventEntity($item);
         $collectionData['events'][] = $event;
         // save the URL so we can look up by it
         $this->eventDb->save($event);
     }
     $collectionData['pagination'] = $meta;
     return $collectionData;
 }
示例#4
0
 /**
  * Returns a response array containing an 'events' and 'pagination' element.
  * Each event in this response is also stored in the cache so that a relation
  * can be made between the API URLs and Event entities.
  *
  * @param string $url API Url to query for one or more events. Either a
  *                    listing can be retrieved or a single event.
  * @param array  $queryParams
  *
  * @return array
  */
 public function getCollection($uri, array $queryParams = array())
 {
     $events = (array) json_decode($this->apiGet($uri, $queryParams));
     $meta = array_pop($events);
     $collectionData = array();
     foreach ($events['events'] as $item) {
         $event = new EventEntity($item);
         foreach ($event->getHosts() as $hostsInfo) {
             if (isset($hostsInfo->host_uri)) {
                 $hostsInfo->username = $this->userApi->getUsername($hostsInfo->host_uri);
             }
         }
         $collectionData['events'][] = $event;
         // save the URL so we can look up by it
         $this->eventDb->save($event);
     }
     $collectionData['pagination'] = $meta;
     return $collectionData;
 }