Project

General

Profile

« Previous | Next » 

Revision 0e617798

Added by Andreas Kohlbecker over 3 years ago

ref #8850 showing fieldunit annotations in registration page

View differences:

modules/cdm_dataportal/includes/name.inc
694 694
      $render_array['nomenclatural_act']['#weight'] + 10 );
695 695
  }
696 696

  
697
  $render_array['footnotes'] = markup_to_render_array(
698
    theme('cdm_annotation_footnotes', ['footnoteListKey' => RenderHints::getFootnoteListKey() ]),
699
    12
700
  );
701

  
697 702
  // registration date and office
698 703
  $registration_date_insitute_markup = render_registration_date_and_institute($registration_dto);
699 704
  if($registration_date_insitute_markup){
......
702 707
      100);
703 708
  }
704 709

  
710

  
705 711
  return $render_array;
706 712
}
707 713

  
......
864 870
/**
865 871
 * Renders and array of CDM TypeDesignations
866 872
 *
873
 *  - NameTypeDesignation
874
 *  - SpecimenTypeDesignation
875
 *  - TextualTypeDesignation
876
 *
867 877
 * @param object $type_designations an array of cdm TypeDesignation entities
868 878
 *  to render
869 879
 * @param string $enclosing_tag the tag element type to enclose the whole list
......
1084 1094
/**
1085 1095
 * Composes the TypedEntityReference to name type designations passed as associatve array.
1086 1096
 *
1087
 * @param $$type_entity_refs array
1097
 * @param $type_entity_refs array
1088 1098
 *   an associative array of name type type => TypedEntityReference for name type designations as
1089 1099
 *   produced by the eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager
1090 1100
 *
......
1128 1138

  
1129 1139
  $render_array = array();
1130 1140

  
1141
  static $annotations_and_sources_config = [
1142
    'sources_as_content' => TRUE,
1143
    'link_to_name_used_in_source' => FALSE,
1144
    'link_to_reference' => TRUE,
1145
    'add_footnote_keys' => FALSE,
1146
    'bibliography_aware' => FALSE
1147
  ];
1148

  
1131 1149
  $type_designation_list = array();
1132 1150
  uksort($type_entity_refs, "compare_type_designation_status_labels");
1133
  foreach($type_entity_refs as $type_status => $specimen_types){
1134
    foreach($specimen_types as $specimen_type){
1151
  foreach($type_entity_refs as $type_status => $type_designation_entity_refs){
1152
    foreach($type_designation_entity_refs as $type_designation_entity_ref){
1135 1153

  
1136
      $type_designation = cdm_ws_get(CDM_WS_PORTAL_TYPEDESIGNATION, array($specimen_type->uuid));
1154
      $type_designation = cdm_ws_get(CDM_WS_PORTAL_TYPEDESIGNATION, array($type_designation_entity_ref->uuid));
1137 1155
      $type_designation_list[] = $type_designation; // collect for the map
1138 1156

  
1139
      $derivedUnitFacadeInstance = cdm_ws_get(CDM_WS_PORTAL_DERIVEDUNIT_FACADE, $type_designation->typeSpecimen->uuid);
1157
      $derived_unit_facade_dto = cdm_ws_get(CDM_WS_PORTAL_DERIVEDUNIT_FACADE, $type_designation->typeSpecimen->uuid);
1140 1158
      // the media specimen is not contained in the $type_designation returned by CDM_PORTAL_TYPEDESIGNATION, so we need to fetch it separately
1141 1159
      $mediaSpecimen = cdm_ws_get(CDM_WS_PORTAL_OCCURRENCE, array($type_designation->typeSpecimen->uuid, 'mediaSpecimen'));
1142 1160

  
......
1145 1163
      $citation_markup = '';
1146 1164
      $media = '';
1147 1165

  
1166
      // annotations and sources for the $derived_unit_facade_dto
1167
      $annotations_and_sources = handle_annotations_and_sources(
1168
        $derived_unit_facade_dto,
1169
        $annotations_and_sources_config,
1170
        '',
1171
        null
1172
      );
1173
      $source_citations = $annotations_and_sources['source_references'];
1174
      $foot_note_keys = $annotations_and_sources['foot_note_keys'];
1175

  
1148 1176
      // preferredStableUri
1149 1177
      if(isset($type_designation->typeSpecimen->preferredStableUri) && $type_designation->typeSpecimen->preferredStableUri){
1150 1178
        $preferredStableUri = $type_designation->typeSpecimen->preferredStableUri;
......
1162 1190
          );
1163 1191
          $media = compose_cdm_media_gallerie(array(
1164 1192
            'mediaList' => array($mediaSpecimen),
1165
            'galleryName' => CDM_DATAPORTAL_TYPE_SPECIMEN_GALLERY_NAME . '_' . $specimen_type->uuid,
1193
            'galleryName' => CDM_DATAPORTAL_TYPE_SPECIMEN_GALLERY_NAME . '_' . $type_designation_entity_ref->uuid,
1166 1194
            'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
1167 1195
            'cols' => $gallery_settings['cdm_dataportal_media_cols'],
1168 1196
            'captionElements' => $captionElements,
1169 1197
          ));
1170 1198
        }
1171
        // citation and detail
1199
        // citation and detail for the media specimen
1172 1200
        $annotations_and_sources = handle_annotations_and_sources(
1173
            $mediaSpecimen,
1174
            array(
1175
                'sources_as_content' => true,
1176
                'link_to_name_used_in_source' => false,
1177
                'link_to_reference' => true,
1178
                'add_footnote_keys' => false,
1179
                'bibliography_aware' => false),
1180
            '',
1181
            null
1201
          $mediaSpecimen,
1202
          $annotations_and_sources_config,
1203
          '',
1204
          null
1182 1205
        );
1183 1206
        if(is_array( $annotations_and_sources['source_references'])){
1184
          $citation_markup = join(', ', $annotations_and_sources['source_references']);
1207
          $source_citations = array_merge($source_citations, $annotations_and_sources['source_references']);
1208
        }
1209
        if($annotations_and_sources['foot_note_keys']){
1210
          $foot_note_keys .= ', ' . $annotations_and_sources['foot_note_keys'];
1185 1211
        }
1186 1212
      }
1187 1213

  
1188
      $specimen_markup = $derivedUnitFacadeInstance->titleCache;
1189
      if(isset($derivedUnitFacadeInstance->specimenLabel) && $derivedUnitFacadeInstance->specimenLabel){
1190
        $specimen_markup = str_replace($derivedUnitFacadeInstance->specimenLabel, l($derivedUnitFacadeInstance->specimenLabel, path_to_specimen($type_designation->typeSpecimen->uuid)), $specimen_markup);
1214
      $citation_markup = join(', ', $source_citations);
1215

  
1216
      $specimen_markup = $derived_unit_facade_dto->titleCache;
1217
      if(isset($derived_unit_facade_dto->specimenLabel) && $derived_unit_facade_dto->specimenLabel){
1218
        $specimen_markup = str_replace(
1219
          $derived_unit_facade_dto->specimenLabel,
1220
          l($derived_unit_facade_dto->specimenLabel, path_to_specimen($type_designation->typeSpecimen->uuid)), $specimen_markup);
1191 1221
      }
1192 1222

  
1193
      $type_designation_render_array = markup_to_render_array('<div class="specimen_type_designation ' . html_class_attribute_ref($specimen_type)  . '">
1223
      $type_designation_render_array = markup_to_render_array(
1224
        '<div class="type_designation_entity_ref ' . html_class_attribute_ref($type_designation_entity_ref)  . '">
1194 1225
          <span class="type-status">' . ucfirst($type_status) . "</span>: "
1195
        . $specimen_markup
1226
        . $specimen_markup . $foot_note_keys
1196 1227
        . ($citation_markup ? ' '. $citation_markup : '')
1197 1228
        . ($preferredStableUri ? " ". l($preferredStableUri,  $preferredStableUri) : '')
1198 1229
        . $media

Also available in: Unified diff