You are here

function hosting_client_view in Hosting 6.2

Same name and namespace in other branches
  1. 5 client/hosting_client.module \hosting_client_view()
  2. 7.4 client/hosting_client.module \hosting_client_view()
  3. 7.3 client/hosting_client.module \hosting_client_view()

Implementation of hook_view().

File

client/hosting_client.module, line 497

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) {
    $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;
}