You are here

function nodequeue_load_subqueues_by_queue in Nodequeue 7.2

Same name and namespace in other branches
  1. 5.2 nodequeue.module \nodequeue_load_subqueues_by_queue()
  2. 6.2 nodequeue.module \nodequeue_load_subqueues_by_queue()
  3. 7.3 nodequeue.module \nodequeue_load_subqueues_by_queue()

Load the entire set of subqueues for a queue.

This will load the entire set of subqueues for a given queue (and can respect the pager, if desired). It does NOT cache the subqueues like nodequeue_load_subqueues does, so beware of this mixed caching.

Parameters

$qids: A $qid or array of $qids

$page_size: If non-zero, use the pager_query and limit the page-size to the parameter.

Return value

array If $qids is empty it will return empty array else $subqueues.

38 calls to nodequeue_load_subqueues_by_queue()
NodequeueAdministerTestCase::testNodequeueAddNode in tests/nodequeue.test
NodequeueAdministerTestCase::testNodequeueViewSubqueue in tests/nodequeue.test
NodequeueAPIAccessUnitTest::testNodequeueQueueAccess in tests/nodequeue.test
NodequeueAPIMiscUnitTest::testNodequeueAutocomplete in tests/nodequeue.test
NodequeueAPISubqueueUnitTest::testNodequeueQueueBack in tests/nodequeue.test

... See full list

File

./nodequeue.module, line 1048
Maintains queues of nodes in arbitrary order.

Code

function nodequeue_load_subqueues_by_queue($qids, $page_size = 0) {
  if (is_numeric($qids)) {
    $qids = array(
      $qids,
    );
  }
  if (empty($qids)) {
    return array();
  }
  $query = "SELECT s.*, (SELECT count(*) FROM {nodequeue_nodes} n WHERE n.sqid = s.sqid) AS count FROM {nodequeue_subqueue} s WHERE s.qid IN (:qids)";
  $result = db_query($query, array(
    ':qids' => $qids,
  ));
  $subqueues = array();
  foreach ($result as $subqueue) {
    $subqueues[$subqueue->sqid] = $subqueue;
  }
  return $subqueues;
}