/**
  * @covers NlmCitationSchemaAbntFilter
  */
 public function testExecuteWithJournal()
 {
     $nameSchema = new NlmNameSchema();
     $citationSchema = new NlmCitationSchema();
     // Two representative authors
     $author1Description = new MetadataDescription($nameSchema, ASSOC_TYPE_AUTHOR);
     $author1Description->addStatement('surname', $surname = 'Silva');
     $author1Description->addStatement('given-names', $givenName1 = 'Vitor');
     $author1Description->addStatement('given-names', $givenName2 = 'Antonio');
     $author2Description = new MetadataDescription($nameSchema, ASSOC_TYPE_AUTHOR);
     $author2Description->addStatement('surname', $surname2 = 'Santos');
     $author2Description->addStatement('prefix', $prefix1 = 'dos');
     $author2Description->addStatement('given-names', $givenName3 = 'Pedro');
     // Check a journal article
     $citationDescription = new MetadataDescription($citationSchema, ASSOC_TYPE_CITATION);
     $citationDescription->addStatement('[@publication-type]', $pubType = 'journal');
     $citationDescription->addStatement('person-group[@person-group-type="author"]', $author1Description);
     $citationDescription->addStatement('person-group[@person-group-type="author"]', $author2Description);
     $citationDescription->addStatement('article-title', $articleTitle = 'Etinobotânica Xucuru: espécies místicas');
     $citationDescription->addStatement('source', $source = 'Biotemas');
     $citationDescription->addStatement('publisher-loc', $pubLoc = 'Florianópolis');
     $citationDescription->addStatement('volume', $volume = '15');
     $citationDescription->addStatement('issue', $issue = '1');
     $citationDescription->addStatement('fpage', $fpage = 45);
     $citationDescription->addStatement('lpage', $lpage = 57);
     $citationDescription->addStatement('date', $date = '2000-06');
     $citationOutputFilter = new NlmCitationSchemaAbntFilter($this->_request);
     $result = $citationOutputFilter->execute($citationDescription);
     self::assertEquals('SILVA, V.A.; DOS SANTOS, P. Etinobotânica Xucuru: espécies místicas. <i>Biotemas,</i> Florianópolis, v.15, n.1, p.45-57, jun. 2000.', $result);
 }
Ejemplo n.º 2
0
 /**
  * Export a list of formatted citations
  * @param $args array
  * @param $request PKPRequest
  * @return string
  */
 function exportCitations(&$args, &$request)
 {
     // We currently only support the NLM citation schema.
     import('metadata.nlm.NlmCitationSchema');
     $nlmCitationSchema = new NlmCitationSchema();
     // We currently only support the ABNT citation output schema
     import('citation.output.abnt.NlmCitationSchemaAbntFilter');
     $citationOutputFilter = new NlmCitationSchemaAbntFilter($request);
     $formattedCitations = array();
     $citations =& $this->_getSortedElements();
     while (!$citations->eof()) {
         // Retrieve NLM citation meta-data
         $citation =& $citations->next();
         $metadataDescription =& $citation->extractMetadata($nlmCitationSchema);
         assert(!is_null($metadataDescription));
         // Apply the citation output format filter
         $formattedCitations[] = $citationOutputFilter->execute($metadataDescription);
         unset($citation, $metadataDescription);
     }
     // Render the citation list
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->assign_by_ref('formattedCitations', $formattedCitations);
     $citationList = $templateMgr->fetch('controllers/grid/citation/citationExport.tpl');
     return $citationList;
 }