Project

General

Profile

« Previous | Next » 

Revision 4eab6eeb

Added by Andreas Kohlbecker over 3 years ago

moving methods from theme to inc file

View differences:

modules/cdm_dataportal/includes/name.inc
1855 1855
    'Paratype'
1856 1856
  );
1857 1857
  return $type_status_order;
1858
}
1858
}
1859

  
1860
/**
1861
 * Return HTML for the lectotype citation with the correct layout.
1862
 *
1863
 * This function prints the lectotype citation with the correct layout.
1864
 * Lectotypes are renderized in the synonymy tab of a taxon if they exist.
1865
 *
1866
 * @param mixed $typeDesignation
1867
 *   Object containing the lectotype citation to print.
1868
 *
1869
 * @return string
1870
 *   Valid html string.
1871
 */
1872
function type_designation_citation_layout($typeDesignation, $footnote_separator = ',') {
1873
  $res = '';
1874
  $citation = $typeDesignation->citation;
1875
  $pages = $typeDesignation->citationMicroReference;
1876
  if(isset($typeDesignation->typeStatus->uuid) && isset($typeDesignation->typeStatus->representation_L10n)) {
1877
    if ( $typeDesignation->typeStatus->uuid == UUID_NTD_ORIGINAL_DESIGNATION || $typeDesignation->typeStatus->uuid == UUID_NTD_MONOTYPY) {
1878
      $res = ' (' . $typeDesignation->typeStatus->representation_L10n . ')';
1879
      return $res;
1880
    }
1881
  }
1882

  
1883
  if ($citation) {
1884
    // $type = $typeDesignation_citation->type;
1885
    $year = isset($citation->datePublished->start) ? substr($citation->datePublished->start, 0, 4) : '';
1886
    $author = isset($citation->authorship->titleCache) ? $citation->authorship->titleCache : '';
1887
    $res .= ' (designated by ';
1888
    $res .= $author;
1889
    $res .= ($year ? ' ' . $year : '');
1890
    $res .= ($pages ? ': ' . $pages : '');
1891
    // $res .= ')';
1892

  
1893
    // footnotes should be rendered in the parent element so we
1894
    // are relying on the FootnoteListKey set there
1895
    $fkey_typeDesignation = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $typeDesignation->citation->titleCache);
1896
    $res .= theme('cdm_footnote_key', array(
1897
        'footnoteKey' => $fkey_typeDesignation,
1898
        'separator' => $footnote_separator,
1899
        'highlightable' => TRUE,
1900
        'separator_off' => TRUE,
1901
      )) . ')';
1902
  }
1903
  return $res;
1904
}
1905

  
1906
/**
1907
 * Creates markup for the status of a type designation. In case the status or its representation is missing the label will be set to "Type"
1908
 *
1909
 * @param $type_designation
1910
 * @return string
1911
 */
1912
function type_designation_status_label_markup($type_designation)
1913
{
1914
  return '<span class="type-status">'
1915
    . ((isset($type_designation->typeStatus->representation_L10n)) ? ucfirst($type_designation->typeStatus->representation_L10n) : t('Type')) . '</span>'
1916
    ;
1917
}

Also available in: Unified diff