You are here

function theme_webform_results_per_page in Webform 6.3

Same name and namespace in other branches
  1. 5.2 webform_report.inc \theme_webform_results_per_page()
  2. 6.2 webform_report.inc \theme_webform_results_per_page()
  3. 7.4 includes/webform.report.inc \theme_webform_results_per_page()
  4. 7.3 includes/webform.report.inc \theme_webform_results_per_page()

Theme the list of links for selecting the number of results per page.

Parameters

$total_count: The total number of results available.

$pager_count: The current number of results displayed per page.

2 theme calls to theme_webform_results_per_page()
theme_webform_results_table in includes/webform.report.inc
Theme the results table displaying all the submissions for a particular node.
webform-results-submissions.tpl.php in templates/webform-results-submissions.tpl.php

File

includes/webform.report.inc, line 94
This file includes helper functions for creating reports for webform.module

Code

function theme_webform_results_per_page($total_count, $pager_count) {
  $output = '';

  // Create a list of results-per-page options.
  $counts = array(
    '20' => '20',
    '50' => '50',
    '100' => '100',
    '200' => '200',
    '500' => '500',
    '1000' => '1000',
    '0' => t('All'),
  );
  $count_links = array();
  foreach ($counts as $number => $text) {
    if ($number < $total_count) {
      $count_links[] = l($text, $_GET['q'], array(
        'query' => 'results=' . $number,
        'attributes' => array(
          'class' => $pager_count == $number ? 'selected' : '',
        ),
      ));
    }
  }
  $output .= '<div class="webform-results-per-page">';
  if (count($count_links) > 1) {
    $output .= t('Show !count results per page.', array(
      '!count' => implode(' | ', $count_links),
    ));
  }
  else {
    $output .= t('Showing all results.');
  }
  if ($total_count > 1) {
    $output .= ' ' . t('@total results total.', array(
      '@total' => $total_count,
    ));
  }
  $output .= '</div>';
  return $output;
}