function hosting_task_table in Hosting 7.4
Same name and namespace in other branches
- 6.2 task/hosting_task.module \hosting_task_table()
- 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 - Implements hook_view().
- hosting_server_view in server/
hosting_server.module - Implements hook_view().
- hosting_site_view in site/
hosting_site.nodeapi.inc - Implements hook_view().
- hosting_task_ajax_list in task/
hosting_task.module - Page callback to provide JSON output for a task.
File
- task/
hosting_task.module, line 1666 - Web server node type is defined here.
Code
function hosting_task_table($node) {
$output = '';
$headers[] = t('Task');
$headers[] = array(
'data' => t('Actions'),
'class' => array(
'hosting-actions',
),
);
$tasklist = hosting_task_fetch_tasks($node->nid);
$rows = array();
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;
}
if (empty($info['title'])) {
// Skip tasks from types that have since been removed.
continue;
}
$row['type'] = array(
'data' => $info['title'],
'class' => array(
'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("hosting_confirm/%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']) ? 'hosting/task/' . $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' => array(
'hosting-actions',
),
);
$rows[] = array(
'data' => $row,
'class' => array(
$info['class'],
),
);
}
$output .= theme('table', array(
'header' => $headers,
'rows' => $rows,
'attributes' => array(
'class' => array(
'hosting-table',
),
),
));
return $output;
}