You are here

function theme_ed_classified_ads_stats in Classified Ads 6.2

Same name and namespace in other branches
  1. 5.2 ed_classified_themefuncs.inc \theme_ed_classified_ads_stats()
  2. 5 ed_classified_themefuncs.inc \theme_ed_classified_ads_stats()
  3. 7.2 ed_classified_themefuncs.inc \theme_ed_classified_ads_stats()
1 theme call to theme_ed_classified_ads_stats()
ed_classified_get_ad_stats in ./ed_classified_utils.inc
Get stats

File

./ed_classified_themefuncs.inc, line 201
$ Simple text-based classified ads module.

Code

function theme_ed_classified_ads_stats() {
  $content = '';
  $today = ed_classified_get_adcount_for_time_range(REQUEST_TIME - 86400, REQUEST_TIME, TRUE);

  // 86400 = # seconds in a day
  $total = ed_classified_get_adcount(TRUE);
  if ($today > 0 || $total > 0) {
    $stats = array(
      '!adcount' => $total,
      '!ads_today' => $today,
    );
    $content = '<div class="classified-ad-block item-list"><ul>';
    $content .= '<li>' . t('!adcount ads total.', $stats) . '</li>';

    // todo: format_plural() http://api.drupal.org/api/HEAD/function/format_plural
    $content .= '<li>' . t('!ads_today ads in last 24 hours.', $stats) . '</li>';

    // todo: format_plural()
    $content .= '</ul></div>';
  }
  return $content;
}