You are here

function hosting_server_view in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 server/hosting_server.module \hosting_server_view()
  2. 7.3 server/hosting_server.module \hosting_server_view()

Implementation of hook_view().

File

server/hosting_server.module, line 452

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" class="hosting-info-list">',
    '#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;
}