You are here

function vote_storylink_page_top in Vote Up/Down 5

1 call to vote_storylink_page_top()
vote_storylink_page in ./vote_storylink.module
Menu callback; displays a Drupal page containing recent story links entries.

File

./vote_storylink.module, line 408

Code

function vote_storylink_page_top() {
  drupal_set_title($title = t('Popular story links'));
  $sql = db_rewrite_sql("SELECT n.nid, n.created, v.content_id, v.value, v.tag, v.function FROM {node} n INNER JOIN {votingapi_cache} v ON n.nid = v.content_id WHERE n.type = 'storylink' AND n.status = 1 AND v.tag = 'vote' AND v.function = 'sum' AND v.content_type = 'node' ORDER BY v.value DESC, n.created DESC");
  $result = pager_query($sql, variable_get('default_nodes_main', 10));
  while ($node = db_fetch_object($result)) {
    $output .= node_view(node_load($node->nid), 1);
  }
  $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
  $output .= theme('feed_icon', url('storylink/top/feed'));
  $feed_url = url('storylink/top/feed', NULL, NULL, TRUE);
  drupal_add_feed($feed_url, t('RSS - @title', array(
    '@title' => $title,
  )));
  return $output;
}