function node_import_list_tasks in Node import 6
Get a list of available tasks.
Parameters
$all: Boolean. If TRUE, all tasks are returned. If FALSE, only the tasks the current user has access to.
Return value
Array of tasks.
Related topics
2 calls to node_import_list_tasks()
- node_import_do_all_tasks in ./
node_import.inc - Import a number of rows from all available tasks. Should only be called from within hook_cron() or from a JS callback as this function may take a long time.
- node_import_list_tasks_form in ./
node_import.admin.inc - Lists the available import tasks and shows their progress.
File
- ./
node_import.inc, line 1099 - Public API of the Node import module.
Code
function node_import_list_tasks($all = FALSE) {
global $user;
$tasks = array();
if ($all || user_access('administer imports')) {
$result = db_query("SELECT * FROM {node_import_tasks} ORDER BY created ASC");
}
else {
$result = db_query("SELECT * FROM {node_import_tasks} WHERE uid = %d ORDER BY created ASC", $user->uid);
}
while ($task = db_fetch_array($result)) {
foreach (array(
'file_options',
'headers',
'map',
'defaults',
'options',
) as $key) {
$task[$key] = isset($task[$key]) ? unserialize($task[$key]) : array();
}
$task['file'] = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid = %d", $task['fid']));
$tasks[$task['taskid']] = $task;
}
return $tasks;
}