You are here

function hosting_task_queue_block in Hostmaster (Aegir) 6

Hosting task list queue block

2 calls to hosting_task_queue_block()
hosting_task_ajax_queue in modules/hosting/task/hosting_task.module
hosting_task_summary in modules/hosting/task/hosting_task.module
Implementation of hosting_hook_summary()

File

modules/hosting/task/hosting_task.module, line 949
Web server node type is defined here.

Code

function hosting_task_queue_block() {
  drupal_add_js(drupal_get_path('module', 'hosting_task') . '/hosting_task.js');
  $settings['hostingTaskRefresh'] = array(
    'queueBlock' => 1,
  );
  drupal_add_js($settings, 'setting');
  $nodes = hosting_get_tasks('t.task-status', HOSTING_TASK_QUEUED, 5);
  $headers = array(
    t('Task'),
    t('Actions'),
  );
  $rows[] = array();
  foreach ($nodes as $node) {
    $row = array();
    $row['type'] = array(
      'data' => drupal_ucfirst(str_replace('_', ' ', $node->task_type)) . ' ' . _hosting_node_link($node->rid),
      'class' => 'hosting-status',
    );
    $log_button = _hosting_task_button(t('View'), 'node/' . $node->nid, t("Display the task log"), 'hosting-button-log', isset($node->nid) && user_access('access task logs'), true, false);
    $row['actions'] = array(
      'data' => $log_button,
      'class' => 'hosting-actions',
    );
    $class = hosting_task_status_class($node->task_status);
    $rows[] = array(
      'data' => $row,
      'class' => $class,
    );
  }
  return "<div id='hosting-task-queue-block'>" . theme('table', $headers, $rows, array(
    'class' => 'hosting-table',
  )) . "</div>";
}