Project

General

Profile

Revision eebf415b

IDeebf415b5ddb507dad7de6c82d970187059b6618
Parent 023c4a03
Child 55efa02e, 21a57a59

Added by Andreas Kohlbecker over 1 year ago

fix #6679 fixing bugs in misapplied name processing and adding sensu reference

View differences:

modules/cdm_dataportal/includes/name.inc
250 250
 *
251 251
 * @param $taxonName
252 252
 *    cdm TaxonName instance
253
 * @param $sec
254
 *    the sec reference of a taxon having this name (optional)
255 253
 * @param $nameLink
256 254
 *    URI to the taxon, @see path_to_taxon(), must be processed by url() before passing to this method
257 255
 * @param $refenceLink
modules/cdm_dataportal/includes/taxon.inc
31 31
 * @}
32 32
 */
33 33

  
34
define('TAXON_TYPE_SYNONYM', 'Synonym');
35
define('TAXON_TYPE_MISAPPLIEDNAME', 'misapplied-name');
34 36

  
35 37
/**
36 38
 * Returns HTML for misapplied names and invalid designations.
......
467 469
    if (isset($table_of_accepted[$taxon->uuid])) {
468 470
      // Its a synonym or misapplied name.
469 471
      $is_synonym = isset($synonym_uuids[$taxon->uuid]); //TODO better use the $taxon->class attribute?
470
      $taxon_type = $is_synonym ? "Synonym" : "misapplied-name";
472
      $taxon_type = $is_synonym ? TAXON_TYPE_SYNONYM :TAXON_TYPE_MISAPPLIEDNAME;
471 473

  
472
      $acceptedTaxon = $table_of_accepted[$taxon->uuid];
474
      $acceptedTaxa = $table_of_accepted[$taxon->uuid];
473 475

  
474
      if (is_object($acceptedTaxon)) {
476
      if (!is_array($acceptedTaxa)) {
477
        $acceptedTaxa = array($acceptedTaxa);
478
      }
475 479

  
476
        $taxonUri = uri_to_synonym($taxon->uuid, $acceptedTaxon->uuid);
477
        $referenceUri = '';
478
        if (isset($acceptedTaxon->name->nomenclaturalReference)) {
479
          $referenceUri = url(path_to_reference($acceptedTaxon->name->nomenclaturalReference->uuid));
480
        }
481
        $taxon_or_name = $is_synonym ? $taxon->name : $taxon;
482
        // $taxon_or_name this is a trick to suppress the sec reference for sysnonyms
483
        // supplying the name will cause render_taxon_or_name() to not show the sec reference
484
        $out .= '<li class="' . $taxon_type . '">' . render_taxon_or_name($taxon_or_name, $taxonUri, $referenceUri);
485
        if ($show_classification) {
486
          $classifications = get_classifications_for_taxon($taxon);
487
          $classification_titles = array();
488
          foreach ($classifications as $classification) {
489
            if (isset($classification->titleCache)) {
490
              $classification_titles[] = $classification->titleCache;
480
      foreach ($acceptedTaxa as $acceptedTaxon) {
481
        if (is_object($acceptedTaxon)) {
482

  
483
          $taxonUri = uri_to_synonym($taxon->uuid, $acceptedTaxon->uuid);
484
          $referenceUri = '';
485
          if (isset($acceptedTaxon->name->nomenclaturalReference)) {
486
            $referenceUri = url(path_to_reference($acceptedTaxon->name->nomenclaturalReference->uuid));
487
          }
488
          $taxon_or_name = $is_synonym ? $taxon->name : $taxon;
489
          // $taxon_or_name this is a trick to suppress the sec reference for synonyms
490
          // supplying the name will cause render_taxon_or_name() to not show the sec reference
491
          $out .= '<li class="' . $taxon_type . '">' . render_taxon_or_name($taxon_or_name, $taxonUri, $referenceUri);
492
          if($taxon_type == TAXON_TYPE_MISAPPLIEDNAME){
493
            if(isset($taxon->sec->authorship)){
494
              $authorship = $taxon->sec->authorship->titleCache;
495
            } else {
496
              $authorship = $taxon->sec->titleCache;
491 497
            }
498
            $out .=  ' sensu ' . $authorship;
492 499
          }
493
          if (count($classification_titles) == 0) {
494
            $classification_titles[] = $unclassified_snippet;
500
          if ($show_classification) {
501
            $classifications = get_classifications_for_taxon($taxon);
502
            $classification_titles = array();
503
            foreach ($classifications as $classification) {
504
              if (isset($classification->titleCache)) {
505
                $classification_titles[] = $classification->titleCache;
506
              }
507
            }
508
            if (count($classification_titles) == 0) {
509
              $classification_titles[] = $unclassified_snippet;
510
            }
511
            $out .= '<span class="classifications"><span class="separator"> : </span>' . implode(', ', $classification_titles) . '</span>';
512
          }
513
          $out .= theme('cdm_annotations_as_footnotekeys', array('cdmBase_list' => $taxon));
514
          if ($showMedia_synonyms) {
515
            $out .= theme('cdm_taxon_list_thumbnails', array('taxon' => $acceptedTaxon));
495 516
          }
496
          $out .= '<span class="classifications"><span class="separator"> : </span>' . implode(', ', $classification_titles) . '</span>';
497
        }
498
        $out .= theme('cdm_annotations_as_footnotekeys', array('cdmBase_list' => $taxon));
499
        if ($showMedia_synonyms) {
500
          $out .= theme('cdm_taxon_list_thumbnails', array('taxon' => $acceptedTaxon));
501 517
        }
502 518
      }
503 519
    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)