You are here

function hosting_task_table in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 task/hosting_task.module \hosting_task_table()
  2. 7.3 task/hosting_task.module \hosting_task_table()

A concise table listing of the tasks affecting this node

This shows a table view of the tasks relevant to this node. It will show tasks that can be executed as well as tasks that have been in a single simple interface.

4 calls to hosting_task_table()
hosting_platform_view in platform/hosting_platform.module
Implementation of hook_view().
hosting_server_view in server/hosting_server.module
Implementation of hook_view().
hosting_site_view in site/hosting_site.nodeapi.inc
Implementation of hook_view().
hosting_task_ajax_list in task/hosting_task.module

File

task/hosting_task.module, line 1076
Web server node type is defined here.

Code

function hosting_task_table($node) {
  $output = '';
  $headers[] = t('Task');
  $headers[] = array(
    'data' => t('Actions'),
    'class' => 'hosting-actions',
  );
  $tasklist = hosting_task_fetch_tasks($node->nid);
  foreach ($tasklist as $task => $info) {
    $row = array();
    if (!isset($info['nid']) && !$info['task_permitted']) {

      // just don't show those tasks, since we'll not be able to run them
      continue;
    }
    $row['type'] = array(
      'data' => $info['title'],
      'class' => 'hosting-status',
    );
    $actions = array();
    if (isset($info['task_status']) && $info['task_status'] == 0) {
      $actions['cancel'] = _hosting_task_button(t('Cancel'), sprintf("hosting/tasks/%d/cancel", $info['nid']), t("Cancel the task and remove it from the queue"), 'hosting-button-stop', !$info['task_permitted']);
    }
    else {
      $actions['run'] = _hosting_task_button(t('Run'), sprintf("node/%d/%s_%s", $node->nid, $node->type, $task), $info['description'], 'hosting-button-run', $info['task_permitted'], $info['dialog']);
    }
    $actions['log'] = _hosting_task_button(t('View'), isset($info['nid']) ? 'node/' . $info['nid'] : '<front>', t("Display the task log"), 'hosting-button-log', isset($info['nid']) && user_access('access task logs'), TRUE, FALSE);
    $row['actions'] = array(
      'data' => implode('', $actions),
      'class' => 'hosting-actions',
    );
    $rows[] = array(
      'data' => $row,
      'class' => $info['class'],
    );
  }
  $output .= theme('table', $headers, $rows, array(
    'class' => 'hosting-table',
  ));
  return $output;
}