You are here

function hosting_client_view in Hostmaster (Aegir) 6

Implementation of hook_view().

File

modules/hosting/client/hosting_client.module, line 500

Code

function hosting_client_view($node, $teaser = FALSE, $page = FALSE) {
  $type = node_get_types('type', $node);
  $node->content['info']['#prefix'] = '<div id="hosting-client-info">';
  $node->content['info']['title'] = array(
    '#type' => 'item',
    '#title' => $type->title_label,
    '#value' => filter_xss($node->title),
  );
  $node->content['info']['uname'] = array(
    '#type' => 'item',
    '#title' => t('Internal name'),
    '#weight' => 1,
    '#value' => filter_xss($node->uname),
  );
  $node->content['info']['#suffix'] = '</div>';
  if ($page) {
    $node->content['sites_view'] = array(
      '#type' => 'item',
      '#value' => drupal_get_form('hosting_site_list_form', 'client', $node->nid),
      '#prefix' => '<div id="hosting-site-list">',
      '#suffix' => '</div>',
      '#weight' => 10,
    );
    $users = hosting_client_users($node);
    foreach ($users as $uid => $uname) {
      if (user_access('access user profiles') || $uid == $GLOBALS['user']->uid) {
        $rows[] = array(
          l($uname, 'user/' . $uid),
        );
      }
      else {
        $rows[] = array(
          $uname,
        );
      }
    }
    $header = array(
      t('Allowed users'),
    );
    $node->content['users_view'] = array(
      '#type' => 'item',
      '#value' => theme('table', $header, $rows),
      '#class' => 'client',
      '#prefix' => '<div id="hosting-site-list">',
      '#suffix' => '</div>',
      '#weight' => 11,
    );
  }
  return $node;
}