You are here

function hosting_platform_view in Hosting 7.3

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

Implements hook_view().

File

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

Code

function hosting_platform_view($node, $view_mode, $langcode = NULL) {
  hosting_set_breadcrumb($node);
  $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'),
    '#markup' => hosting_format_interval($node->verified),
    '#weight' => -10,
  );
  $node->content['info']['publish_path'] = array(
    '#type' => 'item',
    '#title' => t('Publish path'),
    '#markup' => filter_xss($node->publish_path),
    '#weight' => -8,
  );
  $node->content['info']['web_server'] = array(
    '#type' => 'item',
    '#title' => t('Web server'),
    '#markup' => _hosting_node_link($node->web_server),
    '#weight' => -7,
  );
  $node->content['info']['status'] = array(
    '#type' => 'item',
    '#title' => t('Status'),
    '#markup' => _hosting_platform_status($node->platform_status),
  );
  if ($node->makefile) {
    $node->content['info']['makefile'] = array(
      '#type' => 'item',
      '#title' => t('Drush makefile'),
      '#markup' => preg_match('/^http|^ftp/', $node->makefile) ? l(t('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'),
      '#markup' => _hosting_node_link($node->release->nid, $release),
      '#weight' => -6,
    );
  }

  // Task list.
  if ($view_mode == 'full' && $node->nid) {
    $node->content['tasks_view'] = array(
      '#type' => 'item',
      '#markup' => hosting_task_table($node),
      '#prefix' => '<div id="hosting-task-list">',
      '#suffix' => '</div>',
      '#weight' => 9,
    );
    $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');
  }
  return $node;
}