You are here

function _biblio_pm_import_pmids in Bibliography Module 6

1 call to _biblio_pm_import_pmids()
biblio_pm_biblio_import in pubmed/biblio_pm.module

File

pubmed/biblio_pm.module, line 81

Code

function _biblio_pm_import_pmids($pmids, $terms, $batch, $session_id) {
  module_load_include('php', 'biblio_pm', 'EntrezClient');
  module_load_include('php', 'biblio_pm', 'EntrezPubmedArticle');
  $retmax = 100;
  $resmax = count($pmids);
  $start = 0;
  $Eclient = new BiblioEntrezClient();
  $Eclient
    ->post($pmids);
  $Eclient
    ->setReturnMax($retmax);
  $nids = array();
  $dups = array();
  while (($result = $Eclient
    ->fetchRecords($start)) && $start < $resmax) {
    $start += count($result
      ->xpath('//PubmedArticle'));
    list($nid, $dup) = _biblio_pm_create_node_from_xml($result, $terms, $batch, $session_id);
    $nids = array_merge($nids, $nid);
    $dups = array_merge($dups, $dup);
  }
  return array(
    $nids,
    $dups,
  );
}