Same name and namespace in other branches
  1. 4.7.x modules/aggregator.module \aggregator_page_categories()
  2. 5.x modules/aggregator/aggregator.module \aggregator_page_categories()
  3. 6.x modules/aggregator/aggregator.pages.inc \aggregator_page_categories()
  4. 7.x modules/aggregator/aggregator.pages.inc \aggregator_page_categories()

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

1 string reference to 'aggregator_page_categories'
aggregator_menu in modules/aggregator.module
Implementation of hook_menu().

File

modules/aggregator.module, line 999
Used to aggregate syndicated content (RSS and RDF).

Code

function aggregator_page_categories() {
  $result = db_query('SELECT c.cid, c.title, c.description FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid LEFT JOIN {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('aggregator_summary_items', 3)) {
      $list = array();
      $items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = %d ORDER BY i.timestamp DESC', $category->cid, 0, variable_get('aggregator_summary_items', 3));
      while ($item = db_fetch_object($items)) {
        $list[] = theme('aggregator_summary_item', $item);
      }
      $output .= theme('item_list', $list);
    }
    $output .= '<div class="links">' . theme('links', array(
      l(t('more'), 'aggregator/categories/' . $category->cid),
    )) . "</div>\n";
  }
  $output .= '</div>';
  print theme('page', $output);
}