989 |
989 |
function compose_description_element_taxon_interaction($element, $feature_block_settings) {
|
990 |
990 |
|
991 |
991 |
$out = '';
|
992 |
|
$enclosing_tag = cdm_feature_block_element_tag_name($feature_block_settings);
|
|
992 |
|
993 |
993 |
|
994 |
994 |
if (isset($element->description_L10n)) {
|
995 |
995 |
$out .= ' ' . $element->description_L10n;
|
... | ... | |
1020 |
1020 |
function compose_description_element_individuals_association($element, $feature_block_settings) {
|
1021 |
1021 |
|
1022 |
1022 |
$out = '';
|
1023 |
|
$enclosing_tag = cdm_feature_block_element_tag_name($feature_block_settings);
|
1024 |
1023 |
|
1025 |
1024 |
$render_array = compose_cdm_specimenOrObservation($element->associatedSpecimenOrObservation);
|
1026 |
1025 |
|
... | ... | |
1383 |
1382 |
case 'TaxonInteraction':
|
1384 |
1383 |
$elements_out_array[] = compose_description_element_taxon_interaction($description_element, $feature_block_settings);
|
1385 |
1384 |
break;
|
|
1385 |
case 'CommonTaxonName':
|
|
1386 |
$elements_out_array[] = compose_description_element_common_taxon_name($description_element, $feature_block_settings);
|
|
1387 |
break;
|
1386 |
1388 |
case 'Uses':
|
1387 |
1389 |
/* IGNORE Uses classes, these are handled completely in theme_cdm_UseDescription */
|
1388 |
1390 |
break;
|
... | ... | |
1428 |
1430 |
|
1429 |
1431 |
$feature_block_settings = get_feature_block_settings(UUID_COMMON_NAME);
|
1430 |
1432 |
|
1431 |
|
$element_tag_name = cdm_feature_block_element_tag_name($feature_block_settings);
|
1432 |
|
|
1433 |
1433 |
if (is_array($elements)) {
|
1434 |
1434 |
foreach ($elements as $element) {
|
1435 |
1435 |
|
... | ... | |
1438 |
1438 |
// common name without a language or area, should not happen but is possible
|
1439 |
1439 |
$language_area_key = '';
|
1440 |
1440 |
if (isset($element->language->representation_L10n)) {
|
1441 |
|
$language_area_key .= '<b>' . $element->language->representation_L10n . '</b>';
|
|
1441 |
$language_area_key .= '<span class="language-label">' . $element->language->representation_L10n . '</span>';
|
1442 |
1442 |
}
|
1443 |
1443 |
if(isset($element->area->titleCache) && strlen($element->area->titleCache) > 0){
|
1444 |
1444 |
$language_area_key .= ($language_area_key ? ' ' : '') . '(' . $element->area->titleCache . ')';
|
... | ... | |
1469 |
1469 |
foreach ($common_names as $language_area_key => $elements) {
|
1470 |
1470 |
ksort($elements); // sort names alphabetically
|
1471 |
1471 |
$per_language_area_out = array();
|
1472 |
|
// loop over set of individual elements
|
|
1472 |
|
1473 |
1473 |
foreach ($elements as $element) {
|
1474 |
|
if ($element->name) {
|
1475 |
|
$annotations_and_sources = handle_annotations_and_sources($element, $feature_block_settings, $element->name, $footnote_key_suggestion);
|
1476 |
|
$source_references_markup = '';
|
1477 |
|
if(!empty($annotations_and_sources['source_references'])){
|
1478 |
|
$source_references_markup = ' ' . join(', ', $annotations_and_sources['source_references']);
|
1479 |
|
}
|
1480 |
|
$per_language_area_out[] = '<' . $element_tag_name. ' class="' . html_class_attribute_ref($element) . '">'
|
1481 |
|
. $element->name . $source_references_markup . $annotations_and_sources['foot_note_keys'] . '</' . $element_tag_name. '>';
|
|
1474 |
$common_name_render_array = compose_description_element_common_taxon_name($element, $feature_block_settings, $footnote_key_suggestion);
|
|
1475 |
$common_name_markup = drupal_render($common_name_render_array);
|
|
1476 |
// IMPORTANT!
|
|
1477 |
// during the above drupal_render the theme_html_tag function is executed, which adds a "\n" character to the end of the markup
|
|
1478 |
// this is an error and the trailing whitespace needs to be removed
|
|
1479 |
if(str_endsWith($common_name_markup, "\n")){
|
|
1480 |
$common_name_markup = substr($common_name_markup, 0, strlen($common_name_markup) - 1);
|
1482 |
1481 |
}
|
1483 |
|
} // End of loop over set of individual elements
|
|
1482 |
$per_language_area_out[] = $common_name_markup;
|
|
1483 |
}
|
|
1484 |
|
1484 |
1485 |
$common_name_feature_elements[] = ($language_area_key ? $language_area_key . ': ' : '' ) . join(', ', $per_language_area_out);
|
1485 |
1486 |
} // End of loop over set of elements per language area
|
1486 |
1487 |
|
... | ... | |
1512 |
1513 |
$footnotes .= theme('cdm_annotation_footnotes', array('footnoteListKey' => $footnote_key_suggestion));
|
1513 |
1514 |
|
1514 |
1515 |
return markup_to_render_array( // FIXME markup_to_render_array should no longer be needed
|
1515 |
|
'<div class="common_names_as_common_names">' . $common_name_out . '</div>'
|
1516 |
|
.'<div class="common_names_as_text_data">' . drupal_render($common_name_out_text_data) . '</div>'
|
|
1516 |
'<div class="common-taxon-name">' . $common_name_out . '</div>'
|
|
1517 |
.'<div class="text-data">' . drupal_render($common_name_out_text_data) . '</div>'
|
1517 |
1518 |
.$footnotes,
|
1518 |
1519 |
$weight
|
1519 |
1520 |
);
|
1520 |
1521 |
}
|
1521 |
1522 |
|
1522 |
|
/**
|
1523 |
|
* Composes the render array for a CDM Distribution description element
|
1524 |
|
*
|
1525 |
|
* @param array $description_elements
|
1526 |
|
* Array of CDM Distribution instances
|
1527 |
|
* @param $enclosingTag
|
1528 |
|
* The html tag to be use for the enclosing element
|
1529 |
|
*
|
1530 |
|
* @return array
|
1531 |
|
* A Drupal render array
|
1532 |
|
*
|
1533 |
|
* @ingroup compose
|
1534 |
|
*/
|
1535 |
|
function compose_description_elements_distribution($description_elements){
|
|
1523 |
/**
|
|
1524 |
* Renders a single instance of the type CommonTaxonName.
|
|
1525 |
*
|
|
1526 |
* @param $element
|
|
1527 |
* The CDM CommonTaxonName entity.
|
|
1528 |
* @param $feature_block_settings
|
|
1529 |
*
|
|
1530 |
* @param $footnote_key_suggestion
|
|
1531 |
*
|
|
1532 |
* @param $element_tag_name
|
|
1533 |
*
|
|
1534 |
* @return array
|
|
1535 |
* Drupal render array
|
|
1536 |
*
|
|
1537 |
* @ingroup compose
|
|
1538 |
*/
|
|
1539 |
function compose_description_element_common_taxon_name($element, $feature_block_settings, $footnote_key_suggestion = NULL)
|
|
1540 |
{
|
1536 |
1541 |
|
1537 |
|
$out = '';
|
1538 |
|
RenderHints::pushToRenderStack('descriptionElementDistribution');
|
1539 |
|
RenderHints::setFootnoteListKey(UUID_DISTRIBUTION);
|
|
1542 |
if(!$footnote_key_suggestion) {
|
|
1543 |
$footnote_key_suggestion = $element->feature->uuid;
|
|
1544 |
}
|
1540 |
1545 |
|
1541 |
|
$feature_block_settings = get_feature_block_settings(UUID_DISTRIBUTION);
|
1542 |
|
$enclosingTag = cdm_feature_block_element_tag_name($feature_block_settings);
|
1543 |
|
|
1544 |
|
foreach ($description_elements as $description_element) {
|
1545 |
|
$annotations_and_sources = handle_annotations_and_sources(
|
1546 |
|
$description_element,
|
1547 |
|
$feature_block_settings,
|
1548 |
|
$description_element->area->representation_L10n,
|
1549 |
|
UUID_DISTRIBUTION
|
1550 |
|
);
|
|
1546 |
$name = '';
|
|
1547 |
if(isset($element->name)){
|
|
1548 |
$name = $element->name;
|
|
1549 |
}
|
1551 |
1550 |
|
1552 |
1551 |
|
1553 |
|
list($status_label, $status_markup) = distribution_status_label_and_markup($description_element);
|
|
1552 |
return compose_description_element($element, $feature_block_settings, $name, $footnote_key_suggestion);
|
|
1553 |
}
|
1554 |
1554 |
|
1555 |
|
$out .= '<' . $enclosingTag . ' class="descriptionElement descriptionElement-' . $description_element->uuid
|
1556 |
|
. ' " title="' . $status_label. '">'
|
1557 |
|
. $description_element->area->representation_L10n
|
1558 |
|
. $status_markup;
|
1559 |
|
if(!empty($annotations_and_sources['source_references'])){
|
1560 |
|
$out .= ' ' . join(' ', $annotations_and_sources['source_references'] );
|
1561 |
|
}
|
1562 |
|
$out .= $annotations_and_sources['foot_note_keys'] . ' </' . $enclosingTag . '>';
|
1563 |
|
}
|
|
1555 |
/**
|
|
1556 |
* Composes the render array for a CDM Distribution description element
|
|
1557 |
*
|
|
1558 |
* @param array $description_elements
|
|
1559 |
* Array of CDM Distribution instances
|
|
1560 |
* @param $enclosingTag
|
|
1561 |
* The html tag to be use for the enclosing element
|
|
1562 |
*
|
|
1563 |
* @return array
|
|
1564 |
* A Drupal render array
|
|
1565 |
*
|
|
1566 |
* @ingroup compose
|
|
1567 |
*/
|
|
1568 |
function compose_description_elements_distribution($description_elements){
|
1564 |
1569 |
|
1565 |
|
RenderHints::popFromRenderStack();
|
1566 |
|
return markup_to_render_array($out);
|
|
1570 |
$out = '';
|
|
1571 |
RenderHints::pushToRenderStack('descriptionElementDistribution');
|
|
1572 |
RenderHints::setFootnoteListKey(UUID_DISTRIBUTION);
|
|
1573 |
|
|
1574 |
$feature_block_settings = get_feature_block_settings(UUID_DISTRIBUTION);
|
|
1575 |
$enclosingTag = cdm_feature_block_element_tag_name($feature_block_settings);
|
|
1576 |
|
|
1577 |
foreach ($description_elements as $description_element) {
|
|
1578 |
$annotations_and_sources = handle_annotations_and_sources(
|
|
1579 |
$description_element,
|
|
1580 |
$feature_block_settings,
|
|
1581 |
$description_element->area->representation_L10n,
|
|
1582 |
UUID_DISTRIBUTION
|
|
1583 |
);
|
|
1584 |
|
|
1585 |
|
|
1586 |
list($status_label, $status_markup) = distribution_status_label_and_markup($description_element);
|
|
1587 |
|
|
1588 |
$out .= '<' . $enclosingTag . ' class="descriptionElement descriptionElement-' . $description_element->uuid
|
|
1589 |
. ' " title="' . $status_label. '">'
|
|
1590 |
. $description_element->area->representation_L10n
|
|
1591 |
. $status_markup;
|
|
1592 |
if(!empty($annotations_and_sources['source_references'])){
|
|
1593 |
$out .= ' ' . join(' ', $annotations_and_sources['source_references'] );
|
|
1594 |
}
|
|
1595 |
$out .= $annotations_and_sources['foot_note_keys'] . ' </' . $enclosingTag . '>';
|
1567 |
1596 |
}
|
1568 |
1597 |
|
|
1598 |
RenderHints::popFromRenderStack();
|
|
1599 |
return markup_to_render_array($out);
|
|
1600 |
}
|
|
1601 |
|
1569 |
1602 |
/**
|
1570 |
1603 |
* @param $descriptionElement
|
1571 |
1604 |
* @return array
|
#3358 harmonizing common name rendering