function hosting_client_view in Hosting 5
Same name and namespace in other branches
- 6.2 client/hosting_client.module \hosting_client_view()
- 7.4 client/hosting_client.module \hosting_client_view()
- 7.3 client/hosting_client.module \hosting_client_view()
Implementation of hook_view().
File
- client/
hosting_client.module, line 328
Code
function hosting_client_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['info']['#prefix'] = '<div id="hosting-client-info">';
if ($node->organization) {
$node->content['info']['organization'] = array(
'#type' => 'item',
'#title' => t('Organization'),
'#value' => filter_xss($node->organization),
);
}
if ($node->client_name) {
$node->content['info']['name'] = array(
'#type' => 'item',
'#title' => t('Contact name'),
'#value' => filter_xss($node->client_name),
);
}
if ($node->name || $node->email) {
$node->content['info']['email'] = array(
'#type' => 'item',
'#title' => t('Email'),
'#value' => filter_xss($node->email),
);
}
$node->content['info']['#suffix'] = '</div>';
if ($page) {
$node->content['sites_view'] = array(
'#type' => 'item',
'#value' => hosting_site_list("client", $node->nid),
'#prefix' => '<div id="hosting-site-list">',
'#suffix' => '</div>',
'#weight' => 10,
);
// this should probably be factored out in a common function
$q = db_query("SELECT u.uid, u.name FROM {hosting_client_user} h INNER JOIN {users} u ON u.uid = h.user WHERE h.client = %d", $node->nid);
while ($result = db_fetch_array($q)) {
if (user_access('view users') || $result['uid'] == $GLOBALS['user']->uid) {
$rows[] = array(
l($result['name'], 'user/' . $result['uid']),
);
}
else {
$rows[] = array(
$result['name'],
);
}
}
$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;
}