You are here

function feedapi_aggregator_page_sources in FeedAPI 5

Menu callback; displays all the feeds used by the aggregator.

1 string reference to 'feedapi_aggregator_page_sources'
feedapi_aggregator_menu in feedapi_aggregator/feedapi_aggregator.module
Implementation of hook_menu().

File

feedapi_aggregator/feedapi_aggregator.module, line 764

Code

function feedapi_aggregator_page_sources() {
  $result = db_query('SELECT f.nid, MAX(i.timestamp) AS last FROM {feedapi} f LEFT JOIN {feedapi_aggregator_item} i ON f.nid = i.feed_nid GROUP BY f.nid ORDER BY last DESC');
  $output = "<div id=\"aggregator\">\n";
  while ($feed = db_fetch_object($result)) {
    $node = node_load($feed->nid);
    if (count($node->feed->processors) > 0) {
      if (in_array('feedapi_aggregator', $node->feed->processors)) {
        $output .= '<h2>' . check_plain($node->title) . "</h2>\n";

        // Most recent items:
        $list = array();
        if (variable_get('feedapi_aggregator_summary_items', 3)) {
          $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {feedapi_aggregator_item} i WHERE i.feed_nid= %d ORDER BY i.timestamp DESC', $node->nid, 0, variable_get('feedapi_aggregator_summary_items', 3));
          while ($item = db_fetch_object($items)) {
            $list[] = theme('feedapi_aggregator_summary_item', $item);
          }
        }
        $output .= theme('item_list', $list);
        $link['sources'] = array(
          'title' => t('More'),
          'href' => 'aggregator/sources/' . $feed->nid,
        );
        $output .= '<div class="links">' . theme('links', $link) . "</div>\n";
      }
    }
  }
  $output .= '</div>';
  return $output;
}