Revision a9a04561
Added by Andreas Kohlbecker almost 5 years ago
modules/cdm_dataportal/includes/name.inc | ||
---|---|---|
644 | 644 |
drupal_set_message("Unimplemented type: " . $tokens[0], 'error'); |
645 | 645 |
} |
646 | 646 |
} |
647 |
// type designations wich are in this nomenclatural act. |
|
647 | 648 |
if (count($name_type_designation_refs) > 0) { |
648 | 649 |
$render_array['name_type_designations'] = compose_name_type_designations($name_type_designation_refs); |
649 | 650 |
$render_array['name_type_designations']['#prefix'] = '<p class="name_type_designations">'; |
... | ... | |
832 | 833 |
} |
833 | 834 |
|
834 | 835 |
|
836 |
/** |
|
837 |
* Composes the textual representation for the type designation of taxon name identified by the uuid in with a map for the location data. |
|
838 |
|
|
839 |
* @param $taxon_name_uuid |
|
840 |
* @return array |
|
841 |
* A drupal render array wtit the following elements: |
|
842 |
* - 'type_designations' |
|
843 |
* - 'map' |
|
844 |
* |
|
845 |
* @ingroup compose |
|
846 |
*/ |
|
847 |
function compose_type_designations($taxon_name_uuid) |
|
848 |
{ |
|
849 |
$render_array = array(); |
|
850 |
$type_designations = cdm_ws_get(CDM_WS_PORTAL_NAME_TYPEDESIGNATIONS, $taxon_name_uuid); |
|
851 |
if ($type_designations) { |
|
852 |
$render_array['type_designations'] = markup_to_render_array( |
|
853 |
theme('cdm_typedesignations', array('typeDesignations' => $type_designations, 'enclosing_tag' => 'p', 'element_tag' => 'div')) |
|
854 |
); |
|
855 |
|
|
856 |
$render_array['map'] = compose_type_designations_map($type_designations); |
|
857 |
} |
|
858 |
return $render_array; |
|
859 |
} |
|
860 |
|
|
861 |
/** |
|
862 |
* Composes a map with the location points of the passed $type_designations. |
|
863 |
* |
|
864 |
* @param $type_designations |
|
865 |
* |
|
866 |
* @return array |
|
867 |
* A drupal render array or an empty array in case there are no point to show. |
|
868 |
* |
|
869 |
* @ingroup compose |
|
870 |
*/ |
|
871 |
function compose_type_designations_map($type_designations) |
|
872 |
{ |
|
873 |
$points = array(); |
|
874 |
$map_render_array = array(); |
|
875 |
foreach ($type_designations as $td) { |
|
876 |
if ($td->class == "SpecimenTypeDesignation") { |
|
877 |
$derived_unit_facade = cdm_ws_get(CDM_WS_PORTAL_DERIVEDUNIT_FACADE, array($td->typeSpecimen->uuid)); |
|
878 |
if (isset($derived_unit_facade->exactLocation)) { |
|
879 |
$points[] = $derived_unit_facade->exactLocation->latitude . ',' . $derived_unit_facade->exactLocation->longitude; |
|
880 |
} |
|
881 |
} |
|
882 |
} |
|
883 |
|
|
884 |
if (count($points) > 0) { |
|
885 |
// os=1:c/ff0000/10/noLabel&od=1:52.52079,13.57781|-43.46333333333333,172.60355&legend=0 |
|
886 |
$occurrence_query = 'os=1:c/ff0000/10/noLabel&od=1:' . join('|', $points) . '&legend=0'; |
|
887 |
// $occurrence_query = 'os=1:c/ff0000/10/noLabel&od=1:52.52079,13.57781|-43.46333333333333,172.60355&legend=0'; |
|
888 |
$legend_format_query = null; |
|
889 |
$distribution_query = NULL; |
|
890 |
$map_render_array = compose_map('specimens', $occurrence_query, $distribution_query, $legend_format_query, array()); |
|
891 |
} |
|
892 |
return $map_render_array; |
|
893 |
} |
|
894 |
|
|
835 | 895 |
/** |
836 | 896 |
* Composes the TypedEntityReference to name type designations passed as associatve array. |
837 | 897 |
* |
Also available in: Unified diff
ref #8366 refactoring typedesignation and map functions