Revision f6ff2764
Added by Andreas Kohlbecker about 3 years ago
modules/cdm_dataportal/includes/occurrences_new.inc | ||
---|---|---|
435 | 435 |
cdm_occurrence_field_name_label('preservationMethod'), |
436 | 436 |
$du_dto->preservationMethod); |
437 | 437 |
} |
438 |
|
|
439 |
/* TODO |
|
440 |
|
|
441 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('medium'), $value->medium, NULL, 1); |
|
442 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('temperature'), $value->temperature, NULL, 2); |
|
443 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('definedMaterialOrMethod'), $value->definedMaterialOrMethod, NULL, 3); |
|
444 |
|
|
445 |
*/ |
|
438 | 446 |
if (isset_not_empty($du_dto->characterData)) { |
439 | 447 |
$table_row_data[] = cdm_sob_dto_table_row( |
440 | 448 |
cdm_occurrence_field_name_label('characterData'), |
... | ... | |
646 | 654 |
} |
647 | 655 |
} |
648 | 656 |
|
657 |
/* TODO |
|
658 |
case 'dnaQuality': |
|
659 |
$sub_dl_groups = array(); |
|
660 |
|
|
661 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('purificationMethod'), $value->purificationMethod, NULL, 1); |
|
662 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('ratioOfAbsorbance260_230'), $value->ratioOfAbsorbance260_230, NULL, 2); |
|
663 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('ratioOfAbsorbance260_280'), $value->ratioOfAbsorbance260_280, NULL, 3); |
|
664 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('concentration'), $value->concentration, NULL, 4); |
|
665 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('concentrationUnit'), $value->concentrationUnit, NULL, 4); |
|
666 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('qualityTerm'), $value->qualityTerm, NULL, 4); |
|
667 |
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('qualityCheckDate'), $value->qualityCheckDate, NULL, 4); |
|
668 |
|
|
669 |
if (is_array($sub_dl_groups) && sizeof($sub_dl_groups)>0) { |
|
670 |
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), |
|
671 |
array( |
|
672 |
array('#markup' => $value->titleCache), |
|
673 |
array('#theme' => 'description_list', '#groups' => $sub_dl_groups) |
|
674 |
) |
|
675 |
); |
|
676 |
} |
|
677 |
break; |
|
678 |
*/ |
|
679 |
|
|
649 | 680 |
return cdm_sob_dto_table(t('Storage'), $table_row_data, $unit_dto, 1); |
650 | 681 |
} |
651 | 682 |
|
... | ... | |
727 | 758 |
} |
728 | 759 |
return NULL; |
729 | 760 |
} |
761 |
|
|
762 |
|
|
763 |
|
|
764 |
/** |
|
765 |
* Compose an render array from a CDD SpecimenOrObservation entity. |
|
766 |
* |
|
767 |
* compose_hook() implementation |
|
768 |
* |
|
769 |
* @param object $sob_dto |
|
770 |
* the CDM FieldUnit or DerivedUnit to compose |
|
771 |
* the render array for. |
|
772 |
* @param bool $isSpecimen_page |
|
773 |
* @param array $derivatives |
|
774 |
* the render array which contains the compositions of the derivatives |
|
775 |
* of the supplied $specimenOrObservation |
|
776 |
* |
|
777 |
* @return array |
|
778 |
* the supplied render array $derivatives to which the composition of the supplied |
|
779 |
* $specimenOrObservation has been added to |
|
780 |
* |
|
781 |
* @throws \Exception |
|
782 |
* @ingroup compose |
|
783 |
*/ |
|
784 |
|
|
785 |
function compose_cdm_specimen_or_observation_new($sob_dto) |
|
786 |
{ |
|
787 |
|
|
788 |
$render_array = []; |
|
789 |
if (is_object($sob_dto)) { |
|
790 |
|
|
791 |
/*** 95% no longer needed |
|
792 |
if ($sob_dto->class == 'FieldUnit'){ |
|
793 |
// WARNING: adding a List<MediaDTO> as $specimen_or_observation->_derivedUnitMedia |
|
794 |
$sob_dto->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
795 |
$sob_dto->uuid, |
|
796 |
'fieldObjectMediaDTO', |
|
797 |
)); |
|
798 |
}else{ |
|
799 |
// WARNING: adding a List<Media> as $specimen_or_observation->_derivedUnitMedia |
|
800 |
$sob_dto->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
801 |
$sob_dto->uuid, |
|
802 |
'derivedUnitMedia', |
|
803 |
)); |
|
804 |
} |
|
805 |
******/ |
|
806 |
|
|
807 |
RenderHints::setFootnoteListKey($sob_dto->type . '-' . $sob_dto->uuid); |
|
808 |
|
|
809 |
$render_array['sob_details_grid'] = compose_cdm_specimen_or_observation_dto_details_grid($sob_dto); |
|
810 |
|
|
811 |
/* TODO |
|
812 |
case 'definition': |
|
813 |
|
|
814 |
case 'annotations': |
|
815 |
$dd_elements = array(); |
|
816 |
foreach ($value as $annotation) { |
|
817 |
// TODO respect annotation type filter settings |
|
818 |
$dd_elements[] = $annotation->text; |
|
819 |
} |
|
820 |
break; |
|
821 |
|
|
822 |
case 'markers': |
|
823 |
$dd_elements = array(); |
|
824 |
foreach ($value as $marker) { |
|
825 |
$dd_elements[] = compose_cdm_marker($marker); |
|
826 |
} |
|
827 |
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements); |
|
828 |
break; |
|
829 |
|
|
830 |
@_description_list_group_add($groups, t('Notes:'), $dd_elements); |
|
831 |
* |
|
832 |
*/ |
|
833 |
|
|
834 |
|
|
835 |
|
|
836 |
/** TODO |
|
837 |
|
|
838 |
|
|
839 |
case 'determinations': |
|
840 |
$dd_elements = array(); |
|
841 |
$glue = ', '; |
|
842 |
|
|
843 |
foreach ($value as $determinationEvent) { |
|
844 |
$timeperiod_string = NULL; |
|
845 |
if (isset($determinationEvent->timeperiod)) { |
|
846 |
$timeperiod_string = timePeriodToString($determinationEvent->timeperiod); |
|
847 |
} |
|
848 |
$weight = isset($determinationEvent->preferred) && $determinationEvent->preferred == 1 ? '0' : ($timeperiod_string ? $timeperiod_string : '1'); |
|
849 |
// check key exists |
|
850 |
while (array_key_exists($weight, $dd_elements)) { |
|
851 |
$weight .= '0'; |
|
852 |
} |
|
853 |
|
|
854 |
$taxon_name = ''; |
|
855 |
$name_link = ''; |
|
856 |
if ($determinationEvent->taxonName) { |
|
857 |
$taxon_name = cdm_ws_get(CDM_WS_NAME, $determinationEvent->taxonName->uuid); |
|
858 |
$taxon_name->taggedName = cdm_ws_get(CDM_WS_NAME, array($determinationEvent->taxonName->uuid, "taggedName")); |
|
859 |
$name_link = path_to_name($determinationEvent->taxonName->uuid); |
|
860 |
} else if ($determinationEvent->taxon) { |
|
861 |
$taxon_name = cdm_ws_get(CDM_WS_TAXON . '/$0/name', $determinationEvent->taxon->uuid); |
|
862 |
$name_link = path_to_taxon($determinationEvent->taxon->uuid); |
|
863 |
} |
|
864 |
if ($taxon_name) { |
|
865 |
//$taxon_html = render_taxon_or_name($taxon_name, $name_link); |
|
866 |
|
|
867 |
$taxon_html = l($taxon_name->titleCache, $name_link); |
|
868 |
$dd_elements[$weight] = $taxon_html; |
|
869 |
} |
|
870 |
if (isset($determinationEvent->modifier)) { |
|
871 |
$dd_elements[$weight] .= cdm_term_representation($determinationEvent->modifier); |
|
872 |
} |
|
873 |
if ($timeperiod_string) { |
|
874 |
$dd_elements[$weight] .= $glue . $timeperiod_string; |
|
875 |
} |
|
876 |
if (isset($determinationEvent->actor->titleCache)) { |
|
877 |
$dd_elements[$weight] .= $glue . $determinationEvent->actor->titleCache; |
|
878 |
} |
|
879 |
if (isset($determinationEvent->description)) { |
|
880 |
$dd_elements[$weight] .= $glue . $determinationEvent->description; |
|
881 |
} |
|
882 |
} |
|
883 |
ksort($dd_elements); |
|
884 |
@_description_list_group_add($groups, cdm_occurrence_field_name_label('determinations'), $dd_elements); |
|
885 |
break; |
|
886 |
*/ |
|
887 |
|
|
888 |
/* TODO |
|
889 |
|
|
890 |
case 'sources': |
|
891 |
RenderHints::setAnnotationsAndSourceConfig([ |
|
892 |
'sources_as_content' => TRUE, |
|
893 |
'link_to_name_used_in_source' => TRUE, |
|
894 |
'link_to_reference' => FALSE, |
|
895 |
'add_footnote_keys' => FALSE, |
|
896 |
'bibliography_aware' => FALSE |
|
897 |
]); |
|
898 |
$annotations_and_sources = handle_annotations_and_sources($sob_dto); |
|
899 |
if ($annotations_and_sources->hasSourceReferences()) { |
|
900 |
@_description_list_group_add($groups, t('Sources') . ':', join(', ', $annotations_and_sources->getSourceReferences()), '', 12); |
|
901 |
} |
|
902 |
break; |
|
903 |
*/ |
|
904 |
|
|
905 |
|
|
906 |
|
|
907 |
/* TODO Extensions |
|
908 |
// TODO: filter by using visible_extensions_sorted() |
|
909 |
// TODO: treat as top level element, see https://dev.e-taxonomy.eu/redmine/issues/2985#note-23 |
|
910 |
$extensions = cdm_ws_fetch_all(CDM_WS_PORTAL_OCCURRENCE . '/' . $sob_dto->uuid . '/extensions', array($sob_dto->uuid)); |
|
911 |
if ($extensions && count($extensions)) { |
|
912 |
|
|
913 |
$extensions_render_array = compose_extensions($extensions); |
|
914 |
@_description_list_group_add($groups, t('Extensions') . ':', |
|
915 |
$extensions_render_array, |
|
916 |
'', 100); |
|
917 |
} |
|
918 |
*/ |
|
919 |
|
|
920 |
|
|
921 |
|
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
} // END of $specimenOrObservation exists |
|
926 |
|
|
927 |
return $render_array; |
|
928 |
} |
|
929 |
|
Also available in: Unified diff
ref #6866 using details grid for specimen page