Esempio n. 1
0
 protected function buildAtomPagination()
 {
     // Feed paging. See IETF RFC 5005.
     $total_photos = $this->tag_list->getPhotoCount();
     $tag_string = (string) $this->tag_list;
     if ($tag_string != '') {
         $tag_string .= '/';
     }
     $uri = sprintf('%sfeed/%s%s%s', $this->getPinholeBaseHref(), $this->dimension->shortname, strlen($tag_string) > 0 ? '?' : '', $tag_string);
     $this->feed->addLink($uri, 'first', 'application/atom+xml');
     if ($tag_string == '') {
         $uri .= '?';
     }
     $last = ceil($total_photos / $this->page_size);
     if ($last > 0) {
         $this->feed->addLink($uri . 'page.number=' . $last, 'last', 'application/atom+xml');
         $num = $this->page_number;
         if ($num > 1) {
             $this->feed->addLink($uri . 'page.number=' . ($num - 1), 'previous', 'application/atom+xml');
         }
         if ($num != $last) {
             $this->feed->addLink($uri . 'page.number=' . ($num + 1), 'next', 'application/atom+xml');
         }
     }
 }
Esempio n. 2
0
 protected function buildHeader(XML_Atom_Feed $feed)
 {
     $feed->setGenerator('Blörg');
     $feed->setBase($this->app->getBaseHref());
     $feed->addLink($this->app->getBaseHref() . $this->source, 'self', 'application/atom+xml');
 }
 protected function buildPagination(XML_Atom_Feed $feed)
 {
     $page = $this->getArgument('page');
     $type = 'application/atom+xml';
     $last = intval(ceil($this->getTotalCount() / $this->getPageSize()));
     $base_href = $this->getPinholeBaseHref() . 'feed/comments';
     $feed->addLink($base_href, 'first', $type);
     $feed->addLink($base_href . '/page' . $last, 'last', $type);
     if ($page > 1) {
         $feed->addLink($base_href . '/page' . ($page - 1), 'previous', $type);
     }
     if ($page < $last) {
         $feed->addLink($base_href . '/page' . ($page + 1), 'next', $type);
     }
 }