1
|
<?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
|
$homotypical_group = $variables['homotypicalGroup'];
|
34
|
RenderHints::pushToRenderStack('heterotypicSynonymyGroup');
|
35
|
|
36
|
$out = '';
|
37
|
$out = '<div class="heterotypic-synonymy-group"><ul class="heterotypicSynonymyGroup">';
|
38
|
$footnoteListKey = (isset($homotypical_group[0]) ? $homotypical_group[0]->uuid : 'NULL');
|
39
|
RenderHints::setFootnoteListKey($footnoteListKey);
|
40
|
|
41
|
$type_designations= type_designations_for_synonymy_group($homotypical_group);
|
42
|
|
43
|
$is_first_entry = TRUE;
|
44
|
foreach ($homotypical_group as $synonym) {
|
45
|
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
|
if (count($type_designations) > 0) {
|
56
|
$out .= render_type_designations($type_designations);
|
57
|
}
|
58
|
$out .= '</ul>';
|
59
|
|
60
|
// ------- footnotes ------- //
|
61
|
$out .= '<ul class="footnotes">';
|
62
|
$out .= render_annotation_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
63
|
$out .= render_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
64
|
$out .= '</ul>';
|
65
|
|
66
|
$out .= '</div>';
|
67
|
|
68
|
RenderHints::popFromRenderStack();
|
69
|
return $out;
|
70
|
}
|
71
|
|
72
|
/**
|
73
|
* 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
|
*/
|
87
|
function theme_cdm_homotypicSynonymyGroup($variables) {
|
88
|
$synonymList = $variables['synonymList'];
|
89
|
$accepted_taxon_name_uuid = $variables['accepted_taxon_name_uuid'];
|
90
|
$prependedSynonyms = $variables['prependedSynonyms'];
|
91
|
|
92
|
RenderHints::pushToRenderStack('homotypicSynonymyGroup');
|
93
|
|
94
|
$type_designations_in_group = NULL;
|
95
|
|
96
|
$out = '<div class="homotypic-synonymy-group">';
|
97
|
|
98
|
$type_designations = type_designations_for_synonymy_group($synonymList, $accepted_taxon_name_uuid);
|
99
|
|
100
|
if (count($type_designations) > 0 || is_array($prependedSynonyms) || is_array($synonymList)) {
|
101
|
$out .= '<ul class="homotypicSynonyms">';
|
102
|
if (!empty($prependedSynonyms)) {
|
103
|
foreach ($prependedSynonyms as $taxon) {
|
104
|
$out .= '<li class="synonym">' . cdm_related_taxon($taxon, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
|
105
|
}
|
106
|
}
|
107
|
|
108
|
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
|
}
|
113
|
|
114
|
if (count($type_designations) > 0) {
|
115
|
$out .= render_type_designations($type_designations);
|
116
|
}
|
117
|
|
118
|
}
|
119
|
|
120
|
$out .= '</ul>';
|
121
|
|
122
|
// ------- footnotes ------- //
|
123
|
|
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
|
$out .= '<ul class="footnotes">';
|
127
|
$out .= render_annotation_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
128
|
$out .= render_footnotes(RenderHints::getFootnoteListKey(), 'li');
|
129
|
$out .= '</ul>';
|
130
|
|
131
|
$out .= '</div>';
|
132
|
|
133
|
|
134
|
RenderHints::popFromRenderStack();
|
135
|
return $out;
|
136
|
}
|