You are here

function aggregator_view in Drupal 6

Same name and namespace in other branches
  1. 4 modules/aggregator.module \aggregator_view()
  2. 5 modules/aggregator/aggregator.module \aggregator_view()
  3. 7 modules/aggregator/aggregator.admin.inc \aggregator_view()

Displays the aggregator administration page.

Return value

The page HTML.

1 call to aggregator_view()
aggregator_admin_overview in modules/aggregator/aggregator.admin.inc
Menu callback; displays the aggregator administration page.

File

modules/aggregator/aggregator.admin.inc, line 21
Admin page callbacks for the aggregator module.

Code

function aggregator_view() {
  $result = db_query('SELECT f.*, COUNT(i.iid) AS items FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.etag, f.modified, f.image, f.block ORDER BY f.title');
  $output = '<h3>' . t('Feed overview') . '</h3>';
  $header = array(
    t('Title'),
    t('Items'),
    t('Last update'),
    t('Next update'),
    array(
      'data' => t('Operations'),
      'colspan' => '3',
    ),
  );
  $rows = array();
  while ($feed = db_fetch_object($result)) {
    $rows[] = array(
      l($feed->title, "aggregator/sources/{$feed->fid}"),
      format_plural($feed->items, '1 item', '@count items'),
      $feed->checked ? t('@time ago', array(
        '@time' => format_interval(time() - $feed->checked),
      )) : t('never'),
      $feed->checked ? t('%time left', array(
        '%time' => format_interval($feed->checked + $feed->refresh - time()),
      )) : t('never'),
      l(t('edit'), "admin/content/aggregator/edit/feed/{$feed->fid}"),
      l(t('remove items'), "admin/content/aggregator/remove/{$feed->fid}"),
      l(t('update items'), "admin/content/aggregator/update/{$feed->fid}", array(
        'query' => array(
          'token' => drupal_get_token("aggregator/update/{$feed->fid}"),
        ),
      )),
    );
  }
  $output .= theme('table', $header, $rows);
  $result = db_query('SELECT c.cid, c.title, count(ci.iid) as items FROM {aggregator_category} c LEFT JOIN {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'), "admin/content/aggregator/edit/category/{$category->cid}"),
    );
  }
  $output .= theme('table', $header, $rows);
  return $output;
}