You are here

private function BiblioEntrezPubmedArticle::contributors in Bibliography Module 7

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

Returns the list of contributors for import obtained from the given MedlineCitation element.

Return value

array the contributors of the article

1 call to BiblioEntrezPubmedArticle::contributors()
BiblioEntrezPubmedArticle::getBiblio in modules/pubmed/EntrezPubmedArticle.php
Returns article elements as an associative array suitable for import into a biblio node.

File

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

Class

BiblioEntrezPubmedArticle

Code

private function contributors() {
  $contributors = array();
  if (isset($this->article->Article->AuthorList->Author)) {
    foreach ($this->article->Article->AuthorList->Author as $author) {
      $name = '';
      if (isset($author->CollectiveName)) {

        // Corporate author.
        $category = 5;
        $name = (string) $author->CollectiveName;
      }
      else {

        // Primary (human) author.
        $category = 1;
        $lastname = (string) $author->LastName;
        if (isset($author->ForeName)) {
          $name = $lastname . ', ' . (string) $author->ForeName;
        }
        elseif (isset($author->FirstName)) {
          $name = $lastname . ', ' . (string) $author->FirstName;
        }
        elseif (isset($author->Initials)) {
          $name = $lastname . ', ' . (string) $author->Initials;
        }
      }
      if (!empty($name)) {
        $contributors[] = array(
          'name' => $name,
          'auth_category' => $category,
        );
      }
    }
  }
  return $contributors;
}