You are here

function nodequeue_subqueue_add in Nodequeue 5.2

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

Add a node to a queue.

Parameters

$queue: The parent queue of the subqueue. This is required so that we can pop nodes out if the queue breaks size limits.

$sqid: The subqueue ID to add the node to.

$nid: The node ID

6 calls to nodequeue_subqueue_add()
action_nodequeue_add in ./nodequeue.actions.inc
Old-style action to add a node to a queue.
nodequeue_add_action in ./nodequeue.actions.inc
Action to add a node to a queue.
nodequeue_admin_add_node in ./nodequeue.module
Page callback to add a node to a queue.
nodequeue_arrange_subqueue_form_submit in ./nodequeue.module
Submit function for nodequeue_arrange_subqueue_form
nodequeue_generate_form_submit in ./nodequeue_generate.module

... See full list

File

./nodequeue.module, line 1891

Code

function nodequeue_subqueue_add($queue, $subqueue, $nid) {

  // If adding this would make the queue too big, pop the front node
  // (or nodes) out.
  if ($queue->size) {

    // 0 means infinity so never do this if false
    nodequeue_check_subqueue_size($queue, $subqueue, $queue->size - 1);
  }
  db_query("INSERT INTO {nodequeue_nodes} (sqid, qid, nid, position, timestamp) VALUES (%d, %d, %d, %d, %d)", $subqueue->sqid, $queue->qid, $nid, $subqueue->count + 1, time());
}