Revision 67f5eac2
Added by Andreas Kohlbecker about 5 years ago
modules/cdm_dataportal/includes/name.inc | ||
---|---|---|
592 | 592 |
$field_unit_uuids = array(); |
593 | 593 |
$specimen_type_designation_refs = array(); |
594 | 594 |
$name_type_designation_refs = array(); |
595 |
foreach ((array)$registration_dto->orderdTypeDesignationWorkingSets as $field_unit_ref => $obj) { |
|
596 |
$tokens = explode("#", $field_unit_ref); |
|
597 |
foreach ($obj as $type_status => $entity_reference_list) { |
|
598 |
// NOTE: there is always only one element, since we use the foreach to extract the objects field name and value |
|
599 |
$entity_reference = $entity_reference_list[0]; |
|
600 |
} |
|
595 |
foreach ((array)$registration_dto->orderdTypeDesignationWorkingSets as $workingset_ref => $obj) { |
|
596 |
$tokens = explode("#", $workingset_ref); |
|
597 |
$types_in_fieldunit = get_object_vars($obj); // convert into associative array |
|
598 |
|
|
601 | 599 |
if ($tokens[0] == 'NameTypeDesignation') { |
602 |
foreach ($obj as $type_status => $entity_reference_list) { |
|
603 |
$name_type_designation_refs[$type_status] = $entity_reference; |
|
600 |
foreach ($types_in_fieldunit as $type_status => $entity_reference_list) { |
|
601 |
if(!isset($name_type_designation_refs[$type_status])){ |
|
602 |
$name_type_designation_refs[$type_status] = $entity_reference_list; |
|
603 |
} else { |
|
604 |
array_push($name_type_designation_refs[$type_status] ,$entity_reference_list); |
|
605 |
} |
|
604 | 606 |
} |
605 | 607 |
} else if ($tokens[0] == 'FieldUnit'){ |
606 | 608 |
$field_unit_uuids[] = $tokens[1]; |
607 |
$specimen_type_designation_refs[$type_status] = $entity_reference; |
|
609 |
foreach ($types_in_fieldunit as $type_status => $entity_reference_list) { |
|
610 |
if(!isset($specimen_type_designation_refs[$type_status])){ |
|
611 |
$specimen_type_designation_refs[$type_status] = $entity_reference_list; |
|
612 |
} else { |
|
613 |
array_push($specimen_type_designation_refs[$type_status], $entity_reference_list); |
|
614 |
} |
|
615 |
} |
|
608 | 616 |
} else { |
609 | 617 |
drupal_set_message("Unimplemented type: " . $tokens[0], 'error'); |
610 | 618 |
} |
... | ... | |
834 | 842 |
|
835 | 843 |
$render_array = array(); |
836 | 844 |
|
837 |
foreach($type_entity_refs as $type_status => $specimen_type){ |
|
838 |
$type_designation = cdm_ws_get(CDM_TYPEDESIGNATION, array($specimen_type->uuid));
|
|
845 |
foreach($type_entity_refs as $type_status => $specimen_types){
|
|
846 |
foreach($specimen_types as $specimen_type){
|
|
839 | 847 |
|
840 |
$preferredStableUri = ''; |
|
841 |
$citation_markup = ''; |
|
842 |
$media = ''; |
|
848 |
$type_designation = cdm_ws_get(CDM_TYPEDESIGNATION, array($specimen_type->uuid)); |
|
843 | 849 |
|
844 |
// preferredStableUri |
|
845 |
if(isset($type_designation->typeSpecimen->preferredStableUri) && $type_designation->typeSpecimen->preferredStableUri){ |
|
846 |
$preferredStableUri = $type_designation->typeSpecimen->preferredStableUri; |
|
847 |
} |
|
850 |
$preferredStableUri = ''; |
|
851 |
$citation_markup = ''; |
|
852 |
$media = ''; |
|
848 | 853 |
|
849 |
$mediaSpecimen = cdm_ws_get(CDM_WS_PORTAL_OCCURRENCE, array($type_designation->typeSpecimen->uuid, 'mediaSpecimen')); |
|
850 |
if($mediaSpecimen){ |
|
851 |
// compose output |
|
852 |
// mediaURI |
|
853 |
if(isset($mediaSpecimen->representations[0])) { |
|
854 |
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME); |
|
855 |
$captionElements = array( |
|
856 |
'#uri' => t('open media'), |
|
857 |
'elements' => array('-none-'), |
|
858 |
'sources_as_content' => true |
|
859 |
); |
|
860 |
$media = compose_cdm_media_gallerie(array( |
|
861 |
'mediaList' => array($mediaSpecimen), |
|
862 |
'galleryName' => CDM_DATAPORTAL_TYPE_SPECIMEN_GALLERY_NAME . '_' . $specimen_type->uuid, |
|
863 |
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'], |
|
864 |
'cols' => $gallery_settings['cdm_dataportal_media_cols'], |
|
865 |
'captionElements' => $captionElements, |
|
866 |
)); |
|
854 |
// preferredStableUri |
|
855 |
if(isset($type_designation->typeSpecimen->preferredStableUri) && $type_designation->typeSpecimen->preferredStableUri){ |
|
856 |
$preferredStableUri = $type_designation->typeSpecimen->preferredStableUri; |
|
867 | 857 |
} |
868 |
// citation and detail |
|
869 |
$annotations_and_sources = handle_annotations_and_sources( |
|
870 |
$mediaSpecimen, |
|
871 |
array( |
|
872 |
'sources_as_content' => true, |
|
873 |
'link_to_name_used_in_source' => false, |
|
874 |
'link_to_reference' => true, |
|
875 |
'add_footnote_keys' => false, |
|
876 |
'bibliography_aware' => false), |
|
877 |
'', |
|
878 |
null |
|
879 |
); |
|
880 |
if(is_array( $annotations_and_sources['source_references'])){ |
|
881 |
$citation_markup = join(', ', $annotations_and_sources['source_references']); |
|
858 |
|
|
859 |
$mediaSpecimen = cdm_ws_get(CDM_WS_PORTAL_OCCURRENCE, array($type_designation->typeSpecimen->uuid, 'mediaSpecimen')); |
|
860 |
if($mediaSpecimen){ |
|
861 |
// compose output |
|
862 |
// mediaURI |
|
863 |
if(isset($mediaSpecimen->representations[0])) { |
|
864 |
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME); |
|
865 |
$captionElements = array( |
|
866 |
'#uri' => t('open media'), |
|
867 |
'elements' => array('-none-'), |
|
868 |
'sources_as_content' => true |
|
869 |
); |
|
870 |
$media = compose_cdm_media_gallerie(array( |
|
871 |
'mediaList' => array($mediaSpecimen), |
|
872 |
'galleryName' => CDM_DATAPORTAL_TYPE_SPECIMEN_GALLERY_NAME . '_' . $specimen_type->uuid, |
|
873 |
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'], |
|
874 |
'cols' => $gallery_settings['cdm_dataportal_media_cols'], |
|
875 |
'captionElements' => $captionElements, |
|
876 |
)); |
|
877 |
} |
|
878 |
// citation and detail |
|
879 |
$annotations_and_sources = handle_annotations_and_sources( |
|
880 |
$mediaSpecimen, |
|
881 |
array( |
|
882 |
'sources_as_content' => true, |
|
883 |
'link_to_name_used_in_source' => false, |
|
884 |
'link_to_reference' => true, |
|
885 |
'add_footnote_keys' => false, |
|
886 |
'bibliography_aware' => false), |
|
887 |
'', |
|
888 |
null |
|
889 |
); |
|
890 |
if(is_array( $annotations_and_sources['source_references'])){ |
|
891 |
$citation_markup = join(', ', $annotations_and_sources['source_references']); |
|
892 |
} |
|
882 | 893 |
} |
883 |
} |
|
884 | 894 |
|
885 |
$render_array[] = markup_to_render_array('<div class="specimen_type_designation ' . html_class_attribute_ref($specimen_type) . '"> |
|
886 |
<span class="type_status">' . ucfirst($type_status) . "</span>: " |
|
887 |
. $specimen_type->label |
|
888 |
. ($citation_markup ? ' '. $citation_markup : '') |
|
889 |
. ($preferredStableUri ? " ". l($preferredStableUri, $preferredStableUri) : '') |
|
890 |
. $media |
|
891 |
. '</div>'); |
|
895 |
$render_array[] = markup_to_render_array('<div class="specimen_type_designation ' . html_class_attribute_ref($specimen_type) . '"> |
|
896 |
<span class="type_status">' . ucfirst($type_status) . "</span>: " |
|
897 |
. $specimen_type->label |
|
898 |
. ($citation_markup ? ' '. $citation_markup : '') |
|
899 |
. ($preferredStableUri ? " ". l($preferredStableUri, $preferredStableUri) : '') |
|
900 |
. $media |
|
901 |
. '</div>'); |
|
902 |
} |
|
892 | 903 |
} |
893 | 904 |
return $render_array; |
894 | 905 |
} |
Also available in: Unified diff
ref #8051 solving bug related to missing specimen type designations