From f2ac51dc5e6ffa1f27abd10b1a352d71b08c5b80 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 25 Jul 2004 18:49:57 +0000 Subject: - Patch #9346 by drumm: improved themability of some aggregator pages. --- modules/aggregator/aggregator.module | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'modules/aggregator/aggregator.module') diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 210283703..91e4514dd 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -907,20 +907,20 @@ function _aggregator_page_list($sql, $op, $header = '') { */ function aggregator_page_sources() { $result = db_query('SELECT f.fid, f.title, f.description, f.image, MAX(i.timestamp) AS last FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY fid'); - $output = '
'; + $output = "
\n"; while ($feed = db_fetch_object($result)) { - $output .= "

$feed->title

"; + $output .= "

$feed->title

\n"; // Most recent items: $list = array(); if (variable_get('aggregator_summary_items', 3)) { $items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = %d ORDER BY i.timestamp DESC', $feed->fid, 0, variable_get('aggregator_summary_items', 3)); while ($item = db_fetch_object($items)) { - $list[] = ''. $item->title .' '. t('%age old', array('%age' => format_interval(time() - $item->timestamp))) .''; + $list[] = theme('aggregator_summary_item', $item); } } $output .= theme('item_list', $list); - $output .= ''; + $output .= '\n"; } $output .= theme('xml_icon', url('aggregator/opml')); $output .= '
'; @@ -965,11 +965,11 @@ function aggregator_page_categories() { $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[] = '$item->title ". t('%age ago', array('%age' => format_interval(time() - $item->timestamp))) .", feed_link\">$item->feed_title\n"; + $list[] = theme('aggregator_summary_item', $item); } $output .= theme('item_list', $list); } - $output .= ''; + $output .= '\n"; } $output .= '
'; @@ -1014,11 +1014,26 @@ function theme_aggregator_block_item($item, $feed = 0) { } // external link - $output .= "link\">$item->title"; + $output .= "link\">$item->title\n"; return $output; } +/** + * Returns a themed item heading for summary pages located at + * aggregator/sources and aggregator/categories. + * + * @param $item The item object from the aggregator module. + * @return A string containing the output. + */ +function theme_aggregator_summary_item($item) { + $output = ''. $item->title .' '. t('%age old', array('%age' => format_interval(time() - $item->timestamp))) .''; + if ($item->feed_link) { + $output .= ', '. $item->feed_title .''; + } + return $output ."\n"; +} + function theme_aggregator_page_item($item) { static $last; -- cgit v1.2.3