You are here

function PARSEENTRIES::bib2node in Bibliography Module 5

Same name and namespace in other branches
  1. 6 bibtexParse/PARSEENTRIES.php \PARSEENTRIES::bib2node()

File

bibtexParse/PARSEENTRIES.php, line 537

Class

PARSEENTRIES

Code

function bib2node(&$node_array, $node) {
  list($preamble, $strings, $entries, $undefinedStrings) = $this
    ->returnArrays();
  foreach ($entries as $entry) {
    $node_id = array_push($node_array, $node) - 1;
    switch ($entry['bibtexEntryType']) {
      case article:
        $node_array[$node_id]['biblio_type'] = 102;
        break;
      case book:
        $node_array[$node_id]['biblio_type'] = 100;
        break;
      case booklet:
      case inbook:
        $node_array[$node_id]['biblio_type'] = 101;
        break;
      case conference:
        $node_array[$node_id]['biblio_type'] = 103;
        break;
      case incollection:
        $node_array[$node_id]['biblio_type'] = 100;
        break;
      case inproceedings:
        $node_array[$node_id]['biblio_type'] = 103;
        break;
      case manual:
        $node_array[$node_id]['biblio_type'] = 129;
        break;
      case mastersthesis:
        $node_array[$node_id]['biblio_type'] = 108;
        break;
      case misc:
        $node_array[$node_id]['biblio_type'] = 129;
        break;
      case phdthesis:
        $node_array[$node_id]['biblio_type'] = 108;
        break;
      case proceedings:
        $node_array[$node_id]['biblio_type'] = 104;
        break;
      case techreport:
        $node_array[$node_id]['biblio_type'] = 109;
        break;
      case unpublished:
        $node_array[$node_id]['biblio_type'] = 124;
        break;
    }
    if (!empty($entry['author'])) {
      $node_array[$node_id]['biblio_authors'] = preg_replace("/\\s(and|&)\\s/i", "; ", $entry['author']);
    }

    /*
    $creator = new PARSECREATORS();
    $creatorArray = $creator->parse($entry['author']);

    foreach ($creatorArray as $auth){
    $node_array[$node_id]['biblio_authors'] .= (empty($node_array[$node_id]['biblio_authors'])) ? "":"; " ;
    $node_array[$node_id]['biblio_authors'] .= (!empty($auth['lastname'])) ? $auth['lastname'].((!empty($auth['firstname']) || !empty($auth['initials']) || !empty($auth['prefix']) )?', ':''):'' ;
    $node_array[$node_id]['biblio_authors'] .= (!empty($auth['prefix'])) ? $auth['prefix'].' ':'' ;
    $node_array[$node_id]['biblio_authors'] .= (!empty($auth['firstname'])) ? $auth['firstname'].' ':'' ;
    $node_array[$node_id]['biblio_authors'] .= (!empty($auth['initials'])) ? $auth['initials'].'. ':'' ;

    }
    }
    */
    if (!empty($entry['bibtexCitation'])) {
      $node_array[$node_id]['biblio_citekey'] = $entry['bibtexCitation'];
    }
    if (!empty($entry['editor'])) {
      $node_array[$node_id]['biblio_secondary_authors'] = $entry['editor'];
    }
    if (!empty($entry['journal'])) {
      $node_array[$node_id]['biblio_secondary_title'] = $entry['journal'];
    }
    if (!empty($entry['booktitle'])) {
      $node_array[$node_id]['biblio_secondary_title'] = $entry['booktitle'];
    }
    if (!empty($entry['series'])) {
      $node_array[$node_id]['biblio_secondary_title'] = $entry['series'];
    }
    if (!empty($entry['volume'])) {
      $node_array[$node_id]['biblio_volume'] = $entry['volume'];
    }
    if (!empty($entry['number'])) {
      $node_array[$node_id]['biblio_number'] = $entry['number'];
    }
    if (!empty($entry['year'])) {
      $node_array[$node_id]['biblio_year'] = $entry['year'];
    }
    if (!empty($entry['note'])) {
      $node_array[$node_id]['biblio_notes'] = $entry['note'];
    }
    if (!empty($entry['month'])) {
      $node_array[$node_id]['biblio_date'] = $entry['month'];
    }
    if (!empty($entry['pages'])) {
      $node_array[$node_id]['biblio_pages'] = $entry['pages'];
    }
    if (!empty($entry['publisher'])) {
      $node_array[$node_id]['biblio_publisher'] = $entry['publisher'];
    }
    if (!empty($entry['organization'])) {
      $node_array[$node_id]['biblio_publisher'] = $entry['organization'];
    }
    if (!empty($entry['school'])) {
      $node_array[$node_id]['biblio_publisher'] = $entry['school'];
    }
    if (!empty($entry['institution'])) {
      $node_array[$node_id]['biblio_publisher'] = $entry['institution'];
    }
    if (!empty($entry['title'])) {
      $node_array[$node_id]['title'] = $entry['title'];
    }
    if (!empty($entry['type'])) {
      $node_array[$node_id]['biblio_type_of_work'] = $entry['type'];
    }
    if (!empty($entry['edition'])) {
      $node_array[$node_id]['biblio_edition'] = $entry['edition'];
    }
    if (!empty($entry['chapter'])) {
      $node_array[$node_id]['biblio_section'] = $entry['chapter'];
    }
    if (!empty($entry['address'])) {
      $node_array[$node_id]['biblio_place_published'] = $entry['address'];
    }
    if (!empty($entry['abstract'])) {
      $node_array[$node_id]['biblio_abst_e'] = $entry['abstract'];
    }
    if (!empty($entry['keywords'])) {
      $node_array[$node_id]['biblio_keywords'] = $entry['keywords'];
    }
    if (!empty($entry['isbn'])) {
      $node_array[$node_id]['biblio_isbn'] = $entry['isbn'];
    }
    if (!empty($entry['url'])) {
      $node_array[$node_id]['biblio_url'] = $entry['url'];
    }
  }
}