Project

General

Profile

Revision 6679207a

ID6679207a899188bbae8fba986cf4655a6fd2e87d
Parent ad6ad4c6
Child f02e26e1

Added by Andreas Kohlbecker about 2 months ago

ref #9222 adapting dataportal and tests to single sourced classes

View differences:

modules/cdm_dataportal/cdm_dataportal.module
1342 1342
 */
1343 1343
function _load_taxonBase(&$taxonBase) {
1344 1344
  if (isset($taxonBase->uuid)) {
1345
    $taxonBase->name = cdm_ws_get(CDM_WS_TAXON, array($taxonBase->uuid, "name"));
1346
    $taxonBase->name->taggedName = cdm_ws_get(CDM_WS_NAME, array($taxonBase->name->uuid, "taggedName"));
1347
    $taxonBase->name->nomenclaturalReference = cdm_ws_get(CDM_WS_NAME, array($taxonBase->name->uuid, "nomenclaturalReference"));
1345
    $taxonBase->name = cdm_ws_get(CDM_WS_PORTAL_TAXON, array($taxonBase->uuid, "name"));
1346
    $taxonBase->name->nomenclaturalSource = cdm_ws_get(CDM_WS_NAME, array($taxonBase->name->uuid, "nomenclaturalSource"));
1348 1347
  }
1349 1348
}
1350 1349

  
modules/cdm_dataportal/includes/footnotes.inc
289 289
  if (isset($name_rel->ruleConsidered) && $name_rel->ruleConsidered) {
290 290
    $footnote_markup = '<span class="rule_considered">' . $name_rel->ruleConsidered . '</span> ';
291 291
  }
