You are here

function hosting_server_view in Hostmaster (Aegir) 6

Implementation of hook_view().

File

modules/hosting/server/hosting_server.module, line 414

Code

function hosting_server_view(&$node, $teaser = FALSE, $page = FALSE) {
  hosting_set_breadcrumb($node);
  $node = node_prepare($node, $teaser);
  $services = hosting_server_services();
  $node->content['info'] = array(
    '#prefix' => '<div id="hosting-server-info">',
    '#suffix' => '</div>',
  );
  hosting_ip_view($node);
  if (isset($node->content->info->ip_addresses['#weight'])) {
    $node->content->info->ip_addresses['#weight'] = -30;
  }
  foreach ($node->services as $name => $service) {
    $node->content['info'][$name] = array(
      '#prefix' => '<div class="hosting-service-info hosting-service-' . $name . '-info">',
      '#suffix' => '</div>',
    );
    if (isset($services[$name]['weight'])) {
      $node->content['info'][$name]['#weight'] = $services[$name]['weight'];
    }
    $title = $services[$name]['title'] . ' : ' . $service->type;
    $node->content['info'][$name]['title'] = array(
      '#value' => '<h3>' . $title . '</h3>',
      '#weight' => -20,
    );
    $service
      ->view($node->content['info'][$name]);
  }
  if ($page) {

    // Task list
    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;
}