80 |
80 |
$typeDesignation_footnotes = FALSE;
|
81 |
81 |
$is_lectotype = FALSE;
|
82 |
82 |
$specimen_type_designations = array();
|
|
83 |
$name_type_designations = array();
|
|
84 |
$textual_type_designations = array();
|
83 |
85 |
$separator = ',';
|
84 |
86 |
|
85 |
87 |
foreach ($type_designations as $type_designation) {
|
86 |
|
if ($type_designation->class == 'SpecimenTypeDesignation') {
|
87 |
|
// --> SpecimenTypeDesignations should be ordered. Collect theme here only.
|
88 |
|
$specimen_type_designations[] = $type_designation;
|
|
88 |
switch ($type_designation->class) {
|
|
89 |
case 'SpecimenTypeDesignation':
|
|
90 |
$specimen_type_designations[] = $type_designation;
|
|
91 |
break;
|
|
92 |
case 'NameTypeDesignation':
|
|
93 |
$name_type_designations[] = $type_designation;
|
|
94 |
break;
|
|
95 |
case 'TextualTypeDesignation':
|
|
96 |
$textual_type_designations[] = $type_designation;
|
|
97 |
break;
|
|
98 |
default: throw new Exception('Unknown type designation class');
|
89 |
99 |
}
|
90 |
|
else {
|
91 |
|
// --> NameTypeDesignations
|
92 |
|
// It is a lectotype?
|
93 |
|
if (isset($type_designation->typeStatus->uuid) && $type_designation->typeStatus->uuid == UUID_NTD_LECTOTYPE) {
|
94 |
|
$is_lectotype = TRUE;
|
95 |
|
}
|
96 |
|
if ($type_designation->notDesignated) {
|
97 |
|
$out .= '<'. $element_tag .' class="' . html_class_attribute_ref($type_designation) . '"><span class="type-status">' . ($is_lectotype ? 'Lectotype' : 'Type') . '</span>: ' . t('not designated') . '</'. $element_tag .'>';
|
|
100 |
}
|
|
101 |
|
|
102 |
// NameTypeDesignation ..................................
|
|
103 |
if(!empty($name_type_designations)){
|
|
104 |
uksort($name_type_designations, "compare_type_designation_status");
|
|
105 |
foreach($name_type_designations as $name_type_designation){
|
|
106 |
if ($name_type_designation->notDesignated) {
|
|
107 |
$out .= '<'. $element_tag .' class="' . html_class_attribute_ref($name_type_designation) . '">' . type_designation_status_label_markup($name_type_designation) . ': '
|
|
108 |
. t('not designated') . '</'. $element_tag .'>';
|
98 |
109 |
}
|
99 |
|
elseif ($type_designation->typeName) {
|
100 |
|
$link_to_name_page = url(path_to_name($type_designation->typeName->uuid));
|
101 |
|
$out .= '<'. $element_tag .' class="' . html_class_attribute_ref($type_designation) . '"><span class="type-status">' . ($is_lectotype ? 'Lectotype' : 'Type') . '</span>';
|
|
110 |
elseif ($name_type_designation->typeName) {
|
|
111 |
$link_to_name_page = url(path_to_name($name_type_designation->typeName->uuid));
|
|
112 |
$out .= '<'. $element_tag .' class="' . html_class_attribute_ref($name_type_designation) . '">' . type_designation_status_label_markup($name_type_designation) ;
|
102 |
113 |
|
103 |
|
if ($type_designation->citation) {
|
104 |
|
$out .= type_designation_citation_layout($type_designation, $separator);
|
|
114 |
if ($name_type_designation->citation) {
|
|
115 |
$out .= type_designation_citation_layout($name_type_designation, $separator); // TODO type_designation_citation_layout() needs most probably to be replaced
|
105 |
116 |
|
106 |
117 |
}
|
107 |
118 |
$referenceUri = '';
|
108 |
|
if (isset($type_designation->typeName->nomenclaturalReference)) {
|
109 |
|
$referenceUri = url(path_to_reference($type_designation->typeName->nomenclaturalReference->uuid));
|
|
119 |
if (isset($name_type_designation->typeName->nomenclaturalReference)) {
|
|
120 |
$referenceUri = url(path_to_reference($name_type_designation->typeName->nomenclaturalReference->uuid));
|
110 |
121 |
}
|
111 |
|
$out .= ': ' . render_taxon_or_name($type_designation->typeName, $link_to_name_page, $referenceUri, TRUE, TRUE);
|
|
122 |
$out .= ': ' . render_taxon_or_name($name_type_designation->typeName, $link_to_name_page, $referenceUri, TRUE, TRUE);
|
112 |
123 |
}
|
113 |
124 |
}
|
114 |
|
}
|
|
125 |
} // END NameTypeDesignation
|
115 |
126 |
|
|
127 |
// SpecimenTypeDesignation ...................................
|
116 |
128 |
if (!empty($specimen_type_designations)) {
|
117 |
|
// Sorting might be different for dataportals so this has to be
|
118 |
|
// parameterized.
|
119 |
129 |
usort($specimen_type_designations, "compare_specimen_type_designation");
|
120 |
|
foreach ($specimen_type_designations as $type_designation) {
|
121 |
|
$typeReference = '';
|
|
130 |
foreach ($specimen_type_designations as $specimen_type_designation) {
|
|
131 |
$type_citation_markup = '';
|
122 |
132 |
|
123 |
|
if (!empty($type_designation->citation)) {
|
|
133 |
if (!empty($specimen_type_designation->citation)) {
|
124 |
134 |
|
125 |
|
$citation_footnote_str = theme('cdm_reference', array('reference' => $type_designation->citation, 'doIconLink' => true));
|
126 |
|
$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $type_designation->citation->uuid);
|
|
135 |
$citation_footnote_str = theme('cdm_reference', array('reference' => $specimen_type_designation->citation, 'doIconLink' => true));
|
|
136 |
$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $specimen_type_designation->citation->uuid);
|
127 |
137 |
|
128 |
138 |
if (isset($author_team->titleCache)) {
|
129 |
|
$year = @timePeriodToString($type_designation->citation->datePublished, true, 'YYYY');
|
|
139 |
$year = @timePeriodToString($specimen_type_designation->citation->datePublished, true, 'YYYY');
|
130 |
140 |
$authorteam_str = $author_team->titleCache . ($year ? ' ' : '') . $year;
|
131 |
|
if ($authorteam_str == $type_designation->citation->titleCache) {
|
|
141 |
if ($authorteam_str == $specimen_type_designation->citation->titleCache) {
|
132 |
142 |
$citation_footnote_str = '';
|
133 |
143 |
}
|
134 |
144 |
} else {
|
... | ... | |
137 |
147 |
$citation_footnote_str = '';
|
138 |
148 |
}
|
139 |
149 |
|
140 |
|
// to be registered a typedesignation MUS HAVE a citation, so it is save to handle the
|
|
150 |
// for being registered a typedesignation MUST HAVE a citation, so it is save to handle the
|
141 |
151 |
// Registration output in if condition checking if the citation is present
|
142 |
|
$registration_markup = render_registrations($type_designation->registrations);
|
|
152 |
$registration_markup = render_registrations($specimen_type_designation->registrations);
|
143 |
153 |
$citation_footnote_str .= ($citation_footnote_str ? ' ' : '') . $registration_markup;
|
144 |
154 |
|
145 |
155 |
$footnote_key_markup = '';
|
... | ... | |
156 |
166 |
|
157 |
167 |
}
|
158 |
168 |
|
159 |
|
$typeReference .= ' (' . t('designated by') . ' <span class="typeReference">' . $authorteam_str . '</span>';
|
160 |
|
if (!empty($type_designation->citationMicroReference)) {
|
161 |
|
$typeReference .= ': ' . trim($type_designation->citationMicroReference);
|
|
169 |
$type_citation_markup .= ' (' . t('designated by') . ' <span class="typeReference">' . $authorteam_str . '</span>';
|
|
170 |
if (!empty($specimen_type_designation->citationMicroReference)) {
|
|
171 |
$type_citation_markup .= ': ' . trim($specimen_type_designation->citationMicroReference);
|
162 |
172 |
}
|
163 |
|
$typeReference .= $footnote_key_markup . ')';
|
|
173 |
$type_citation_markup .= $footnote_key_markup . ')';
|
164 |
174 |
|
165 |
175 |
}
|
166 |
176 |
|
167 |
|
$out .= '<'. $element_tag .' class="' . html_class_attribute_ref($type_designation) . '">';
|
168 |
|
$out .= '<span class="type-status">'
|
169 |
|
. ((isset($type_designation->typeStatus->representation_L10n)) ? $type_designation->typeStatus->representation_L10n : t('Type')) . '</span>'
|
170 |
|
. $typeReference;
|
|
177 |
$out .= '<'. $element_tag .' class="' . html_class_attribute_ref($specimen_type_designation) . '">';
|
|
178 |
$out .= type_designation_status_label_markup($specimen_type_designation) . $type_citation_markup;
|
171 |
179 |
|
172 |
180 |
|
173 |
181 |
$derivedUnitFacadeInstance = null;
|
174 |
|
if (isset($type_designation->typeSpecimen)) {
|
175 |
|
$derivedUnitFacadeInstance = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, $type_designation->typeSpecimen->uuid);
|
|
182 |
if (isset($specimen_type_designation->typeSpecimen)) {
|
|
183 |
$derivedUnitFacadeInstance = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, $specimen_type_designation->typeSpecimen->uuid);
|
176 |
184 |
}
|
177 |
185 |
|
178 |
186 |
if (isset($derivedUnitFacadeInstance->titleCache)) {
|
179 |
187 |
$specimen_markup = $derivedUnitFacadeInstance->titleCache;
|
180 |
188 |
if($link_to_specimen_page && isset($derivedUnitFacadeInstance->specimenLabel) && $derivedUnitFacadeInstance->specimenLabel){
|
181 |
|
$specimen_markup = str_replace($derivedUnitFacadeInstance->specimenLabel, l($derivedUnitFacadeInstance->specimenLabel, path_to_specimen($type_designation->typeSpecimen->uuid)), $specimen_markup);
|
|
189 |
$specimen_markup = str_replace($derivedUnitFacadeInstance->specimenLabel, l($derivedUnitFacadeInstance->specimenLabel, path_to_specimen($specimen_type_designation->typeSpecimen->uuid)), $specimen_markup);
|
182 |
190 |
}
|
183 |
|
$out .= ': <span class="' . html_class_attribute_ref($type_designation->typeSpecimen) . '">'
|
|
191 |
$out .= ': <span class="' . html_class_attribute_ref($specimen_type_designation->typeSpecimen) . '">'
|
184 |
192 |
. $specimen_markup
|
185 |
193 |
. '</span>'; // . ': ' . theme('cdm_specimen', array('specimenTypeDesignation' => $derivedUnitFacadeInstance));
|
186 |
194 |
if(isset($derivedUnitFacadeInstance->preferredStableUri)){
|
... | ... | |
188 |
196 |
}
|
189 |
197 |
}
|
190 |
198 |
|
191 |
|
// Footnotes for collection acronyms.
|
192 |
|
// footnotes should be rendered in the parent element so we
|
193 |
|
// are relying on the FootnoteListKey set there
|
194 |
|
$_fkey = FootnoteManager::addNewFootnote(
|
195 |
|
RenderHints::getFootnoteListKey(),
|
196 |
|
(isset($derivedUnitFacadeInstance->collection->titleCache) ? $derivedUnitFacadeInstance->collection->titleCache : FALSE)
|
197 |
|
);
|
198 |
|
$out .= theme('cdm_footnote_key', array('footnoteKey' => $_fkey, 'separator' => $separator));
|
|
199 |
|
199 |
200 |
$out .= '</'. $element_tag .'>';
|
200 |
201 |
|
201 |
202 |
}
|
|
203 |
} // END Specimen type designations
|
|
204 |
|
|
205 |
// TextualTypeDesignation .........................
|
|
206 |
if(!empty($textual_type_designations)) {
|
|
207 |
foreach ($textual_type_designations as $textual_type_designation) {
|
|
208 |
$encasement = $textual_type_designation->verbatim ? '"' : '';
|
|
209 |
$out .= '<' . $element_tag . ' class="' . html_class_attribute_ref($textual_type_designation) . '">' . type_designation_status_label_markup(null)
|
|
210 |
. ': ' . $encasement . $textual_type_designation->text_L10n->text . $encasement . '</' . $element_tag . '>';
|
|
211 |
$annotations_and_sources = handle_annotations_and_sources(
|
|
212 |
$textual_type_designation,
|
|
213 |
array(
|
|
214 |
'sources_as_content' => false, // as footnotes
|
|
215 |
'link_to_name_used_in_source' => false,
|
|
216 |
'link_to_reference' => true,
|
|
217 |
'add_footnote_keys' => false,
|
|
218 |
'bibliography_aware' => false),
|
|
219 |
'',
|
|
220 |
RenderHints::getFootnoteListKey() // passing a defined key to avoid separate annotation footnote key see https://dev.e-taxonomy.eu/redmine/issues/8543
|
|
221 |
);
|
|
222 |
$out .= $annotations_and_sources['foot_note_keys'];
|
|
223 |
if(is_array( $annotations_and_sources['source_references'])){
|
|
224 |
$citation_markup = join(', ', $annotations_and_sources['source_references']);
|
|
225 |
}
|
|
226 |
}
|
202 |
227 |
}
|
203 |
228 |
|
|
229 |
// Footnotes for citations, collection acronym?s.
|
|
230 |
// footnotes should be rendered in the parent element so we
|
|
231 |
// are relying on the FootnoteListKey set there
|
|
232 |
$_fkey = FootnoteManager::addNewFootnote(
|
|
233 |
RenderHints::getFootnoteListKey(),
|
|
234 |
(isset($derivedUnitFacadeInstance->collection->titleCache) ? $derivedUnitFacadeInstance->collection->titleCache : FALSE)
|
|
235 |
);
|
|
236 |
$out .= theme('cdm_footnote_key', array('footnoteKey' => $_fkey, 'separator' => $separator));
|
204 |
237 |
$out .= '</' . $enclosing_tag .'>';
|
205 |
238 |
|
206 |
239 |
RenderHints::popFromRenderStack();
|
... | ... | |
208 |
241 |
return $out;
|
209 |
242 |
}
|
210 |
243 |
|
|
244 |
/**
|
|
245 |
* 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"
|
|
246 |
*
|
|
247 |
* @param $type_designation
|
|
248 |
* @return string
|
|
249 |
*/
|
|
250 |
function type_designation_status_label_markup($type_designation)
|
|
251 |
{
|
|
252 |
return '<span class="type-status">'
|
|
253 |
. ((isset($type_designation->typeStatus->representation_L10n)) ? $type_designation->typeStatus->representation_L10n : t('Type')) . '</span>'
|
|
254 |
;
|
|
255 |
}
|
|
256 |
|
211 |
257 |
|
212 |
258 |
/**
|
213 |
259 |
* @todo Please document this function.
|
ref #8134 displaying textual type designations in the taxon synonymy and in the name page