Project

General

Profile

« Previous | Next » 

Revision f5e7f68e

Added by Andreas Kohlbecker over 5 years ago

ref #7977 display of specimen type designations and stableURIs

View differences:

modules/cdm_dataportal/includes/name.inc
569 569
/**
570 570
 * Composes the TypedEntityReference to name type designations passed as associatve array.
571 571
 *
572
 * @param $name_type_designations array
572
 * @param $$type_entity_refs array
573 573
 *   an associative array of name type type => TypedEntityReference for name type designations as
574 574
 *   produced by the eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager
575 575
 *
......
578 578
function compose_name_type_designations($type_entity_refs){
579 579
  $render_array = array();
580 580
  foreach($type_entity_refs as $type_status => $name_type){
581
    $render_array[] = markup_to_render_array('<div class="name_type_designation ' . html_class_attribute_ref($name_type)  . '"><span class="type_status">'. ucfirst($type_status) . "</span>: " . $name_type->label . '</div>');
581
    $type_designation = cdm_ws_get(CDM_TYPEDESIGNATION, array($name_type->uuid, 'preferredUri'));
582
    if(isset($type_designation->typeSpecimen->preferredStableUri) && $type_designation->typeSpecimen->preferredStableUri){
583
      $preferredStableUri = $type_designation->typeSpecimen->preferredStableUri;
584
    }
585
    $render_array[] = markup_to_render_array('<div class="name_type_designation ' . html_class_attribute_ref($name_type)  . '"><span class="type_status">'. ucfirst($type_status) . "</span>: "
586
      . $name_type->label
587
      . ($preferredStableUri ? " ". l($preferredStableUri,  $preferredStableUri) : '')
588
      . '</div>');
589
  }
590
  return $render_array;
591
}
592

  
593
/**
594
 * Composes the TypedEntityReference to specimen type designations passed as associatve array.
595
 *
596
 * @param $type_entity_refs array
597
 *   an associative array of specimen type type => TypedEntityReference for specimen type designations as
598
 *   produced by the eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager
599
 *
600
 * @ingroup compose
601
 */
602
function compose_specimen_type_designations($type_entity_refs){
603
  $render_array = array();
604
  foreach($type_entity_refs as $type_status => $specimen_type){
605
    $type_designation = cdm_ws_get(CDM_TYPEDESIGNATION, array($specimen_type->uuid));
606
    $preferredStableUri = '';
607
    if(isset($type_designation->typeSpecimen->preferredStableUri) && $type_designation->typeSpecimen->preferredStableUri){
608
      $preferredStableUri = $type_designation->typeSpecimen->preferredStableUri;
609
    }
610
    $render_array[] = markup_to_render_array('<div class="specimen_type_designation ' . html_class_attribute_ref($specimen_type)  . '"><span class="type_status">'
611
      . ucfirst($type_status)
612
      . "</span>: "
613
      . $specimen_type->label
614
      . ($preferredStableUri ? " ". l($preferredStableUri,  $preferredStableUri) : '')
615
      . '</div>');
582 616
  }
583 617
  return $render_array;
584 618
}

Also available in: Unified diff