You are here

function nodequeue_nids_visible in Nodequeue 6.2

Same name and namespace in other branches
  1. 5.2 nodequeue.module \nodequeue_nids_visible()
  2. 7.3 nodequeue.module \nodequeue_nids_visible()
1 call to nodequeue_nids_visible()
_nodequeue_dragdrop_get_nodes in includes/nodequeue.admin.inc
Return a list of nodes in a specific subqueue.

File

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

Code

function nodequeue_nids_visible($sqid = -1, $account = NULL) {
  $node_status_sql = '';
  if (!$account) {
    global $user;
    $account = $user;
  }
  $nids_visible = array();
  if (!user_access('administer nodes', $account)) {
    $node_status_sql = ' AND (n.status = 1 || n.uid = %d)';
  }

  // Disable language selection temporarily, enable it again later.
  if (module_exists('i18n') && arg(0) == 'admin') {
    i18n_selection_mode('off');
  }
  $query_restricted = db_query(db_rewrite_sql("SELECT DISTINCT(n.nid), nq.position FROM {node} n LEFT JOIN {nodequeue_nodes} nq ON nq.nid = n.nid WHERE nq.sqid = %d " . $node_status_sql . " ORDER BY nq.position ASC"), $sqid, $account->uid);
  while ($result_restricted = db_fetch_object($query_restricted)) {
    $nids_visible[$result_restricted->nid] = $result_restricted->nid;
  }
  if (module_exists('i18n') && arg(0) == 'admin') {
    i18n_selection_mode('reset');
  }
  return $nids_visible;
}