You are here

function hosting_platform_view in Hosting 6.2

Same name and namespace in other branches
  1. 5 platform/hosting_platform.module \hosting_platform_view()
  2. 7.4 platform/hosting_platform.module \hosting_platform_view()
  3. 7.3 platform/hosting_platform.module \hosting_platform_view()

Implementation of hook_view().

File

platform/hosting_platform.module, line 500
Platform node type definition.

Code

function hosting_platform_view($node, $teaser = FALSE, $page = FALSE) {
  modalframe_parent_js();
  $node->content['info'] = array(
    '#prefix' => '<div id="hosting-platform-info" class="hosting-info-list">',
    '#suffix' => '</div>',
  );
  $node->content['info']['verified'] = array(
    '#type' => 'item',
    '#title' => t('Verified'),
    '#value' => hosting_format_interval($node->verified),
    '#weight' => -10,
  );
  $node->content['info']['publish_path'] = array(
    '#type' => 'item',
    '#title' => t('Publish path'),
    '#value' => filter_xss($node->publish_path),
    '#weight' => -8,
  );
  $node->content['info']['web_server'] = array(
    '#type' => 'item',
    '#title' => t('Web server'),
    '#value' => _hosting_node_link($node->web_server),
    '#weight' => -7,
  );
  $node->content['info']['status'] = array(
    '#type' => 'item',
    '#title' => t('Status'),
    '#value' => _hosting_platform_status($node->platform_status),
  );
  if ($node->makefile) {
    $node->content['info']['makefile'] = array(
      '#type' => 'item',
      '#title' => t('Drush makefile'),
      '#value' => preg_match('/^http|^ftp/', $node->makefile) ? l('makefile', $node->makefile) : filter_xss($node->makefile),
    );
  }
  if ($node->release) {
    $release = sprintf("%s %s", $node->release->title, $node->release->version);
    $node->content['info']['release'] = array(
      '#type' => 'item',
      '#title' => t('Release'),
      '#value' => _hosting_node_link($node->release->nid, $release),
      '#weight' => -6,
    );
  }

  // Task list
  if ($page && $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;
}