Project

General

Profile

« Previous | Next » 

Revision d5de0b1f

Added by Andreas Kohlbecker over 3 years ago

ref #9265 getting citationDetail from NomenclaturalSource

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
1916 1916
  }
1917 1917
}
1918 1918

  
1919

  
1920
/**
1921
 * Get a NomenclaturalReference string.
1922
 *
1923
 * Returns the NomenclaturalReference string with correctly placed
1924
 * microreference (= reference detail) e.g.
1925
 * in Phytotaxa 43: 1-48. 2012.
1926
 *
1927
 * @param string $referenceUuid
1928
 *   UUID of the reference.
1929
 * @param string $microreference
1930
 *   Reference detail.
1931
 *
1932
 * @return string
1933
 *   a NomenclaturalReference.
1934
 */
1935
function cdm_ws_getNomenclaturalReference($referenceUuid, $microreference) {
1936

  
1937
  // TODO the below statement avoids error boxes due to #4644 remove it once this ticket is solved
1938
  if(is_array($microreference) || is_object($microreference)) {
1939
    return '';
1940
  }
1941

  
1942
  $obj = cdm_ws_get(CDM_WS_NOMENCLATURAL_REFERENCE_CITATION, array(
1943
    $referenceUuid,
1944
  ), "microReference=" . urlencode($microreference));
1945

  
1946
  if ($obj) {
1947
    return $obj->String;
1948
  }
1949
  else {
1950
    return NULL;
1951
  }
1952
}
1953

  
1954 1919
/**
1955 1920
 * finds and returns the FeatureNode denoted by the given $feature_uuid
1956 1921
 *
modules/cdm_dataportal/cdm_api/webservice_uris.php
18 18
 * Provides the protologue and original publication links of the name
19 19
 */
20 20
define('CDM_WS_NAME_PROTOLOGUE_LINKS', 'name/$0/protologueLinks');
21
define('CDM_WS_NOMENCLATURAL_REFERENCE_CITATION', 'name/$0/nomenclaturalCitation');
22 21

  
23 22
define('CDM_WS_NAME', 'name');
24 23
define('CDM_WS_NAME_NAMECAHE', 'name/$0/nameCache');
modules/cdm_dataportal/includes/name.inc
415 415
      if (isset($renderTemplate['referencePart']['microreference'])&& isset($taxon_name->nomenclaturalSource->citationMicroReference)) {
416 416
        $microreference = $taxon_name->nomenclaturalSource->citationMicroReference;
417 417
      }
418
      if(count($nomref_tagged_text) == 0 && isset($taxon_name->nomenclaturalSource->citation)){
419
        // TODO is this case still relevant? The tagged text should already contain all information!
420
        $citation = cdm_ws_getNomenclaturalReference($taxon_name->nomenclaturalSource->citation->uuid, $microreference);
418
      if(count($nomref_tagged_text) == 0 && isset($taxon_name->nomenclaturalSource->citation->title)){
419
        $citation = $taxon_name->nomenclaturalSource->citation->title; // using only the title here since the authors are already addded to the string
420
        if(isset($taxon_name->nomenclaturalSource->citationMicroReference) && $taxon_name->nomenclaturalSource->citationMicroReference){
421
          $citation .= ': ' . $taxon_name->nomenclaturalSource->citationMicroReference;
422
        }
421 423
        // Find preceding element of the reference.
422 424
        $precedingKey = get_preceding_contentElementKey('reference', $renderTemplate);
423 425
        if (str_beginsWith($citation, ", in")) {

Also available in: Unified diff