You are here

function _fetch_keywords in Glossify 6.3

Same name and namespace in other branches
  1. 6 glossify.module \_fetch_keywords()

Helper function that fetches and returns an array of all keywords of a node, or just the ones for a specific method.

2 calls to _fetch_keywords()
glossify_nodeapi in ./glossify.module
Implementation of hook_nodeapi().
_fetch_affected_keywords in ./glossify.module
Helper function that fetches and returns an array of all new and old keywords of a node, depending on the method. It also provides for an easy way to update the keywords of a given method/configuration combination.

File

./glossify.module, line 710

Code

function _fetch_keywords($nid, $method = FALSE, $configuration = NULL) {
  if (!$configuration) {
    $q = db_query("SELECT term, method FROM {glossify} WHERE nid = %d ORDER BY term", $nid);
  }
  else {
    $q = db_query("SELECT term, method FROM {glossify} WHERE nid = %d AND configuration = '%s' ORDER BY term", $nid, $configuration);
  }
  $glossary = array();
  while ($r = db_fetch_array($q)) {
    if ($method) {
      if ($method == $r['method']) {
        $glossary[] = $r['term'];
      }
    }
    else {
      $glossary[$r['method']][] = $r['term'];
    }
  }
  return $glossary;
}