You are here

function hosting_get_tasks in Hosting 6.2

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

Retrieve tasks with specified criterias

@arg $filter_by string a field to filter the list with, unchecked @arg $filter_value string what to restrict the field to, checked @arg $count integer the number of tasks to return @arg $element integer which element to start from

2 calls to hosting_get_tasks()
hosting_task_queue_block in task/hosting_task.module
Hosting task list queue block
_hosting_task_list in task/hosting_task.module
Theme a task list

File

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

Code

function hosting_get_tasks($filter_by = null, $filter_value = null, $count = 5, $element = 0) {
  $nodes = array();
  $args[] = 'task';
  $cond = '';
  if ($filter_by && $filter_value) {
    $cond = ' AND t.' . $filter_by . ' = %d';
    $args[] = $filter_value;
  }
  $result = pager_query(db_rewrite_sql("SELECT n.*, t.task_status, t.task_type, t.rid FROM {node} n INNER JOIN {hosting_task} t on n.vid=t.vid WHERE type='%s'" . $cond . " ORDER BY n.vid DESC"), $count, $element, NULL, $args);
  while ($row = db_fetch_object($result)) {
    $nodes[] = $row;
  }
  return $nodes;
}