You are here

function theme_hosting_quota_admin_list in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 quota/hosting_quota.module \theme_hosting_quota_admin_list()
  2. 7.3 quota/hosting_quota.module \theme_hosting_quota_admin_list()

Theme the admin list of client quotas

Parameters

$client_quotas array: The client_quotas provided by hosting_quota_admin_client_list

$resources array: The array of info about resources

1 theme call to theme_hosting_quota_admin_list()
hosting_quota_admin_client_list in quota/hosting_quota.admin.inc
Page callback for admin/hosting/quotas

File

quota/hosting_quota.module, line 373
Implement quota's for the resource used by client.

Code

function theme_hosting_quota_admin_list($client_quotas, $resources, $items_per_page = 25) {
  $header = array(
    t('Client'),
  );
  $rows = array();
  foreach ($resources as $resource) {
    $header[] = t('@resource (Used / Limit)', array(
      '@resource' => $resource['title'],
    ));
  }
  foreach ($client_quotas as $client_nid => $quotas) {
    $row = array();
    $row[] = l($quotas['name'], "node/{$client_nid}");
    foreach ($resources as $resource => $resource_info) {

      // Provide a visual indication if the usage is over the limit
      if ($quotas[$resource]['usage'] > $quotas[$resource]['limit']) {
        $row[] = array(
          'data' => "{$quotas[$resource]['rendered usage']} / {$quotas[$resource]['rendered limit']}",
          'class' => 'warning',
        );
      }
      else {
        $row[] = "{$quotas[$resource]['rendered usage']} / {$quotas[$resource]['rendered limit']}";
      }
    }
    $rows[] = $row;
  }
  return '<p>' . t('Usage information for the last month.') . '</p>' . theme('table', $header, $rows) . theme('pager', array(), $items_per_page);
}