You are here

function mostpopular_intervals in Drupal Most Popular 7

Gets the configured Most Popular intervals.

Parameters

integer $iid Optionally the ID of a single interval to retrieve.:

4 calls to mostpopular_intervals()
mostpopular_intervals_admin_form_submit in ./mostpopular.intervals.inc
mostpopular_interval_timestamp in ./mostpopular.module
Returns the timestamp, relative to the current time, that marks the start of this interval.
mostpopular_interval_title in ./mostpopular.module
Returns the full title, which is the interval's title prepended with 'Past '. So, for instance, 'Day' becomes 'Past Day'.
mostpopular_items_ajax in ./mostpopular.module

File

./mostpopular.module, line 548
The main file for the Most Popular module.

Code

function mostpopular_intervals($iid = NULL) {
  $intervals =& drupal_static(__FUNCTION__);
  if (!isset($intervals)) {
    $intervals = db_select('mostpopular_interval', 'i')
      ->fields('i')
      ->execute()
      ->fetchAllAssoc('iid');
  }
  if (!empty($iid)) {
    if (isset($intervals[$iid])) {
      return $intervals[$iid];
    }
    return FALSE;
  }
  return $intervals;
}