function aggregator_feed_items_load
aggregator_feed_items_load($type, $data = NULL)
Loads and optionally filters feed items.
Parameters
$type: The type of filter for the items. Possible values are:
- sum: No filtering.
- source: Filter the feed items, limiting the result to items from a single source.
- category: Filter the feed items by category.
$data: Feed or category data used for filtering. The type and value of $data depends on $type:
- source: $data is an object with $data->fid identifying the feed used to as filter.
- category: $data is an array with $data['cid'] being the category id to filter on.
The $data parameter is not used when $type is 'sum'.
Return value
An array of the feed items.
File
- modules/aggregator/aggregator.pages.inc, line 114
- User page callbacks for the Aggregator module.
Code
function aggregator_feed_items_load($type, $data = NULL) { $items = array(); switch ($type) { case 'sum': $query = db_select('aggregator_item', 'i'); $query->join('aggregator_feed', 'f', 'i.fid = f.fid'); $query->fields('i'); $query->addField('f', 'title', 'ftitle'); $query->addField('f', 'link', 'flink'); break; case 'source': $query = db_select('aggregator_item', 'i'); $query ->fields('i') ->condition('i.fid', $data->fid); break; case 'category': $query = db_select('aggregator_category_item', 'c'); $query->leftJoin('aggregator_item', 'i', 'c.iid = i.iid'); $query->leftJoin('aggregator_feed', 'f', 'i.fid = f.fid'); $query ->fields('i') ->condition('cid', $data['cid']); $query->addField('f', 'title', 'ftitle'); $query->addField('f', 'link', 'flink'); break; } $result = $query ->extend('PagerDefault') ->limit(20) ->orderBy('i.timestamp', 'DESC') ->orderBy('i.iid', 'DESC') ->execute(); foreach ($result as $item) { $item->categories = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = :iid ORDER BY c.title', array(':iid' => $item->iid))->fetchAll(); $items[] = $item; } return $items; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!aggregator!aggregator.pages.inc/function/aggregator_feed_items_load/7.x