Project

General

Profile

« Previous | Next » 

Revision ae0a5060

Added by Andreas Kohlbecker almost 11 years ago

common names orderd and merged in case of duplicates

View differences:

7.x/modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
532 532
  if (is_array($elements)) {
533 533
    foreach ($elements as $element) {
534 534
      if ($element->class == 'CommonTaxonName') {
535
        // $key = '<b>' . $element->language->representation_L10n . '</b> (' .
536
        // $element->area->titleCache . ')';
537 535
        if (isset($element->language->representation_L10n)) {
538
          $key = '<b>' . $element->language->representation_L10n . '</b>';
539
          $key .= (isset($element->area->titleCache) && strlen($element->area->titleCache) > 0) ? ' (' . $element->area->titleCache . ')' : '';
540
          $common_names[$key][] = $element;
536
          $language_area_key = '<b>' . $element->language->representation_L10n . '</b>';
537
          if(isset($element->area->titleCache) && strlen($element->area->titleCache) > 0){
538
            $language_area_key .= ' (' . $element->area->titleCache . ')';
539
          }
541 540
        }
542 541
        else {
543
          // @Comment WA: common name without a language, should this happen?
542
          // common name without a language, should not happen but is possible
544 543
          // example: flore_gabon/cdm_dataportal/taxon/24f36d18-a6e8-4edb-93bf-4a30f3394bf5.
545
          // if(!isset($key)) { // Just to mimic same behaviour as in D5.
546
          $key = '';
547
          // }
548
          $common_names[$key][] = $element;
544
          $language_area_key = '';
545
        }
546
        if(isset($common_names[$language_area_key][$element->name])) {
547
          // same name already exists for language and areae combination, se we merge the description elements
548
          cdm_merge_description_elements($common_names[$language_area_key][$element->name], $element);
549
        } else{
550
          // otherwise add as new entry
551
          $common_names[$language_area_key][$element->name] = $element;
549 552
        }
550 553
      }
551 554
      elseif ($element->class == 'TextData') {
552
        // else if ($element->class == 'TextData' && $element->feature->uuid
553
        // == UUID_COMMON_NAME){
554 555
        $textData_commonNames[] = $element;
555 556
      }
556 557
    }
......
564 565

  
565 566
    // Creating the output to be render by Drupal.
566 567
    foreach ($common_names as $key => $elements) {
568
      ksort($elements); // sort names alphabetically
567 569
      $rendered_element_list = '';
568 570
      foreach ($elements as $element) {
569 571
        $sourcesFootnoteKeyList = '';
......
1485 1487
  return $out;
1486 1488
}
1487 1489

  
1488
// @WA $pageSize is not used..
1489
// function theme_cdm_block_IdentificationKeys($taxonUuid = null, $pageSize =
1490
// null){
1491 1490
/**
1492 1491
 * @todo Please document this function.
1493 1492
 * @see http://drupal.org/node/1354
......
1515 1514
  return $out;
1516 1515
}
1517 1516

  
1518
// This theming function formats the use description and use record list for
1519
// these descriptions.
1520
// Comment @WA: $pageSize and $pageNumber are not used.
1521
// function theme_cdm_UseDescription($descriptions = NULL, $taxonUuid = NULL,
1522
// $pageSize, $pageNumber) {
1523 1517
/**
1524
 * @todo Please document this function.
1518
 * This theming function formats the use description and use record list for
1519
 * these descriptions.
1520
 *
1525 1521
 * @see http://drupal.org/node/1354
1526 1522
 */
1527 1523
function theme_cdm_UseDescription($variables) {

Also available in: Unified diff