You are here

function hosting_quota_admin_client_list in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 quota/hosting_quota.admin.inc \hosting_quota_admin_client_list()
  2. 7.3 quota/hosting_quota.admin.inc \hosting_quota_admin_client_list()

Page callback for admin/hosting/quotas

1 string reference to 'hosting_quota_admin_client_list'
hosting_quota_menu in quota/hosting_quota.module
Implements hook_menu

File

quota/hosting_quota.admin.inc, line 5

Code

function hosting_quota_admin_client_list() {
  $items_per_page = 25;
  $all_resources = module_invoke_all('hosting_quota_resource');
  $result = pager_query('SELECT q.*, n.title FROM {hosting_client_quota} q INNER JOIN {node} n ON n.nid = q.client', $items_per_page);
  $output = array();
  while ($row = db_fetch_object($result)) {
    $resource = array(
      $row->resource => $all_resources[$row->resource],
    );

    // Pass in raw limit and usage
    $output[$row->client][$row->resource]['limit'] = $row->value;
    $output[$row->client][$row->resource]['usage'] = hosting_quota_get_usage($row->client, $resource);

    // Render limit and usage
    $output[$row->client][$row->resource]['rendered usage'] = hosting_quota_resource_render($resource, $output[$row->client][$row->resource]['usage']);
    $output[$row->client][$row->resource]['rendered limit'] = hosting_quota_resource_render($resource, $row->value);

    // Set client identifier
    $output[$row->client]['name'] = $row->title;
  }
  return theme('hosting_quota_admin_list', $output, $all_resources, $items_per_page);
}