Project

General

Profile

« Previous | Next » 

Revision bf8aea21

Added by Andreas Kohlbecker over 4 years ago

ref #8658 constants for pseudo feature blocks

View differences:

modules/cdm_dataportal/includes/pages.inc
16 16
 *   - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
17 17
 */
18 18

  
19
const PSEUDO_FEATURE_AGGREGATION_DESCRIPTIONS = 'AGGREGATION_DESCRIPTIONS';
20

  
21
const PSEUDO_FEATURE_BIBLIOGRAPHY = 'BIBLIOGRAPHY';
22

  
19 23

  
20 24
/**
21 25
 * Composes a render array representing the ocurrences associetad with the $taxon.
......
560 564
  // Render the sections for each real feature
561 565
  $feature_block_list = make_feature_block_list($merged_tree->root->childNodes, $taxon);
562 566

  
567
  // >>>>>>>>>>>>>>>>>>> PSEUDO FEATURES >>>>>>>>>>>>>>>>>>>
568

  
563 569
  // Bibliography
564 570
  $bibliography_settings = get_bibliography_settings();
565 571
  if($bibliography_settings['enabled'] == 1){
566
    $bibliography_markup = FootnoteManager::renderFootnoteList('BIBLIOGRAPHY', '');
572
    $bibliography_markup = FootnoteManager::renderFootnoteList(PSEUDO_FEATURE_BIBLIOGRAPHY, '');
567 573
    if($bibliography_markup) {
568
      $feature_bibliography = make_pseudo_feature('Bibliography', 'BIBLIOGRAPHY');
574
      $feature_bibliography = make_pseudo_feature('Bibliography', PSEUDO_FEATURE_BIBLIOGRAPHY);
569 575
      $bibliography_item = markup_to_render_array($bibliography_markup);
570 576
      $bibliography_block = feature_block(t('Bibliography'), $feature_bibliography);
571 577
      $bibliography_block->content = array();
......
576 582
    }
577 583
  }
578 584

  
579
    $descriptionTypes = array();
580
    $descriptionTypes['descriptionTypes'] = ("AGGREGATED_STRUC_DESC");
581
    $aggregatedDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxon->uuid . '/descriptions', $descriptionTypes);
582
    if (isset($aggregatedDescriptions) and !empty($aggregatedDescriptions)) {
583
        // descriptions pseudo feature
584
        $feature_description = make_pseudo_feature('Descriptions (aggregated)', 'AGGREGATION_DESCRIPTIONS');
585
        $description_item = '';
586
        foreach ($aggregatedDescriptions as $description) {
587
          $description_item .= render_cdm_description($description, TRUE);
588
        }
589
        $description_block = feature_block(t('Descriptions (aggregated)'), $feature_description);
590
        $description_block->content = [];
591
        $description_block->content[] = compose_feature_block_wrap_elements([$description_item], $feature_description);
585
  // Descriptions (aggregated)
586
  $descriptionTypes = array();
587
  $descriptionTypes['descriptionTypes'] = ("AGGREGATED_STRUC_DESC");
588
  $aggregatedDescriptions = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXON . '/' . $taxon->uuid . '/descriptions', $descriptionTypes);
589
  if (isset($aggregatedDescriptions) and !empty($aggregatedDescriptions)) {
590
      // if($feature_block_list) ....TODO
591
      $feature_description = make_pseudo_feature('Descriptions (aggregated)', PSEUDO_FEATURE_AGGREGATION_DESCRIPTIONS);
592
      $description_item = '';
593
      foreach ($aggregatedDescriptions as $description) {
594
        $description_item .= render_cdm_description($description, TRUE);
595
      }
596
      $description_block = feature_block(t('Descriptions (aggregated)'), $feature_description);
597
      $description_block->content = [];
598
      $description_block->content[] = compose_feature_block_wrap_elements([$description_item], $feature_description);
592 599

  
593
        $pseudo_feature_block_toc_items['Descriptions (aggregated)'] = 'aggregation_descriptions';
594
        $pseudo_feature_blocks[] = $description_block;
600
      $pseudo_feature_block_toc_items['Descriptions (aggregated)'] = 'aggregation_descriptions';
601
      $pseudo_feature_blocks[] = $description_block;
595 602

  
596
    }
597
    $render_array['taxon_description_features'] = _block_get_renderable_array(
598
        array_merge($feature_block_list, $pseudo_feature_blocks)
599
    );
603
  }
604
  $render_array['taxon_description_features'] = _block_get_renderable_array(
605
      array_merge($feature_block_list, $pseudo_feature_blocks)
606
  );
600 607

  
601
    if ($pseudo_feature_block_toc_items){
608
  // update TOC
609
  if ($pseudo_feature_block_toc_items){
602 610
    foreach ($pseudo_feature_block_toc_items as $label=>$fragment){
603 611
      cdm_toc_list_add_item($label, $fragment);
604 612
    }
605 613
  }
606 614

  
615
  // <<<<<<<<<<<<<<<<<<< PSEUDO FEATURES <<<<<<<<<<<<<<<<<<<
616

  
607 617
  // create the table of content
608 618
  $toc = array(
609 619
      '#theme' => 'item_list',

Also available in: Unified diff