You are here

function theme_mostpopular_intervals in Drupal Most Popular 6

Themes a list of links to intervals. You can apply styles to class mostpopular-intervals.

Each interval button will be created as a link to the interval for the current service. These links point to HTML pages, and will be rewritten to point to AJAX callbacks when the javascript loads. This allows for gracefully degradation of the javascript functionality.

Parameters

integer $sid: The service ID of the currently-selected service.

integer $iid: The interval ID of the currently-selected interval.

2 theme calls to theme_mostpopular_intervals()
theme_mostpopular_block in ./mostpopular.block.inc
The main theme function for the most popular block. This theme loads the javascript helper file and a basic stylesheet.
theme_mostpopular_page in ./mostpopular.block.inc
The main theme function for the most popular page. This theme loads the basic stylesheet but no javascript.

File

./mostpopular.block.inc, line 227
Defines all the pages, blocks and themes for rendering the most popular data to general users.

Code

function theme_mostpopular_intervals($sid, $iid) {
  $intervals = MostPopularInterval::fetchAll();
  $list = array();
  $list[] = array(
    'data' => t('Past:'),
    'class' => 'mostpopular--label',
  );
  foreach ($intervals as $i) {

    // Create a default link (which will be overridden by javascript).
    $link = l($i->title, "mostpopular/items/{$sid}/{$i->iid}");
    $a = array(
      'data' => $link,
    );
    if ($i->iid == $iid) {
      $a['class'] = 'selected';
    }
    $list[] = $a;
  }
  return theme('item_list', $list, NULL, 'ul', array(
    'class' => 'mostpopular--intervals',
  ));
}