function _hosting_task_list in Hostmaster (Aegir) 6
Theme a task list
2 calls to _hosting_task_list()
- hosting_task_list in modules/
hosting/ task/ hosting_task.module - Display list of tasks
- hosting_task_list_embedded in modules/
hosting/ task/ hosting_task.module - A list of recent tasks, used to be embeded in site and platform nodes
File
- modules/
hosting/ task/ hosting_task.module, line 1070 - 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;
}
}