You are here

function theme_mostpopular_services in Drupal Most Popular 6

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

Each service button will be created as a link to the service for the current interval. 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_services()
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 193
Defines all the pages, blocks and themes for rendering the most popular data to general users.

Code

function theme_mostpopular_services($sid, $iid) {
  $services = MostPopularService::fetchEnabled();
  $list = array();
  $list[] = array(
    'data' => t('Most:'),
    'class' => 'mostpopular--label',
  );
  foreach ($services as $s) {

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