Project

General

Profile

« Previous | Next » 

Revision 6cbefddc

Added by Andreas Kohlbecker almost 6 years ago

ref #7495 reference page lists registrations

View differences:

modules/cdm_dataportal/cdm_dataportal.module
1141 1141

  
1142 1142
  cdm_check_valid_portal_page();
1143 1143

  
1144
  $reference = cdm_ws_get(CDM_WS_REFERENCE, $uuid);
1145
  return theme('cdm_reference_page', array('reference' => $reference));
1144
  return compose_cdm_reference_page($uuid);
1146 1145
}
1147 1146

  
1148 1147
/**
......
1838 1837
  $registration_identifier = urldecode($registration_identifier_encoded);
1839 1838

  
1840 1839

  
1841
  $render_array = array();
1842 1840

  
1841
  $render_array = array();
1843 1842
  $registration_dto = cdm_ws_get("registrationDTO/identifier/" . $registration_identifier_encoded);
1844 1843
  if($registration_dto){
1845 1844
    drupal_set_title(t('Registration') . ' ' . $registration_identifier, PASS_THROUGH);
1846 1845

  
1847
    $render_array['citation'] = markup_to_render_array("<div class=\"" . html_class_attribute_ref(new TypedEntityReference("Reference", $registration_dto->citationUuid)) . "\">"
1848
      . l($registration_dto->bibliographicCitationString, path_to_registration_workingset($registration_dto->citationUuid))
1849
      . "</br>&nbsp;</div>");
1850
    $render_array['summary'] = markup_to_render_array("<div>" . cdm_tagged_text_to_markup($registration_dto->summaryTaggedText) . "</div>");
1846
    array_merge($render_array, compose_registation_dto($registration_dto));
1851 1847

  
1852 1848
    if(is_object($registration_dto->orderdTypeDesignationWorkingSets)){
1853

  
1854 1849
      $field_unit_uuids = array();
1855 1850
      foreach((array)$registration_dto->orderdTypeDesignationWorkingSets as $field_unit_ref => $obj){
1856 1851
        $tokens = explode("#", $field_unit_ref);
......
1867 1862
  return $render_array ;
1868 1863
}
1869 1864

  
1865
/**
1866
 * @param $registration_dto
1867
 * @return array
1868
 */
1869
function compose_registation_dto($registration_dto, $with_citation = true, $with_identifier = false)
1870
{
1871
  $render_array = array();
1872
  if ($with_citation) {
1873
    $render_array['citation'] = markup_to_render_array("<div class=\"" . html_class_attribute_ref(new TypedEntityReference("Reference", $registration_dto->citationUuid)) . "\">"
1874
      . l($registration_dto->bibliographicCitationString, path_to_registration_workingset($registration_dto->citationUuid))
1875
      . "</br>&nbsp;</div>");
1876
  }
1877
  $registation_markup = cdm_tagged_text_to_markup($registration_dto->summaryTaggedText);
1878
  if($with_identifier){
1879
    $registation_markup .= " " . l ($registration_dto->identifier, $registration_dto->identifier);
1880
  }
1881
  $render_array['summary'] = markup_to_render_array("<div>" . $registation_markup . "</div>");
1882
  return $render_array;
1883
}
1870 1884

  
1871 1885

  
1872 1886
/**
modules/cdm_dataportal/theme/cdm_dataportal.page.theme
388 388
}
389 389

  
390 390
/**
391
 * Returns HTML for a single reference page.
391
 * Returns a drupal render array for a single reference page.
392 392
 *
393
 * Renders a page with all data on a single reference.
393
 * Composes a page with all data on a single reference.
394 394
 *
395
 * @param array $variables
396
 *   An associative array containing:
397
 *   - reference: Object.
395
 * @param string $uuid
396
 *   An uuid for a cdm reference.
398 397
 *
399
 * @ingroup themeable
398
 * @return array
399
 *  A drupal render array
400
 *
401
 * @ingroup compose
400 402
 */
401
function theme_cdm_reference_page($variables) {
402
  $reference = $variables['reference'];
403
function compose_cdm_reference_page($uuid) {
403 404

  
404 405
  $out = '';
405

  
406
  $reference = cdm_ws_get(CDM_WS_REFERENCE, $uuid);
406 407
  if (isset($reference->titleCache)) {
407 408
    drupal_set_title($reference->titleCache, PASS_THROUGH);
408 409
  }
......
558 559
    $out .= '<h2 class="block-title">Abstract</h2><div class="abstract">' . $reference->referenceAbstract . '</div>';
559 560
  }
560 561

  
562

  
561 563
  // Annotations below the table.
562 564
  $annotations = cdm_ws_getAnnotationsFor($reference);
563 565
  $out .= theme("cdm_annotations", array('annotations' => $annotations));
564 566

  
565
  return $out;
567
  $registration_working_set = cdm_ws_get("registrationWorkingSetDTO", array($uuid));
568
  if($registration_working_set && count($registration_working_set->registrationDTOs) > 0){
569
    $out .= "<h3>Nomenclatural acts:</h3>";
570
    foreach($registration_working_set->registrationDTOs as $registration_dto){
571
      $out .= drupal_render(compose_registation_dto($registration_dto, false, true));
572
    }
573
  }
574

  
575
  return markup_to_render_array($out);
566 576
}
567 577

  
568 578
/**
modules/cdm_dataportal/theme/theme_registry.inc
107 107
    'cdm_taxon_page_title' => array('variables' => array('taxon' => NULL)),
108 108
    'cdm_name_page_title' => array('variables' => array('taxon_name' => NULL)),
109 109
    'cdm_taxon_page_synonymy' => array('variables' => array('taxon' => NULL, 'addAcceptedTaxon' => NULL)),
110
    'cdm_reference_page' => array('variables' => array('reference' => NULL)),
111 110
    'cdm_media_page' => array('variables' => array(
112 111
        'media' => NULL,
113 112
        'mediarepresentation_uuid' => FALSE,

Also available in: Unified diff