Project

General

Profile

« Previous | Next » 

Revision 092744e1

Added by Andreas Kohlbecker about 10 years ago

dataportal now uses the DescriptionInfoDTO service - a lot refactoring, old stuff left for now as reference

View differences:

7.x/modules/cdm_dataportal/includes/pages.inc
283 283
  // --- PAGE PART: DESCRIPTION --- //
284 284
  if ($page_part == 'description' || $page_part == 'all') {
285 285

  
286
    $merged_tree = cdm_ws_descriptions_by_featuretree(get_profile_featureTree(), $taxon->uuid);
286
    // 1. fetch descriptions_by_featuretree but exclude the distribution feature
287
    $merged_tree = cdm_ws_descriptions_by_featuretree(get_profile_featureTree(), $taxon->uuid, array(UUID_DISTRIBUTION));
288

  
289

  
290
    // 2. find the distribution feature node
291
    $distribution_node =& cdm_feature_tree_find_node($merged_tree->root->childNodes, UUID_DISTRIBUTION);
292

  
293
    if ( $distribution_node) {
294
      // 3. get the distributionInfoDTO
295
      $query_parameters = cdm_distribution_filter_query();
296
      $query_parameters['part'] = array('mapUriParams');
297
      if(variable_get('distribution_sort', 'NO_SORT') != 'NO_SORT'){
298
        $query_parameters['part'][] = 'tree';
299
      } else {
300
        $query_parameters['part'][] = 'elements';
301
      }
302
      $query_parameters['omitLevels'] = array(UUID_NAMEDAREALEVEL_TDWGLEVEL_2);
303

  
304
      $distribution_info_dto = cdm_ws_get(CDM_WS_PORTAL_DESCRIPTION_DISTRIBUTION_INFO_FOR, $taxon->uuid, queryString($query_parameters));
305
      // 4. get distribution TextData is there are any
306
      $distribution_text_data = cdm_ws_fetch_all(CDM_WS_DESCRIPTIONELEMENT_BY_TAXON,
307
        array(
308
            'taxon' => $taxon->uuid,
309
            'type'=>'TextData',
310
            'features' => UUID_DISTRIBUTION
311
          )
312
      );
313

  
314
      // 5. put all disitribution data into the distribution feature node
315
      if($distribution_text_data || $distribution_info_dto) {
316
        $distribution_node->descriptionElements = array('#type' => 'DTO');
317
        if($distribution_text_data){
318
          $distribution_node->descriptionElements['TextData'] = $distribution_text_data;
319
        }
320
        if($distribution_info_dto){
321
          $distribution_node->descriptionElements['DistributionInfoDTO'] = $distribution_info_dto;
322
        }
323
      }
324
    }
287 325

  
288 326
    $render_array['general'] = compose_cdm_taxon_page_profile($taxon, $merged_tree, $media);
289 327
    $render_array['general']['#weight'] = $weight++;
......
491 529
  );
492 530
  $render_array['taxon_description_feature_toc'] = $toc; //markup_to_render_array($toc_html);
493 531

  
494
  // Description.
532
  // Render the sections for each feature
495 533
  $render_array['taxon_description_features'] = markup_to_render_array(
496 534
      theme(
497 535
          'cdm_feature_nodes',

Also available in: Unified diff