You are here

function hosting_site_view in Hostmaster (Aegir) 6

Implementation of hook_view().

File

modules/hosting/site/hosting_site.nodeapi.inc, line 24
Site nodeapi implementations.

Code

function hosting_site_view(&$node, $teaser = false) {
  hosting_set_breadcrumb($node);
  modalframe_parent_js();
  $node->content['info']['#prefix'] = '<div id="hosting-site-info">';
  if ($node->site_status == HOSTING_SITE_ENABLED) {
    $node->content['info']['link'] = array(
      '#value' => _hosting_site_goto_link($node),
      '#weight' => -10,
    );
  }
  if (is_numeric($node->client)) {
    $node->content['info']['client'] = array(
      '#type' => 'item',
      '#title' => t('Client'),
      '#value' => _hosting_node_link($node->client),
      '#weight' => 5,
    );
  }
  $node->content['info']['verified'] = array(
    '#type' => 'item',
    '#title' => t('Verified'),
    '#value' => hosting_format_interval($node->verified),
  );
  $node->content['info']['platform'] = array(
    '#type' => 'item',
    '#title' => t('Platform'),
    '#value' => _hosting_node_link($node->platform),
  );
  if ($node->profile) {
    $node->content['info']['profile'] = array(
      '#type' => 'item',
      '#title' => t('Install profile'),
      '#value' => _hosting_node_link($node->profile),
    );
  }
  if ($node->site_language) {
    $node->content['info']['site_language'] = array(
      '#type' => 'item',
      '#title' => t('Language'),
      '#value' => _hosting_language_name($node->site_language),
    );
  }
  if ($node->db_server) {
    $node->content['info']['db_server'] = array(
      '#type' => 'item',
      '#title' => t('Database server'),
      '#value' => _hosting_node_link($node->db_server),
    );
  }
  if ($node->nid) {
    $node->content['info']['status'] = array(
      '#type' => 'item',
      '#title' => t('Status'),
      '#value' => _hosting_site_status($node),
    );
  }
  hosting_ip_view($node);
  $node->content['info']['#suffix'] = '</div>';
  if ($node->nid) {
    $node->content['tasks_view'] = array(
      '#type' => 'item',
      '#value' => hosting_task_table($node),
      '#prefix' => '<div id="hosting-task-list">',
      '#suffix' => '</div>',
      '#weight' => 10,
    );
    $settings['hostingTaskRefresh'] = array(
      'nid' => $node->nid,
      'changed' => $node->changed,
    );
    drupal_add_js($settings, 'setting');
    drupal_add_js(drupal_get_path('module', 'hosting_task') . '/hosting_task.js');
  }
  return $node;
}