You are here

public function BiblioEntrezPubmedArticle::getBiblio in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/pubmed/EntrezPubmedArticle.php \BiblioEntrezPubmedArticle::getBiblio()
  2. 6 pubmed/EntrezPubmedArticle.php \BiblioEntrezPubmedArticle::getBiblio()
  3. 7.2 modules/pubmed/EntrezPubmedArticle.php \BiblioEntrezPubmedArticle::getBiblio()

Returns article elements as an associative array suitable for import into a biblio node.

Return value

array

1 call to BiblioEntrezPubmedArticle::getBiblio()
BiblioEntrezPubmedArticle::getBiblioAsObject in modules/pubmed/EntrezPubmedArticle.php

File

modules/pubmed/EntrezPubmedArticle.php, line 78
Provides a class for handling PubMed articles retrieved with EFetch.

Class

BiblioEntrezPubmedArticle

Code

public function getBiblio() {
  if (empty($this->biblio)) {
    if (variable_get('biblio_auto_citekey', 1)) {
      $citekey = '';
    }
    else {
      $citekey = $this->id;
    }

    // Attempts to extract the name of the journal from MedlineTA if
    // available.
    if (!empty($this->article->MedlineJournalInfo->MedlineTA)) {
      $journal = (string) $this->article->MedlineJournalInfo->MedlineTA;
    }
    elseif (!empty($this->article->Article->Journal->ISOAbbreviation)) {
      $journal = (string) $this->article->Article->Journal->ISOAbbreviation;
    }
    else {
      $journal = (string) $this->article->Article->Journal->Title;
    }
    $this->biblio = array(
      'title' => (string) $this->article->Article->ArticleTitle,
      'biblio_citekey' => $citekey,
      'biblio_pubmed_id' => $this->id,
      'biblio_pubmed_md5' => $this->md5,
      'biblio_contributors' => $this
        ->contributors(),
      // MedlineCitations are always articles from journals or books.
      'biblio_type' => 102,
      'biblio_date' => $this
        ->date(),
      'biblio_year' => substr($this
        ->date(), 0, 4),
      'biblio_secondary_title' => $journal,
      'biblio_alternate_title' => (string) $this->article->Article->Journal->ISOAbbreviation,
      'biblio_volume' => (string) $this->article->Article->Journal->JournalIssue->Volume,
      'biblio_issue' => (string) $this->article->Article->Journal->JournalIssue->Issue,
      'biblio_issn' => (string) $this->article->Article->Journal->ISSN,
      'biblio_pages' => (string) $this->article->Article->Pagination->MedlinePgn,
      'biblio_abst_e' => $this
        ->abst(),
      'biblio_custom1' => "https://www.ncbi.nlm.nih.gov/pubmed/{$this->id}?dopt=Abstract",
      'biblio_keywords' => $this
        ->keywords(),
      'biblio_lang' => $this
        ->lang(),
    );
    $doi = $this->article
      ->xpath('.//ELocationID[@EIdType="doi"]/text()');
    if (empty($doi)) {
      $doi = $this->pubmeddata
        ->xpath('.//ArticleId[@IdType="doi"]/text()');
    }
    if (!empty($doi)) {
      $this->biblio['biblio_doi'] = (string) $doi[0];
    }
    $pmcid = $this->pubmeddata
      ->xpath('.//ArticleId[@IdType="pmc"]/text()');
    if (!empty($pmcid)) {
      $this->biblio['biblio_pmcid'] = (string) $pmcid[0];
    }
    $grants = $this
      ->grants();
    if (!empty($grants)) {
      $this->biblio['biblio_pubmed_grants'] = $grants;
    }
  }
  return $this->biblio;
}