You are here

function theme_memcache_admin_stats_table in Memcache API and Integration 7

Same name and namespace in other branches
  1. 5.2 memcache_admin/memcache_admin.module \theme_memcache_admin_stats_table()
  2. 5 memcache_admin/memcache_admin.module \theme_memcache_admin_stats_table()
  3. 6 memcache_admin/memcache_admin.module \theme_memcache_admin_stats_table()

Theme function for rendering the output from memcache_admin_stats.

1 theme call to theme_memcache_admin_stats_table()
memcache_admin_stats in memcache_admin/memcache_admin.module
Callback for the Memcache Stats page.

File

memcache_admin/memcache_admin.module, line 513
For the collection and display of memcache stats.

Code

function theme_memcache_admin_stats_table($variables) {
  $bin = $variables['bin'];
  $servers = $variables['servers'];
  $stats = $variables['report'];
  $output = '';
  $links = array();
  $memcache_bins = variable_get('memcache_bins', array(
    'cache' => 'default',
  ));
  foreach ($servers as $server) {
    $link_bin = $memcache_bins[$bin];
    $links[] = l($server, check_plain("admin/reports/memcache/{$link_bin}/{$server}"));
  }
  if (count($servers) > 1) {
    $headers = array_merge(array(
      '',
      t('Totals'),
    ), $links);
  }
  else {
    $headers = array_merge(array(
      '',
    ), $links);
  }
  foreach ($stats as $table => $data) {
    $rows = array();
    foreach ($data as $row) {
      $r = array();
      $r[] = $row['label'];
      if (isset($row['total'])) {
        $r[] = $row['total'];
      }
      foreach ($row['servers'] as $server) {
        $r[] = $server;
      }
      $rows[] = $r;
    }
    $output .= theme('table', array(
      'header' => $headers,
      'rows' => $rows,
    ));
  }
  return $output;
}