You are here

function hosting_quota_node_view in Hosting 7.3

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

Implements hook_node_view().

File

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

Code

function hosting_quota_node_view($node, $view_mode, $langcode) {
  global $user;
  if ($node->type == 'client') {
    $allowed_clients = array_keys(hosting_get_client_from_user($user->uid));
    if (user_access('view all quotas') || in_array($node->nid, $allowed_clients) && user_access('view own quota')) {
      $node->content['info']['quota'] = array(
        '#type' => 'item',
        '#title' => 'Quota',
        '#markup' => theme('hosting_quota_client', array(
          'node' => $node,
        )),
        '#weight' => 5,
      );
    }
  }
}