You are here

function feedapi_aggregator_category_view in FeedAPI 5

Provide a UI for category management

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

File

feedapi_aggregator/feedapi_aggregator.module, line 579

Code

function feedapi_aggregator_category_view() {
  $result = db_query('SELECT c.cid, c.title, count(ci.iid) as items FROM {feedapi_aggregator_category} c LEFT JOIN {feedapi_aggregator_category_item} ci ON c.cid = ci.cid GROUP BY c.cid, c.title ORDER BY title');
  $output = '<h3>' . t('Category overview') . '</h3>';
  $header = array(
    t('Title'),
    t('Items'),
    t('Operations'),
  );
  $rows = array();
  while ($category = db_fetch_object($result)) {
    $rows[] = array(
      l($category->title, "aggregator/categories/{$category->cid}"),
      format_plural($category->items, '1 item', '@count items'),
      l(t('edit'), "aggregator/categories/{$category->cid}/configure"),
    );
  }
  $output .= theme('table', $header, $rows);
  return $output;
}