You are here

function ed_classified_get_popular_ads_list in Classified Ads 5

Same name and namespace in other branches
  1. 5.2 ed_classified_utils.inc \ed_classified_get_popular_ads_list()
  2. 6.2 ed_classified_utils.inc \ed_classified_get_popular_ads_list()
  3. 7.2 ed_classified_utils.inc \ed_classified_get_popular_ads_list()

Get a list of popular ads for block use

1 call to ed_classified_get_popular_ads_list()
ed_classified_block in ./ed_classified.module
Implementation of hook_block().

File

./ed_classified_utils.inc, line 200
Simple text-based classified ads module. Michael Curry, Exodus Development, Inc. exodusdev@gmail.com for more information, please visit http://exodusdev.com/drupal/modules/classified.module Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights…

Code

function ed_classified_get_popular_ads_list() {
  $output = '';
  $have_statistics = _ed_classified_module_exists('statistics');
  if ($have_statistics) {
    $q = db_query("SELECT n.nid, n.title, n.created, n.changed, s.totalcount as counter FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid WHERE n.status = 1 AND n.type = '%s' ORDER BY s.totalcount DESC LIMIT %d;", EDI_CLASSIFIED_MODULE_NAME, _ed_classified_variable_get('block_popular_limit', 4));
    $output = theme('ed_classified_ads_block', _ed_classified_query_results_to_array($q), FALSE, TRUE, TRUE);
  }
  return $output;
}