function _hosting_task_list in Hosting 5
Same name and namespace in other branches
- 6.2 task/hosting_task.module \_hosting_task_list()
- 7.4 task/hosting_task.module \_hosting_task_list()
- 7.3 task/hosting_task.module \_hosting_task_list()
Theme functions
3 calls to _hosting_task_list()
- hosting_task_list in task/
hosting_task.module - Display list of tasks
- hosting_task_list_embedded in task/
hosting_task.module - hosting_task_summary in task/
hosting_task.module
File
- task/
hosting_task.module, line 524 - 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();
$row['type'] = array(
'data' => l(drupal_ucfirst($node->{$field}), 'node/' . $node->nid),
'class' => 'hosting-status',
);
if (!in_array('created', $skip)) {
$row['created'] = t("@interval ago", array(
'@interval' => format_interval(mktime() - $node->created, 1),
));
$headers[t('Created')] = '';
}
if (!in_array('actions', $skip) && user_access('retry failed tasks')) {
$headers[t('Actions')] = '';
if ($node->task_status == HOSTING_TASK_ERROR && !$node->queued) {
$row['actions'] = array(
'data' => drupal_get_form('hosting_task_retry_form', $node->nid),
'class' => 'hosting-task-retry',
);
}
else {
$row['actions'] = '';
}
}
if ($node->task_status == HOSTING_TASK_SUCCESS) {
$class = 'hosting-success';
}
elseif ($node->task_status == HOSTING_TASK_ERROR) {
$class = 'hosting-error';
}
else {
$class = 'hosting-queue';
}
$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;
}
}