You are here

function theme_webform_results_per_page in Webform 7.4

Same name and namespace in other branches
  1. 5.2 webform_report.inc \theme_webform_results_per_page()
  2. 6.3 includes/webform.report.inc \theme_webform_results_per_page()
  3. 6.2 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

array $variables: Array with keys:

  • "total_count": The total number of results available.
  • "pager_count": The current number of results displayed per page.

Return value

string Pager.

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
Result submissions page.

File

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

Code

function theme_webform_results_per_page(array $variables) {
  $total_count = $variables['total_count'];
  $pager_count = $variables['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' => array(
          'results' => $number,
        ),
        'attributes' => array(
          'class' => array(
            $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;
}