292
  if (isset($name_rel->citation)) {
293
    $footnote_markup .= '<span class="reference">' . $name_rel->citation->titleCache . '</span>';
292
  if (isset($name_rel->source->citation)) {
293
    $footnote_markup .= '<span class="reference">' . $name_rel->source->citation->titleCache . '</span>';
294 294
  }
295
  if (isset($name_rel->citationMicroReference) && $name_rel->citationMicroReference) {
296
    $footnote_markup .= (isset($name_rel->citation) ? ':' : '') . ' <span class="reference_detail">' . $name_rel->citationMicroReference . '</span>';
295
  if (isset($name_rel->source->citationMicroReference) && $name_rel->source->citationMicroReference) {
296
    $footnote_markup .= (isset($name_rel->source->citation) ? ':' : '') . ' <span class="reference_detail">' . $name_rel->source->citationMicroReference . '</span>';
297 297
  }
298 298
  if ($footnote_markup) {
299 299
    $fnkey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $footnote_markup);
......
332 332
{
333 333
  $footnote_markup = '';
334 334
  $footnote_key_markup = '';
335
  if (isset($name->nomenclaturalReference) && $name->nomenclaturalReference) {
336
    $footnote_markup .= '<span class="reference">' . $name->nomenclaturalReference->titleCache . '</span>';
335
  if (isset($name->nomenclaturalSource->citation) && $name->nomenclaturalSource->citation) {
336
    $footnote_markup .= '<span class="reference">' . $name->nomenclaturalSource->citation->titleCache . '</span>';
337 337
  }
338
  if (isset($name->nomenclaturalMicroReference)) {
339
    $footnote_markup .= ($footnote_key_markup ? ':' : '') . '<span class="reference_detail">' . $name->nomenclaturalMicroReference . '</span>';
338
  if (isset($name->nomenclaturalSource->citationMicroReference)) {
339
    $footnote_markup .= ($footnote_key_markup ? ':' : '') . '<span class="reference_detail">' . $name->nomenclaturalSource->citationMicroReference . '</span>';
340 340
  }
341 341
  if ($footnote_markup) {
342 342
    $fnkey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $footnote_markup);
modules/cdm_dataportal/includes/name.inc
251 251
 * part_definitions and render_templates (see get_partDefinition() and
252 252
 * get_nameRenderTemplate())
253 253
 *
254
 * @param $taxonName
255
 *    cdm TaxonName instance
254
 * @param $taxon_name_or_taxon_base
255
 *    A cdm TaxonBase or TaxonName entity
256 256
 * @param $name_link
257
 *    URI to the taxon, @see path_to_taxon(), must be processed by url() before passing to this method
258
 * @param $reference_link
259
 *    URI to the reference, @see path_to_reference(), must be processed by url() before passing to this method
260
 * @param $show_annotations
257
 *    URI to the taxon, @param $reference_link
258
 *    URI to the reference, @param bool $show_annotations
261 259
 *    turns the display of annotations on
262
 * @param $is_type_designation
260
 * @param bool $is_type_designation
263 261
 *    To indicate that the supplied taxon name is a name type designation.
264
 * @param $skiptags
262
 * @param array $skiptags
265 263
 *    an array of name elements tags like 'name', 'rank' to skip. The name part
266 264
 *          'authors' will not ber affected by this filter. This part is managed though the render template
267 265
 *          mechanism.
268
 * @param $is_invalid
266
 * @param bool $is_invalid
269 267
 *   Indicates that this taxon is invalid. In this case the name part will be shown in double quotes.
270 268
 *   This is useful when rendering taxon relation ships.
271 269
 *
272 270
 * @return string
273 271
 *  The markup for a taxon name.
274
 *
272
 * @see path_to_taxon(), must be processed by url() before passing to this method
273
 * @see path_to_reference(), must be processed by url() before passing to this method
275 274
 */
276 275
function render_taxon_or_name($taxon_name_or_taxon_base, $name_link = NULL, $reference_link = NULL,
277 276
  $show_annotations = true, $is_type_designation = false, $skiptags = array(), $is_invalid = false) {
......
413 412
    // Komma nach dem Autornamen ist ├╝berall dort falsch, wo ein "in" folgt."
414 413
    if (isset($renderTemplate['referencePart']['reference'])) {
415 414
      $microreference = NULL;
416
      if (isset($renderTemplate['referencePart']['microreference'])&& isset($taxonName->nomenclaturalMicroReference)) {
417
        $microreference = $taxonName->nomenclaturalMicroReference;
415
      if (isset($renderTemplate['referencePart']['microreference'])&& isset($taxonName->nomenclaturalSource->citationMicroReference)) {
416
        $microreference = $taxonName->nomenclaturalSource->citationMicroReference;
418 417
      }
419
      if(count($nomref_tagged_text) == 0 && isset($taxonName->nomenclaturalReference)){
418
      if(count($nomref_tagged_text) == 0 && isset($taxonName->nomenclaturalSource->citation)){
420 419
        // TODO is this case still relevant? The tagged text should already contain all information!
421
        $citation = cdm_ws_getNomenclaturalReference($taxonName->nomenclaturalReference->uuid, $microreference);
420
        $citation = cdm_ws_getNomenclaturalReference($taxonName->nomenclaturalSource->citation->uuid, $microreference);
422 421
        // Find preceding element of the reference.
423 422
        $precedingKey = get_preceding_contentElementKey('reference', $renderTemplate);
424 423
        if (str_beginsWith($citation, ", in")) {
......
460 459

  
461 460
  $is_reference_year = false;
462 461
  if (isset($renderTemplate['referenceYearPart']['reference.year'])) {
463
    if(isset($taxonName->nomenclaturalReference->datePublished)){
464
      $referenceArray['#html'] = ' <span class="reference">' . timePeriodToString($taxonName->nomenclaturalReference->datePublished) . '</span>';
462
    if(isset($taxonName->nomenclaturalSource->citation->datePublished)){
463
      $referenceArray['#html'] = ' <span class="reference">' . timePeriodToString($taxonName->nomenclaturalSource->citation->datePublished) . '</span>';
465 464
      array_setr('reference.year', $referenceArray, $renderTemplate);
466 465
      $is_reference_year = true;
467 466
    }
......
935 934

  
936 935
        }
937 936
        $referenceUri = '';
938
        if (isset($name_type_designation->typeName->nomenclaturalReference)) {
939
          $referenceUri = url(path_to_reference($name_type_designation->typeName->nomenclaturalReference->uuid));
937
        if (isset($name_type_designation->typeName->nomenclaturalSource->citation)) {
938
          $referenceUri = url(path_to_reference($name_type_designation->typeName->nomenclaturalSource->citation->uuid));
940 939
        }
941 940
        $out .= ': ' . render_taxon_or_name($name_type_designation->typeName, $link_to_name_page, $referenceUri, TRUE, TRUE);
942 941
      }
modules/cdm_dataportal/includes/pages.inc
700 700
      $label = variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL, CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT);
701 701
      $accepted_name .= '<div class="secReference"><span class="label">' . t($label) . ':</span> ' . $taxon->sec->titleCache . '</div>';
702 702
    }
703
    if (isset($taxon->name->nomenclaturalReference)) {
704
      $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
703
    if (isset($taxon->name->nomenclaturalSource->citation)) {
704
      $referenceUri = url(path_to_reference($taxon->name->nomenclaturalSource->citation->uuid));
705 705
    }
706 706

  
707 707
    $accepted_name .= '<div class="accepted-name">';
modules/cdm_dataportal/includes/taxon.inc
380 380
  // Now rendering starts ..
381 381
  RenderHints::pushToRenderStack('related_taxon');
382 382

  
383
  if (isset($taxon->name->nomenclaturalReference)) {
384
    $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
383
  if (isset($taxon->name->nomenclaturalSource->citation)) {
384
    $referenceUri = url(path_to_reference($taxon->name->nomenclaturalSource->citation->uuid));
385 385
  }
386 386
  $taxonUri = '';
387 387
  if ($doLinkTaxon) {
......
464 464
    $out .= '<span class="acceptedFor">';
465 465
    $out .= t('is accepted for ');
466 466
    $referenceUri = null;
467
    if (isset($synonym->name->nomenclaturalReference)) {
468
      $referenceUri = url(path_to_reference($synonym->name->nomenclaturalReference->uuid));
467
    if (isset($synonym->name->nomenclaturalSource->citation)) {
468
      $referenceUri = url(path_to_reference($synonym->name->nomenclaturalSource->citation->uuid));
469 469
    }
470 470
    $out .= render_taxon_or_name($synonym->name, NULL, $referenceUri);
471 471
    $annotations_and_sources = handle_annotations_and_sources(
......
576 576

  
577 577
          $taxonUri = uri_to_synonym($taxon->uuid, $acceptedTaxon->uuid);
578 578
          $referenceUri = '';
579
          if (isset($acceptedTaxon->name->nomenclaturalReference)) {
580
            $referenceUri = url(path_to_reference($acceptedTaxon->name->nomenclaturalReference->uuid));
579
          if (isset($acceptedTaxon->name->nomenclaturalSource->citation)) {
580
            $referenceUri = url(path_to_reference($acceptedTaxon->name->nomenclaturalSource->citation->uuid));
581 581
          }
582 582
          $taxon_or_name = $is_synonym ? $taxon->name : $taxon;
583 583
          // $taxon_or_name this is a trick to suppress the sec reference for synonyms
......
615 615
      // Its a Taxon.
616 616
      $taxonUri = url(path_to_taxon($taxon->uuid));
617 617
      $referenceUri = '';
618
      if (isset($taxon->name->nomenclaturalReference)) {
619
        $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
618
      if (isset($taxon->name->nomenclaturalSource->citation)) {
619
        $referenceUri = url(path_to_reference($taxon->name->nomenclaturalSource->citation->uuid));
620 620
      }
621 621
      $out .= '<div class="item Taxon">' . render_taxon_or_name($taxon, $taxonUri, $referenceUri);
622 622
      if ($show_classification) {
modules/cdm_dataportal/theme/cdm_dataportal.page.theme
32 32
  RenderHints::pushToRenderStack('taxon_page_title');
33 33
  $referenceUri = '';
34 34
  $out = '';
35
  if (isset($taxon->name->nomenclaturalReference)) {
36
    $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
35
  if (isset($taxon->name->nomenclaturalSource->citation)) {
36
    $referenceUri = url(path_to_reference($taxon->name->nomenclaturalSource->citation->uuid));
37 37
  }
38 38

  
39 39
  $out .= render_taxon_or_name($taxon, NULL, $referenceUri, FALSE);
......
192 192
  RenderHints::pushToRenderStack('name_page_title');
193 193

  
194 194
  $referenceUri = NULL;
195
  if (isset($taxon_name->nomenclaturalReference)) {
196
    $referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
195
  if (isset($taxon_name->nomenclaturalSource->citation)) {
196
    $referenceUri = url(path_to_reference($taxon_name->nomenclaturalSource->citation->uuid));
197 197
  }
198 198

  
199 199
  $out = '<span class="' . html_class_attribute_ref($taxon_name) . '">'

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)