You are here

function theme_memcache_admin_stats_table in Memcache API and Integration 6

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. 7 memcache_admin/memcache_admin.module \theme_memcache_admin_stats_table()

Theme function for rendering the output from memcache_admin_stats

Parameters

string $server - Server name:port for caption for the table:

array $stats - array of key/value string pairs for the table results:

Return value

string

1 theme call to theme_memcache_admin_stats_table()
memcache_admin_stats in memcache_admin/memcache_admin.module
Memcahe Stats page

File

memcache_admin/memcache_admin.module, line 399

Code

function theme_memcache_admin_stats_table($bin, $servers, $stats) {
  $output = '';
  $links = array();
  $memcache_bins = variable_get('memcache_bins', array(
    'cache' => 'default',
  ));
  if (!isset($memcache_bins['cache'])) {
    $memcache_bins['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', $headers, $rows);
  }
  return $output;
}