You are here

function _biblio_get_auth_types in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 biblio.module \_biblio_get_auth_types()
  2. 7 biblio.module \_biblio_get_auth_types()
  3. 7.2 biblio.module \_biblio_get_auth_types()

biblio.module for Drupal

Copyright (C) 2006-2010 Ron Jerome

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

4 calls to _biblio_get_auth_types()
biblio_admin_types_edit_form in ./biblio.admin.inc
biblio_contributors_js in ./biblio.module
_biblio_contributor_widget in ./biblio.module
_biblio_get_auth_type in ./biblio.module

File

./biblio.module, line 23

Code

function _biblio_get_auth_types($auth_category, $biblio_type) {
  static $auth_types = array();
  if (empty($auth_types)) {
    $db_res = db_query("SELECT * FROM {biblio_contributor_type}");
    while ($row = db_fetch_object($db_res)) {
      $auth_types[$row->auth_category][$row->biblio_type][] = $row->auth_type;
    }
  }
  $result = isset($auth_types[$auth_category][$biblio_type]) ? $auth_types[$auth_category][$biblio_type] : null;

  // fall back to defaults, if no author types are defined for this biblio_type
  if (empty($result)) {
    $result = $auth_types[$auth_category][0];
  }
  return $result;
}