You are here

function hosting_quota_admin_client_list in Hostmaster (Aegir) 6

Page callback for admin/hosting/quotas

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

File

modules/hosting/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);
}