You are here

function biblio_get_linked_contributors in Bibliography Module 7

Parameters

$aid:

2 calls to biblio_get_linked_contributors()
biblio_admin_author_edit_form in includes/biblio.admin.inc
_state
biblio_build_query in includes/biblio.pages.inc
Biblio_db_search builds the SQL query which will be used to select and order "biblio" type nodes. The query results are then passed to biblio_show_results for output.

File

includes/biblio.contributors.inc, line 12

Code

function biblio_get_linked_contributors($aid) {
  $related =& drupal_static(__FUNCTION__);
  if (!isset($related[$aid])) {
    $aka = db_query('SELECT aka FROM {biblio_contributor_data} WHERE cid = :cid', array(
      ':cid' => $aid,
    ))
      ->fetchField();
    if ($aka == 0) {
      $query = db_select('biblio_contributor_data', 'bcd');
      $cids = $query
        ->fields('bcd', array(
        'cid',
      ))
        ->condition(db_and()
        ->condition('bcd.aka', $aid, '=')
        ->condition('bcd.alt_form', 0, '='))
        ->execute()
        ->fetchCol();
    }
    else {
      $query = db_select('biblio_contributor_data', 'bcd');
      $and = db_and()
        ->condition('bcd.aka', $aka, '=')
        ->condition('bcd.alt_form', 0, '=')
        ->condition('bcd.cid', $aid, '<>');
      $cids = $query
        ->fields('bcd', array(
        'cid',
      ))
        ->condition(db_or()
        ->condition('bcd.cid', $aka)
        ->condition('bcd.aka', $aid)
        ->condition($and))
        ->execute()
        ->fetchCol();
    }
    $related[$aid] = $cids;
  }
  return $related[$aid];
}