You are here

function hosting_client_view in Hosting 7.3

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

Implements hook_view().

File

client/hosting_client.module, line 635

Code

function hosting_client_view($node, $view_mode, $langcode = NULL) {
  $type = node_type_get_type($node);
  $node->content['info']['#prefix'] = '<div id="hosting-client-info">';
  $node->content['info']['title'] = array(
    '#type' => 'item',
    '#title' => $type->title_label,
    '#markup' => filter_xss($node->title),
  );
  $node->content['info']['uname'] = array(
    '#type' => 'item',
    '#title' => t('Internal name'),
    '#weight' => 1,
    '#markup' => filter_xss($node->uname),
  );
  $node->content['info']['#suffix'] = '</div>';
  if ($view_mode = 'full') {
    $rows = array();
    $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',
      '#markup' => theme('table', array(
        'header' => $header,
        'rows' => $rows,
      )),
      '#class' => 'client',
      '#prefix' => '<div id="hosting-site-list">',
      '#suffix' => '</div>',
      '#weight' => 11,
    );
  }
  return $node;
}