1 |
6657531f
|
Andreas Kohlbecker
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Name theming functions.
|
5 |
|
|
*
|
6 |
|
|
* @copyright
|
7 |
|
|
* (C) 2007-2012 EDIT
|
8 |
|
|
* European Distributed Institute of Taxonomy
|
9 |
|
|
* http://www.e-taxonomy.eu
|
10 |
|
|
*
|
11 |
|
|
* The contents of this module are subject to the Mozilla
|
12 |
|
|
* Public License Version 1.1.
|
13 |
|
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14 |
|
|
*/
|
15 |
|
|
|
16 |
|
|
/**
|
17 |
|
|
* @todo Please document this function.
|
18 |
|
|
* @see http://drupal.org/node/1354
|
19 |
|
|
*/
|
20 |
|
|
function theme_cdm_homotypicSynonymLine($variables) {
|
21 |
|
|
$taxon = $variables['taxon'];
|
22 |
|
|
$out = '';
|
23 |
|
|
$out .= '<li class="synonym">' . cdm_related_taxon($taxon, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
|
24 |
|
|
|
25 |
|
|
return $out;
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
/**
|
29 |
|
|
* @todo Please document this function.
|
30 |
|
|
* @see http://drupal.org/node/1354
|
31 |
|
|
*/
|
32 |
|
|
function theme_cdm_heterotypicSynonymyGroup($variables) {
|
33 |
b059b449
|
Andreas Kohlbecker
|
$homotypical_group = $variables['homotypicalGroup'];
|
34 |
6657531f
|
Andreas Kohlbecker
|
RenderHints::pushToRenderStack('heterotypicSynonymyGroup');
|
35 |
|
|
|
36 |
|
|
$out = '';
|
37 |
fea89e38
|
Andreas Kohlbecker
|
$out = '<div class="heterotypic-synonymy-group"><ul class="heterotypicSynonymyGroup">';
|
38 |
b059b449
|
Andreas Kohlbecker
|
$footnoteListKey = (isset($homotypical_group[0]) ? $homotypical_group[0]->uuid : 'NULL');
|
39 |
6657531f
|
Andreas Kohlbecker
|
RenderHints::setFootnoteListKey($footnoteListKey);
|
40 |
|
|
|
41 |
b059b449
|
Andreas Kohlbecker
|
$type_designations= type_designations_for_synonymy_group($homotypical_group);
|
42 |
|
|
|
43 |
6657531f
|
Andreas Kohlbecker
|
$is_first_entry = TRUE;
|
44 |
b059b449
|
Andreas Kohlbecker
|
foreach ($homotypical_group as $synonym) {
|
45 |
6657531f
|
Andreas Kohlbecker
|
if ($is_first_entry) {
|
46 |
|
|
$is_first_entry = FALSE;
|
47 |
|
|
// Is first list entry.
|
48 |
|
|
$out .= '<li class="firstentry synonym">' . cdm_related_taxon($synonym, UUID_HETEROTYPIC_SYNONYM_OF) . '</li>';
|
49 |
|
|
}
|
50 |
|
|
else {
|
51 |
|
|
$out .= '<li class="synonym">' . cdm_related_taxon($synonym, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
|
52 |
|
|
}
|
53 |
|
|
}
|
54 |
|
|
|
55 |
b059b449
|
Andreas Kohlbecker
|
if (count($type_designations) > 0) {
|
56 |
0c720425
|
Andreas Kohlbecker
|
$out .= render_type_designations($type_designations);
|
57 |
6657531f
|
Andreas Kohlbecker
|
}
|
58 |
939d3bb4
|
Andreas Kohlbecker
|
$out .= '</ul>';
|
59 |
|
|
|
60 |
|
|
// ------- footnotes ------- //
|
61 |
fea89e38
|
Andreas Kohlbecker
|
$out .= '<ul class="footnotes">';
|
62 |
d8069342
|
Andreas Kohlbecker
|
$out .= render_annotation_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
63 |
|
|
$out .= render_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
64 |
939d3bb4
|
Andreas Kohlbecker
|
$out .= '</ul>';
|
65 |
|
|
|
66 |
fea89e38
|
Andreas Kohlbecker
|
$out .= '</div>';
|
67 |
6657531f
|
Andreas Kohlbecker
|
|
68 |
|
|
RenderHints::popFromRenderStack();
|
69 |
|
|
return $out;
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
/**
|
73 |
15b7c460
|
Andreas Kohlbecker
|
* Renders the homotypic synonymy group for the accepted taxon in the synonymy.
|
74 |
|
|
*
|
75 |
|
|
* Foonotes of the accepted taxon will also be rendered here in the
|
76 |
|
|
* homotypic synonymy group even if the synonymList or prependedSynonyms are
|
77 |
|
|
* empty. Therefore the homotypic group and accepted taxon share the same
|
78 |
|
|
* footnote key.
|
79 |
|
|
*
|
80 |
|
|
* @param $variables
|
81 |
|
|
* an associative array:
|
82 |
|
|
* - synonymList: the list of cdm Synonym entities
|
83 |
|
|
* - accepted_taxon_uuid: the uuid of the accepted taxon
|
84 |
|
|
* - prependedSynonyms: further synonyms which should be prepended
|
85 |
|
|
* before the actual list of synonyms
|
86 |
6657531f
|
Andreas Kohlbecker
|
*/
|
87 |
|
|
function theme_cdm_homotypicSynonymyGroup($variables) {
|
88 |
|
|
$synonymList = $variables['synonymList'];
|
89 |
2b7cd6c2
|
Andreas Kohlbecker
|
$accepted_taxon_name_uuid = $variables['accepted_taxon_name_uuid'];
|
90 |
6657531f
|
Andreas Kohlbecker
|
$prependedSynonyms = $variables['prependedSynonyms'];
|
91 |
15b7c460
|
Andreas Kohlbecker
|
|
92 |
6657531f
|
Andreas Kohlbecker
|
RenderHints::pushToRenderStack('homotypicSynonymyGroup');
|
93 |
|
|
|
94 |
b059b449
|
Andreas Kohlbecker
|
$type_designations_in_group = NULL;
|
95 |
6657531f
|
Andreas Kohlbecker
|
|
96 |
15b7c460
|
Andreas Kohlbecker
|
$out = '<div class="homotypic-synonymy-group">';
|
97 |
|
|
|
98 |
5f188298
|
Andreas Kohlbecker
|
$type_designations = type_designations_for_synonymy_group($synonymList, $accepted_taxon_name_uuid);
|
99 |
94a882ee
|
Andreas Kohlbecker
|
|
100 |
|
|
if (count($type_designations) > 0 || is_array($prependedSynonyms) || is_array($synonymList)) {
|
101 |
b5519d3a
|
Andreas Kohlbecker
|
$out .= '<ul class="homotypicSynonyms">';
|
102 |
867d1f58
|
Andreas Kohlbecker
|
if (!empty($prependedSynonyms)) {
|
103 |
|
|
foreach ($prependedSynonyms as $taxon) {
|
104 |
|
|
$out .= '<li class="synonym">' . cdm_related_taxon($taxon, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
|
105 |
|
|
}
|
106 |
b5519d3a
|
Andreas Kohlbecker
|
}
|
107 |
b059b449
|
Andreas Kohlbecker
|
|
108 |
867d1f58
|
Andreas Kohlbecker
|
if (isset($synonymList[0])) {
|
109 |
|
|
foreach ($synonymList as $synonym) {
|
110 |
|
|
$out .= '<li class="synonym">' . cdm_related_taxon($synonym, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
|
111 |
|
|
}
|
112 |
b5519d3a
|
Andreas Kohlbecker
|
}
|
113 |
2b7cd6c2
|
Andreas Kohlbecker
|
|
114 |
867d1f58
|
Andreas Kohlbecker
|
if (count($type_designations) > 0) {
|
115 |
|
|
$out .= render_type_designations($type_designations);
|
116 |
|
|
}
|
117 |
6657531f
|
Andreas Kohlbecker
|
|
118 |
|
|
}
|
119 |
|
|
|
120 |
fea89e38
|
Andreas Kohlbecker
|
$out .= '</ul>';
|
121 |
|
|
|
122 |
|
|
// ------- footnotes ------- //
|
123 |
15b7c460
|
Andreas Kohlbecker
|
|
124 |
|
|
// all foonotes of the homotypic group and also of the accepted taxon are
|
125 |
|
|
// rendered here, both should have the same footnote key
|
126 |
fea89e38
|
Andreas Kohlbecker
|
$out .= '<ul class="footnotes">';
|
127 |
d8069342
|
Andreas Kohlbecker
|
$out .= render_annotation_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
128 |
|
|
$out .= render_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
129 |
6657531f
|
Andreas Kohlbecker
|
$out .= '</ul>';
|
130 |
|
|
|
131 |
fea89e38
|
Andreas Kohlbecker
|
$out .= '</div>';
|
132 |
|
|
|
133 |
|
|
|
134 |
6657531f
|
Andreas Kohlbecker
|
RenderHints::popFromRenderStack();
|
135 |
|
|
return $out;
|
136 |
|
|
}
|