You are here

function hosting_get_tasks in Hosting 7.3

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

Retrieve tasks with specified criteria.

@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

1 call to hosting_get_tasks()
_hosting_task_list in task/hosting_task.module
Theme a task list

File

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

Code

function hosting_get_tasks($filter_by = NULL, $filter_value = NULL, $count = 5, $element = 0) {
  $nodes = array();
  $query = db_select('node', 'n')
    ->extend('PagerDefault');
  $query
    ->element($element);
  $query
    ->join('hosting_task', 't', 'n.vid=t.vid');
  $query = $query
    ->fields('n')
    ->fields('t', array(
    'task_status',
    'task_type',
    'rid',
  ))
    ->condition('type', 'task')
    ->orderBy('n.vid', 'DESC')
    ->limit($count)
    ->addTag('node_access');
  if (isset($filter_by) && isset($filter_value)) {
    $query = $query
      ->condition($filter_by, $filter_value);
  }
  $result = $query
    ->execute();
  foreach ($result as $row) {
    $nodes[] = $row;
  }
  return $nodes;
}