You are here

function hosting_site_view in Hosting 7.4

Same name and namespace in other branches
  1. 5 site/hosting_site.module \hosting_site_view()
  2. 6.2 site/hosting_site.nodeapi.inc \hosting_site_view()
  3. 7.3 site/hosting_site.nodeapi.inc \hosting_site_view()

Implements hook_view().

File

site/hosting_site.nodeapi.inc, line 29
Site nodeapi implementations.

Code

function hosting_site_view($node, $view_mode, $langcode = NULL) {
  hosting_set_breadcrumb($node);
  drupal_set_title(hosting_site_canonical_url($node));
  hosting_platform_view($node, 'full');
  if ($node->site_status == HOSTING_SITE_ENABLED) {
    $node->content['info']['link'] = array(
      '#markup' => _hosting_site_goto_link($node),
      '#weight' => -10,
    );
  }
  if (is_numeric($node->client)) {
    $node->content['info']['client'] = array(
      '#type' => 'item',
      '#title' => t('Client'),
      '#markup' => _hosting_node_link($node->client),
      '#weight' => 5,
    );
  }
  $node->content['info']['verified'] = array(
    '#type' => 'item',
    '#title' => t('Verified'),
    '#markup' => hosting_format_interval($node->verified),
    '#weight' => -9,
  );
  $node->content['info']['platform'] = array(
    '#type' => 'item',
    '#title' => t('Platform'),
    '#markup' => _hosting_node_link($node->platform),
  );
  if ($node->profile) {
    $node->content['info']['profile'] = array(
      '#type' => 'item',
      '#title' => t('Install profile'),
      '#markup' => _hosting_node_link($node->profile),
    );
  }
  if ($node->site_language) {
    $node->content['info']['site_language'] = array(
      '#type' => 'item',
      '#title' => t('Language'),
      '#markup' => _hosting_language_name($node->site_language),
    );
  }
  if ($node->nid) {
    $node->content['info']['status'] = array(
      '#type' => 'item',
      '#title' => t('Status'),
      '#markup' => _hosting_site_status($node),
    );
  }
  if ($node->db_server) {
    $node->content['info']['db_server'] = array(
      '#type' => 'item',
      '#title' => t('Database server'),
      '#markup' => _hosting_node_link($node->db_server),
    );
  }
  if ($node->db_name) {
    $node->content['info']['db_name'] = array(
      '#type' => 'item',
      '#title' => t('Database name'),
      '#markup' => check_plain($node->db_name),
    );
  }
  if ($node->nid) {
    $node->content['tasks_view'] = array(
      '#type' => 'container',
      '#children' => hosting_task_table($node),
      '#attributes' => array(
        'id' => 'hosting-task-list',
      ),
      '#weight' => 10,
    );
    $settings['hostingTaskRefresh'] = array(
      'nid' => $node->nid,
      'changed' => $node->changed,
    );
    drupal_add_js($settings, array(
      'type' => 'setting',
      'scope' => JS_DEFAULT,
    ));
    drupal_add_js(drupal_get_path('module', 'hosting_task') . '/hosting_task.js');
  }

  // Show files directory.
  $node->content['info']['file_public_path'] = array(
    '#type' => 'item',
    '#title' => t('Public Files'),
    '#markup' => check_plain($node->file_public_path),
  );
  $node->content['info']['#attributes']['id'] = 'hosting-info-panel';
  $node->content['info']['#attributes']['class'][] = 'hosting-panel';
  $node->content['tasks_view']['#attributes']['id'] = 'hosting-tasks-panel';
  $node->content['tasks_view']['#attributes']['class'][] = 'hosting-panel';
  return $node;
}