You are here

function _hosting_task_list in Hosting 6.2

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

Theme a task list

1 call to _hosting_task_list()
hosting_task_list in task/hosting_task.module
Display list of tasks

File

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

Code

function _hosting_task_list($filter_by, $filter_value, $count = 5, $element = 0, $field = 'title', $skip = array(), $pager = TRUE) {
  $nodes = hosting_get_tasks($filter_by, $filter_value, $count, $element);
  if (!$nodes) {
    return t('No tasks available');
  }
  else {
    $headers[t('Task')] = '';
    foreach ($nodes as $node) {
      $row = array();
      if ($field == 'title') {
        $data = drupal_ucfirst($node->task_type) . ' ' . _hosting_node_link($node->rid);
      }
      else {
        $data = $node->{$field};
      }
      $row['type'] = array(
        'data' => $data,
        'class' => 'hosting-status',
      );
      if (!in_array('created', $skip)) {
        $row['created'] = t("@interval ago", array(
          '@interval' => format_interval(time() - $node->created, 1),
        ));
        $headers[t('Created')] = '';
      }
      $row['executed'] = t("@interval ago", array(
        '@interval' => format_interval(time() - $node->changed, 1),
      ));
      $headers[t('Executed')] = '';
      $headers[t('Actions')] = '';
      $actions['log'] = l(t('View'), 'node/' . $node->nid, array(
        'attributes' => array(
          'class' => 'hosting-button-dialog hosting-button-enabled hosting-button-log',
        ),
      ));
      $row['actions'] = array(
        'data' => $actions['log'],
        'class' => 'hosting-actions',
      );
      $class = hosting_task_status_class($node->task_status);
      $rows[] = array(
        'data' => $row,
        'class' => $class,
      );
    }
    $output = theme('table', array_keys($headers), $rows, array(
      'class' => 'hosting-table',
    ));
    if ($pager === TRUE) {
      $output .= theme('pager', NULL, $count, $element);
    }
    elseif (is_string($pager)) {
      $output .= $pager;
    }
    return $output;
  }
}