Project

General

Profile

« Previous | Next » 

Revision 6421984d

Added by Andreas Kohlbecker about 8 years ago

#5697 display of taxonRelationShipTypes configurable

View differences:

modules/cdm_dataportal/includes/name.inc
550 550
 */
551 551
function cdm_name_relationships_of($taxon) {
552 552

  
553
  static $inverse_name_rels_uuids = array(UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR);
554

  
553 555
  // =========== START OF HOMONYMS ========== //
554 556
  RenderHints::pushToRenderStack('homonym');
555 557
  // the render stack element homonyms is being used in the default render templates !!!, see CDM_NAME_RENDER_TEMPLATES_DEFAULT
556 558

  
557
  // Later homonym or treated as later homonym AND blocking names.
558
  // TODO apply filter ? $name_rels_to_show = variable_get('name_relationships_to_show', NULL);
559
  $selected_name_rel_uuids = variable_get(CDM_NAME_RELATIONSHIP_TYPES, unserialize(CDM_NAME_RELATIONSHIP_TYPES_DEFAULT));
560

  
559 561
  $from_name_relations = cdm_ws_get(CDM_WS_PORTAL_TAXON_FROM_NAMERELATIONS,
560 562
    $taxon->uuid);
561 563
  $to_name_relations = cdm_ws_get(CDM_WS_PORTAL_TAXON_TO_NAMERELATIONS,
......
566 568

  
567 569
  if ($name_relations) {
568 570
    foreach ($name_relations as $element) {
569
      $taxon_html = NULL;
570
      switch ($element->type->uuid) {
571
        case UUID_LATER_HOMONYM :
572
          $elementTaxonBasesUuid = isset ($element->toName->taxonBases [0]->uuid) ? $element->toName->taxonBases [0]->uuid : '';
573

  
574
          //from relation ships -> only shown at fromName-synonym
575
          if ($taxon->name->uuid == $element->fromName->uuid) {
576
            $taxon_html =render_taxon_or_name($element->toName,
577
              url(path_to_name($element->toName->uuid, $taxon->uuid, $elementTaxonBasesUuid))
578
            );
579
          }
580
          break;
581
        case UUID_TREATED_AS_LATER_HOMONYM :
582
          $elementTaxonBasesUuid = isset ($element->toName->taxonBases [0]->uuid) ? $element->toName->taxonBases [0]->uuid : '';
583

  
584
          //from relation ships -> only shown at fromName-synonym
585
          if ($taxon->name->uuid == $element->fromName->uuid) {
586
            $taxon_html = render_taxon_or_name($element->toName,
587
              url(path_to_name($element->toName->uuid)));  // FIXME highlite in synonymy as in the other cases
588
          }
589
          break;
590
        case UUID_BLOCKING_NAME_FOR :
591
          $elementTaxonBasesUuid = isset ($element->fromName->taxonBases [0]->uuid) ? $element->fromName->taxonBases [0]->uuid : '';
592

  
593
          //to relation ships -> only shown at toName-synonym
594
          if ($taxon->name->uuid == $element->toName->uuid) {
595
            $taxon_html = render_taxon_or_name($element->fromName,
596
              url(path_to_name($element->fromName->uuid, $taxon->uuid, $elementTaxonBasesUuid))
597
            );
598
          }
599
          break;
600
        default:
601
          $taxon_html = NULL;
571
      if(!isset($selected_name_rel_uuids[$element->type->uuid])){
572
        // skip if not selected in the settings
573
        continue;
602 574
      }
603
      if (isset($taxon_html) && $taxon_html) {
604
        if (count($homonyms_array)) {
605
          // lat: "non nec" == german: "weder noch"
606
          $homonyms_array [] = 'nec ' . $taxon_html;
607
        } else {
608
          $homonyms_array [] = 'non ' . $taxon_html;
575

  
576
      if(isset($inverse_name_rels_uuids[$element->type->uuid])) {
577
        // case of UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR
578
        //to relation ships -> only shown at toName-synonym
579
        $elementTaxonBasesUuid = isset ($element->fromName->taxonBases [0]->uuid) ? $element->fromName->taxonBases [0]->uuid : '';
580
        if ($taxon->name->uuid == $element->toName->uuid) {
581
          $taxon_html = render_taxon_or_name($element->fromName,
582
            url(path_to_name($element->fromName->uuid, $taxon->uuid, $elementTaxonBasesUuid))
583
          );
584
        }
585
      } else {
586
        $elementTaxonBasesUuid = isset ($element->toName->taxonBases [0]->uuid) ? $element->toName->taxonBases [0]->uuid : '';
587
        //from relation ships -> only shown at fromName-synonym
588
        if ($taxon->name->uuid == $element->fromName->uuid) {
589
          $taxon_html =render_taxon_or_name($element->toName,
590
            url(path_to_name($element->toName->uuid, $taxon->uuid, $elementTaxonBasesUuid))
591
          );
609 592
        }
610 593
      }
594

  
595
      if (count($homonyms_array)) {
596
        // lat: "non nec" == german: "weder noch"
597
        $homonyms_array [] = 'nec ' . $taxon_html;
598
      } else {
599
        $homonyms_array [] = 'non ' . $taxon_html;
600
      }
601

  
611 602
    }
612 603
  }
613 604

  

Also available in: Unified diff