You are here

function theme_memcache_admin_stats_table in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 modules/memcache/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 modules/memcache/memcache_admin/memcache_admin.module
Memcache Stats page

File

modules/memcache/memcache_admin/memcache_admin.module, line 390

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}"));
  }
  $headers = array_merge(array(
    '',
    t('Totals'),
  ), $links);
  foreach ($stats as $table => $data) {
    $rows = array();
    foreach ($data as $row) {
      if (isset($row[2]) && is_array($row[2])) {
        $row[2] = implode(', ', $row[2]);
      }
      else {
        $row[2] = '';
      }
      $rows[] = $row;
    }
    $output .= theme('table', array(
      'header' => $headers,
      'rows' => $rows,
    ));
  }
  return $output;
}