You are here

function feedapi_aggregator_page_categories in FeedAPI 5

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

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

File

feedapi_aggregator/feedapi_aggregator.module, line 800

Code

function feedapi_aggregator_page_categories() {
  $result = db_query('SELECT c.cid, c.title, c.description FROM {feedapi_aggregator_category} c LEFT JOIN {feedapi_aggregator_category_item} ci ON c.cid = ci.cid LEFT JOIN {feedapi_aggregator_item} i ON ci.iid = i.iid GROUP BY c.cid, c.title, c.description');
  $output = "<div id=\"aggregator\">\n";
  while ($category = db_fetch_object($result)) {
    $output .= '<h2>' . check_plain($category->title) . "</h2>\n";
    if (variable_get('feedapi_aggregator_summary_items', 3)) {
      $list = array();
      $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.nid FROM {feedapi_aggregator_category_item} ci LEFT JOIN {feedapi_aggregator_item} i ON i.iid = ci.iid LEFT JOIN {feedapi} f ON i.feed_nid = f.nid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 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['categories'] = array(
      'title' => t('More'),
      'href' => 'aggregator/categories/' . $category->cid,
    );
    $output .= '<div class="links">' . theme('links', $link) . "</div>\n";
  }
  $output .= '</div>';
  return $output;
}