Project

General

Profile

« Previous | Next » 

Revision a6c4c53c

Added by Andreas Kohlbecker almost 4 years ago

ref #8134 dealing with web service problems returning list instead of pagers and better placement of footnotes

View differences:

modules/cdm_dataportal/includes/descriptions.inc
363 363
    $is_bibliography_aware = FALSE
364 364
  ){
365 365

  
366
  $sources = cdm_entity_sources_sorted($description_element);
367

  
366 368
  // Annotations as footnotes.
367 369
  $footNoteKeys = cdm_annotations_as_footnotekeys($description_element, $footnote_list_key_suggestion);
368 370

  
369 371
  // Source references as footnotes.
370

  
371 372
  if($is_bibliography_aware){
372 373
    $bibliography_settings = get_bibliography_settings();
373 374
    $sources_footnote_list_key = original_source_footnote_list_key($footnote_list_key_suggestion);
......
377 378
    $original_source_footnote_tag = NULL;
378 379
  }
379 380

  
380
  usort($description_element->sources, 'compare_original_sources');
381
  foreach ($description_element->sources as $source) {
381
  foreach ($sources as $source) {
382 382
    if (_is_original_source_type($source)) {
383 383
      $fn_key = FootnoteManager::addNewFootnote(
384 384
        $sources_footnote_list_key,
......
559 559
    );
560 560

  
561 561
    // some entity types only have single sources:
562
    if(isset($entity->source) && is_object($entity->source)){
563
      $sources = [$entity->source];
564
    } else if(isset($entity->sources)) {
565
      $sources = $entity->sources;
566
    } else {
567
      $sources = [];
568
    }
569
    usort($sources, 'compare_original_sources');
562
    $sources = cdm_entity_sources_sorted($entity);
570 563

  
571 564
    if ($config['sources_as_content'] == 1) {
572 565
      foreach ($sources as $source) {
......
622 615
    return $annotations_and_sources;
623 616
  }
624 617

  
618
/**
619
 * Get the source or the sources from a cdm entity and return them ordered by see compare_original_sources()
620
 * (Some entity types only have single sources)
621
 * @param $entity
622
 *
623
 * @return array
624
 */
625
function cdm_entity_sources_sorted($entity) {
626
  if (isset($entity->source) && is_object($entity->source)) {
627
    $sources = [$entity->source];
628
  }
629
  else if (isset($entity->sources)) {
630
    $sources = $entity->sources;
631
  }
632
  else {
633
    $sources = [];
634
  }
635
  usort($sources, 'compare_original_sources');
636
  return $sources;
637
}
638

  
625 639

  
626
  /**
640
/**
627 641
   * This method determines the footnote key for original sources to be shown in the bibliography block
628 642
   *
629 643
   * The footnote key depends on the value of the 'enabled' value of the bibliography_settings

Also available in: Unified diff