You are here

function _scs_get_nodes in Simplenews Content Selection 6

Same name and namespace in other branches
  1. 6.2 scs.module \_scs_get_nodes()
2 calls to _scs_get_nodes()
scs_node_selection in ./scs.pages.inc
theme_scs_node_selection in ./scs.theme.inc

File

./scs.module, line 90

Code

function _scs_get_nodes() {
  $nodes = array();
  $content_types = variable_get('scs_content_types', array());
  foreach ($content_types as $type => $selected) {
    if ($selected == '0') {
      unset($content_types[$type]);
    }
  }
  if (count($content_types) != 0) {
    $p = db_placeholders($content_types, 'varchar');
    $result = db_query("SELECT nid, title, created FROM {node} WHERE type IN ({$p})", $content_types);
    while ($node = db_fetch_object($result)) {
      $node->created = date('Y-m-d H:i:s', $node->created);
      $nodes[] = $node;
    }
  }
  return $nodes;
}