Revision 30c5a6bd
Added by Andreas Kohlbecker about 15 years ago
modules/cdm_dataportal/cdm_dataportal.theme.php | ||
---|---|---|
47 | 47 |
*/ |
48 | 48 |
function tagNameParts($name, $numOfNameTokens){ |
49 | 49 |
|
50 |
|
|
51 | 50 |
$out = '<span class="name">'; |
52 | 51 |
|
53 | 52 |
$token = strtok($name, " \n\t"); |
... | ... | |
94 | 93 |
* TODO it should be configurable which objects can be annotated as this might differ in dataportals |
95 | 94 |
* |
96 | 95 |
*/ |
97 |
function theme_cdm_annotation($baseTO){
|
|
98 |
if(!$baseTO->uuid){
|
|
96 |
function theme_cdm_annotation($cdmBase){
|
|
97 |
if(!$cdmBase->uuid){
|
|
99 | 98 |
return; |
100 | 99 |
}else{ |
101 | 100 |
|
102 |
|
|
103 | 101 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/cdm_annotations.js'); |
104 | 102 |
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/jquery.form.js'); |
105 | 103 |
|
106 |
$annotatableUuid = $baseTO->uuid; |
|
104 |
$annotatableUuid = $cdmBase->uuid; |
|
105 |
//FIXME annotations only available as property of e.g. taxon, name, ... |
|
107 | 106 |
$annotationUrl = cdm_compose_url(CDM_WS_ANNOTATIONS, array($annotatableUuid)); |
108 | 107 |
|
109 | 108 |
$annotationProxyUrl = url('cdm_api/proxy/'. urlencode($annotationUrl).'/cdm_annotation_content'); |
... | ... | |
171 | 170 |
* @param NameTO $nameTO the taxon name |
172 | 171 |
* @param $displayNomRef values are 'LINK', 'PLAIN', 'HIDE' = FALSE |
173 | 172 |
*/ |
174 |
function theme_cdm_name($nameTO, $displayAuthor = true, $displayNomRef = true, $displayStatus = true, $displayDescription = true, $nomRefLink = true){
|
|
173 |
function theme_cdm_name($name, $displayAuthor = true, $displayNomRef = true, $displayStatus = true, $displayDescription = true, $nomRefLink = true){ |
|
175 | 174 |
|
176 |
if(!$nameTO){
|
|
175 |
if(!$name){ |
|
177 | 176 |
return '<span class="error">Invalid $nameTO in theme_cdm_name()</span>'; |
178 | 177 |
} |
179 | 178 |
|
... | ... | |
186 | 185 |
$taxonname_type = (variable_get('cdm_taxonname_type', 'BotanicalName')); |
187 | 186 |
$class = 'taxonname taxonname_'.strtolower($taxonname_type); |
188 | 187 |
|
189 |
$hasNomRef = $nameTO->nomenclaturalReference->fullCitation;
|
|
188 |
$hasNomRef = !empty($name->nomenclaturalReference->titleCache);
|
|
190 | 189 |
|
191 |
if(!$nameTO->taggedName || !count($nameTO->taggedName)){
|
|
192 |
$out .= '<span class="'.$class.'">'.$nameTO->fullname.'</span>';
|
|
190 |
if(!$name->taggedTitle || !count($name->taggedTitle)){
|
|
191 |
$out .= '<span class="'.$class.'">'.$name->titleCache.'</span>';
|
|
193 | 192 |
} else { |
194 | 193 |
$skip = $hasNomRef ? array('reference') : array(); |
195 | 194 |
if(!$displayAuthor || $taxonname_type == 'ZoologicalName') { |
196 | 195 |
$skip[] = 'authors'; |
197 | 196 |
} |
198 |
$out .= '<span class="'.$class.'">'.theme('cdm_taggedtext2html', $nameTO->taggedName, 'span', ' ', $skip).'</span>';
|
|
197 |
$out .= '<span class="'.$class.'">'.theme('cdm_taggedtext2html', $name->taggedTitle, 'span', ' ', $skip).'</span>';
|
|
199 | 198 |
} |
200 | 199 |
|
201 | 200 |
if($displayNomRef && $hasNomRef){ |
202 | 201 |
$out .= '<span class="reference">'; |
203 |
$out .= theme('cdm_nomenclaturalReferenceSTO', $nameTO->nomenclaturalReference, $nomRefLink);
|
|
202 |
$out .= theme('cdm_nomenclaturalReferenceSTO', $name->nomenclaturalReference, $nomRefLink); |
|
204 | 203 |
$out .= '</span>'; |
205 | 204 |
} |
206 | 205 |
|
207 | 206 |
if($displayStatus){ |
208 |
if(isset($nameTO->status[0])){
|
|
209 |
foreach($nameTO->status as $key => $status){
|
|
210 |
$out .= ', '.$status->term;
|
|
207 |
if(isset($name->status[0])){ |
|
208 |
foreach($name->status as $status){
|
|
209 |
$out .= ', '.$status->type->representation_L10n;
|
|
211 | 210 |
} |
212 | 211 |
} |
213 | 212 |
} |
214 | 213 |
|
215 | 214 |
// render protologues etc... |
216 |
if($displayDescription && !empty($nameTO->descriptions)){ |
|
217 |
foreach($nameTO->descriptions as $DescriptionTO){ |
|
218 |
if(!empty($DescriptionTO)){ |
|
219 |
foreach($DescriptionTO->elements as $DescriptionElementSTO){ |
|
220 |
$out .= theme("cdm_media", $DescriptionElementSTO, array('application/pdf', 'image/png', 'image/jpeg', 'image/gif', 'text/html')); |
|
215 |
//FIXME if($displayDescription && !isset($name->descriptions) => get'em from web service .. |
|
216 |
if($displayDescription && !empty($name->descriptions)){ |
|
217 |
foreach($name->descriptions as $description){ |
|
218 |
if(!empty($description)){ |
|
219 |
foreach($description->elements as $description_element){ |
|
220 |
$out .= theme("cdm_media", $description_element, array('application/pdf', 'image/png', 'image/jpeg', 'image/gif', 'text/html')); |
|
221 | 221 |
} |
222 | 222 |
} |
223 | 223 |
} |
... | ... | |
229 | 229 |
return $out; |
230 | 230 |
} |
231 | 231 |
|
232 |
function theme_cdm_media($DescriptionElementSTO, $mimeTypePreference){
|
|
232 |
function theme_cdm_media($descriptionElement, $mimeTypePreference){
|
|
233 | 233 |
$out = ""; |
234 | 234 |
|
235 | 235 |
_add_js_thickbox(); |
236 | 236 |
|
237 |
$uuid = $DescriptionElementSTO->uuid;
|
|
238 |
$type = $DescriptionElementSTO->mediaType;
|
|
239 |
$medias = $DescriptionElementSTO->media;
|
|
237 |
$uuid = $descriptionElement->uuid;
|
|
238 |
$feature = $descriptionElement->type;
|
|
239 |
$medias = $descriptionElement->media;
|
|
240 | 240 |
|
241 | 241 |
foreach($medias as $media){ |
242 | 242 |
|
243 | 243 |
$prefRepresentations = cdm_preferred_media_representations($media, $mimeTypePreference, 300, 400); |
244 |
$representation_inline = array_shift($prefRepresentations);
|
|
245 |
if($representation_inline) {
|
|
244 |
$mediaRepresentation = array_shift($prefRepresentations);
|
|
245 |
if($mediaRepresentation) {
|
|
246 | 246 |
|
247 |
$contentTypeDirectory = substr($representation_inline->mimeType, 0, stripos($representation_inline->mimeType, '/'));
|
|
247 |
$contentTypeDirectory = substr($mediaRepresentation->mimeType, 0, stripos($mediaRepresentation->mimeType, '/'));
|
|
248 | 248 |
|
249 |
$out = theme('cdm_media_mime_' . $contentTypeDirectory, $representation_inline, $type);
|
|
249 |
$out = theme('cdm_media_mime_' . $contentTypeDirectory, $mediaRepresentation, $feature);
|
|
250 | 250 |
|
251 |
// $attributes = array('class'=>'thickbox', 'rel'=>'descriptionElement-'.$uuid, 'title'=>$type->term);
|
|
252 |
// for($i = 0; $part = $representation_inline->representationParts[$i]; $i++){
|
|
251 |
// $attributes = array('class'=>'thickbox', 'rel'=>'descriptionElement-'.$uuid, 'title'=>$feature->term);
|
|
252 |
// for($i = 0; $part = $mediaRepresentation->representationParts[$i]; $i++){
|
|
253 | 253 |
// if($i == 0){ |
254 |
// $image_url = drupal_get_path('module', 'cdm_dataportal').'/images/'.$type->term.'-media.png';
|
|
255 |
// $media = '<img src="'.$image_url.'" height="14px" alt="'.$type->term.'" />';
|
|
254 |
// $image_url = drupal_get_path('module', 'cdm_dataportal').'/images/'.$feature->term.'-media.png';
|
|
255 |
// $media = '<img src="'.$image_url.'" height="14px" alt="'.$feature->term.'" />';
|
|
256 | 256 |
// $out .= l($media, $part->uri, $attributes, NULL, NULL, TRUE, TRUE); |
257 | 257 |
// } else { |
258 | 258 |
// $out .= l('', $part->uri, $attributes, NULL, NULL, TRUE); |
... | ... | |
260 | 260 |
// } |
261 | 261 |
} else { |
262 | 262 |
// no media available, so display just the type term |
263 |
$out .= $type->term;
|
|
263 |
$out .= $feature->representation_L10n;
|
|
264 | 264 |
} |
265 | 265 |
} |
266 | 266 |
return $out; |
267 | 267 |
|
268 | 268 |
} |
269 | 269 |
|
270 |
function theme_cdm_mediaTypeTerm($type){
|
|
271 |
$icon_url = drupal_get_path('module', 'cdm_dataportal').'/images/'.$type->term.'-media.png';
|
|
272 |
return '<img src="'.$icon_url.'" height="14px" alt="'.$type->term.'" />';
|
|
270 |
function theme_cdm_mediaTypeTerm($feature){
|
|
271 |
$icon_url = drupal_get_path('module', 'cdm_dataportal').'/images/'.$feature->representation_L10n.'-media.png';
|
|
272 |
return '<img src="'.$icon_url.'" height="14px" alt="'.$feature->representation_L10n.'" />';
|
|
273 | 273 |
} |
274 | 274 |
|
275 |
function theme_cdm_media_mime_application($representation, $type){
|
|
275 |
function theme_cdm_media_mime_application($mediaRepresentation, $feature){
|
|
276 | 276 |
|
277 | 277 |
foreach($representation->representationParts as $part){ |
278 |
$attributes = array('title'=>$type->term, 'target'=>'_blank');
|
|
279 |
$out .= l(theme('cdm_mediaTypeTerm', $type), $part->uri, $attributes, NULL, NULL, TRUE, TRUE);
|
|
278 |
$attributes = array('title'=>$feature->representation_L10n, 'target'=>'_blank');
|
|
279 |
$out .= l(theme('cdm_mediaTypeTerm', $feature), $part->uri, $attributes, NULL, NULL, TRUE, TRUE);
|
|
280 | 280 |
} |
281 | 281 |
return $out; |
282 | 282 |
} |
283 | 283 |
|
284 |
function theme_cdm_media_mime_image($representation, $type){
|
|
284 |
function theme_cdm_media_mime_image($mediaRepresentation, $feature){
|
|
285 | 285 |
$out = ''; |
286 |
$attributes = array('class'=>'thickbox', 'rel'=>'representation-'.$representation->uuid, 'title'=>$type->term);
|
|
286 |
$attributes = array('class'=>'thickbox', 'rel'=>'representation-'.$representation->uuid, 'title'=>$feature->representation_L10n);
|
|
287 | 287 |
for($i = 0; $part = $representation->representationParts[$i]; $i++){ |
288 | 288 |
if($i == 0){ |
289 | 289 |
|
290 |
$out .= l(theme('cdm_mediaTypeTerm', $type), $part->uri, $attributes, NULL, NULL, TRUE, TRUE);
|
|
290 |
$out .= l(theme('cdm_mediaTypeTerm', $feature), $part->uri, $attributes, NULL, NULL, TRUE, TRUE);
|
|
291 | 291 |
} else { |
292 | 292 |
$out .= l('', $part->uri, $attributes, NULL, NULL, TRUE); |
293 | 293 |
} |
... | ... | |
295 | 295 |
return $out; |
296 | 296 |
} |
297 | 297 |
|
298 |
function theme_cdm_media_mime_text($representation, $type){
|
|
298 |
function theme_cdm_media_mime_text($mediaRepresentation, $feature){
|
|
299 | 299 |
|
300 | 300 |
foreach($representation->representationParts as $part){ |
301 |
$attributes = array('title'=>$type->term . t(' link will open in a new window'), 'target'=>'_blank');
|
|
302 |
$out .= l(theme('cdm_mediaTypeTerm', $type), $part->uri, $attributes, NULL, NULL, TRUE, TRUE);
|
|
301 |
$attributes = array('title'=>$feature->representation_L10n . t(' link will open in a new window'), 'target'=>'_blank');
|
|
302 |
$out .= l(theme('cdm_mediaTypeTerm', $feature), $part->uri, $attributes, NULL, NULL, TRUE, TRUE);
|
|
303 | 303 |
} |
304 | 304 |
return $out; |
305 | 305 |
} |
... | ... | |
311 | 311 |
* @param unknown_type $featureTo |
312 | 312 |
* @return unknown |
313 | 313 |
*/ |
314 |
function theme_cdm_descriptionElement_distribution($featureTo){
|
|
314 |
function theme_cdm_descriptionElement_distribution($feature){ |
|
315 | 315 |
|
316 | 316 |
$server = variable_get('cdm_dataportal_geoservice_access_point', false); |
317 | 317 |
|
318 | 318 |
if(!server){ |
319 | 319 |
return "<p>No geoservice specified</p>"; |
320 | 320 |
}else{ |
321 |
$map_data_parameters = '?' . $featureTo->externalResources->geoServiceParameters;
|
|
321 |
$map_data_parameters = '?' .cdm_ws_get(/* FIXME get geoServiceParameters */ );
|
|
322 | 322 |
|
323 | 323 |
$display_width = variable_get('cdm_dataportal_geoservice_display_width', false); |
324 | 324 |
$bounding_box = variable_get('cdm_dataportal_geoservice_bounding_box', false); |
... | ... | |
348 | 348 |
* |
349 | 349 |
* usage: taxon_detail, theme_ptname_link |
350 | 350 |
*/ |
351 |
function theme_cdm_taxon($taxonTO, $displayNomRef = true, $displayStatus = true, $displayDescription = true, $noSecundum = true, $enclosingTag = 'span', $uuidAnchor = TRUE, $nomRefLink = true){
|
|
351 |
function theme_cdm_taxon($taxon, $displayNomRef = true, $displayStatus = true, $displayDescription = true, $noSecundum = true, $enclosingTag = 'span', $uuidAnchor = TRUE, $nomRefLink = true){ |
|
352 | 352 |
|
353 | 353 |
$refSecundum = false; |
354 | 354 |
if(!$noSecundum){ |
355 |
$ref_sec = cdm_ws_get(CDM_WS_SIMPLE_REFERENCE ,$taxonTO->secUuid);
|
|
355 |
$ref_sec = cdm_ws_get(CDM_WS_REFERENCE ,$taxonTO->secUuid); |
|
356 | 356 |
if($ref_sec){ |
357 | 357 |
$refSecundum = str_trunk($ref_sec->fullCitation, 40, '...'); |
358 | 358 |
} |
359 | 359 |
} |
360 |
$out = theme('cdm_name', $taxonTO->name, true, $displayNomRef, $displayStatus, $displayDescription, $nomRefLink);
|
|
360 |
$out = theme('cdm_name', $taxon->name, true, $displayNomRef, $displayStatus, $displayDescription, $nomRefLink); |
|
361 | 361 |
// append secundum information |
362 | 362 |
$out .=($refSecundum ? ' <span class="secundum">sec. '.$refSecundum.'</span>' : ''); |
363 | 363 |
// add uuid anchor |
364 | 364 |
if($uuidAnchor === TRUE){ |
365 |
$out = uuid_anchor($taxonTO->uuid, $out);
|
|
365 |
$out = uuid_anchor($taxon->uuid, $out); |
|
366 | 366 |
} |
367 | 367 |
//TODO: .$ptaxon->namePhrase; |
368 | 368 |
if($enclosingTag){ |
369 |
$out = '<'.$enclosingTag.' class="taxon'.($taxonTO->accepted === true ? ' accepted':'').'">'.$out.'</'.$enclosingTag.'>';
|
|
369 |
$out = '<'.$enclosingTag.' class="taxon'.($taxon->class == "Taxon" ? ' accepted':'').'">'.$out.'</'.$enclosingTag.'>';
|
|
370 | 370 |
} |
371 | 371 |
|
372 | 372 |
return $out; |
... | ... | |
377 | 377 |
* |
378 | 378 |
* @param TaxonTO $taxon |
379 | 379 |
*/ |
380 |
function theme_cdm_taxon_link($taxonTO, $fragment = NULL, $showNomRef = true, $nomRefLink = true){
|
|
380 |
function theme_cdm_taxon_link($taxon, $fragment = NULL, $showNomRef = true, $nomRefLink = true){ |
|
381 | 381 |
|
382 | 382 |
if($fragment){ |
383 | 383 |
$fragment = '#'.$fragment; |
384 | 384 |
} |
385 |
|
|
386 |
if(!$taxon->accepted) {
|
|
385 |
|
|
386 |
if($taxon->class != "Taxon") {
|
|
387 | 387 |
$out = 'ERROR: theme_cdm_taxon_link() - taxon is not accepted'; |
388 | 388 |
} |
389 | 389 |
|
390 | 390 |
if($showNomRef && $nomRefLink){ |
391 | 391 |
// name part as link and reference part as link |
392 |
$name_html = theme('cdm_taxon', $taxonTO, FALSE /*$showNomRef*/, true, false, true, '', FALSE);
|
|
393 |
$out = l($name_html, cdm_dataportal_taxon_path($taxonTO->uuid), array('class'=>'accepted'), null, $fragment, FALSE, TRUE);
|
|
394 |
$out .= theme('cdm_nomenclaturalReferenceSTO', $taxonTO->name->nomenclaturalReference);
|
|
392 |
$name_html = theme('cdm_taxon', $taxon, FALSE /*$showNomRef*/, true, false, true, '', FALSE); |
|
393 |
$out = l($name_html, cdm_dataportal_taxon_path($taxon->uuid), array('class'=>'accepted'), null, $fragment, FALSE, TRUE); |
|
394 |
$out .= theme('cdm_nomenclaturalReferenceSTO', $taxon->name->nomenclaturalReference); |
|
395 | 395 |
} else { |
396 | 396 |
// fullname as link |
397 |
$name_html = theme('cdm_taxon', $taxonTO, $showNomRef, true, false, true, '', FALSE, $nomRefLink);
|
|
398 |
$out = l($name_html, cdm_dataportal_taxon_path($taxonTO->uuid), array('class'=>'accepted'), null, $fragment, FALSE, TRUE);
|
|
397 |
$name_html = theme('cdm_taxon', $taxon, $showNomRef, true, false, true, '', FALSE, $nomRefLink); |
|
398 |
$out = l($name_html, cdm_dataportal_taxon_path($taxon->uuid), array('class'=>'accepted'), null, $fragment, FALSE, TRUE); |
|
399 | 399 |
} |
400 | 400 |
|
401 | 401 |
return $out; |
... | ... | |
406 | 406 |
* |
407 | 407 |
* @param TaxonTO $taxon |
408 | 408 |
*/ |
409 |
function theme_cdm_taxon_misapplied_link($taxonTO, $fragment = NULL, $showNomRef = true){
|
|
409 |
function theme_cdm_taxon_misapplied_link($taxon, $fragment = NULL, $showNomRef = true){ |
|
410 | 410 |
|
411 | 411 |
if($fragment){ |
412 | 412 |
$fragment = '#'.$fragment; |
413 | 413 |
} |
414 | 414 |
|
415 |
if(!$taxon->accepted) {
|
|
415 |
if($taxon->class != "Taxon") {
|
|
416 | 416 |
$out = 'ERROR: theme_cdm_taxon_link() - taxon is not accepted'; |
417 | 417 |
} |
418 | 418 |
|
419 |
$name_html = theme('cdm_taxon', $taxonTO, $showNomRef, true, false, true, '', FALSE);
|
|
419 |
$name_html = theme('cdm_taxon', $taxon, $showNomRef, true, false, true, '', FALSE); |
|
420 | 420 |
$out = '"'; |
421 |
$out .= l($name_html, cdm_dataportal_taxon_path($taxonTO->uuid), array('class'=>'accepted'), null, $fragment, FALSE, TRUE);
|
|
421 |
$out .= l($name_html, cdm_dataportal_taxon_path($taxon->uuid), array('class'=>'accepted'), null, $fragment, FALSE, TRUE); |
|
422 | 422 |
$out .= '"'; |
423 | 423 |
|
424 | 424 |
/* |
... | ... | |
435 | 435 |
* |
436 | 436 |
* @param TaxonTO $taxon |
437 | 437 |
*/ |
438 |
function theme_cdm_synonym_link($taxonTO, $accepted_uuid, $showNomRef = true, $showStatus = true){
|
|
438 |
function theme_cdm_synonym_link($taxon, $accepted_uuid, $showNomRef = true, $showStatus = true){ |
|
439 | 439 |
|
440 |
$name_html = theme('cdm_taxon', $taxonTO, $showNomRef, $showStatus, false, true, '', FALSE); |
|
441 |
$out = l($name_html, cdm_dataportal_taxon_path($accepted_uuid), array('class'=>'synonym'), 'highlite='.$taxonTO->uuid.'&acceptedFor='.$taxonTO->uuid, NULL, FALSE, TRUE); |
|
442 |
|
|
443 |
/* |
|
444 |
if($showNomRef){ |
|
445 |
$out .= theme('cdm_nomenclaturalReferenceSTO', $taxonTO->name->nomenclaturalReference); |
|
446 |
} |
|
447 |
|
|
448 |
if($showStatus){ |
|
449 |
$out .= theme('cdm_nomenclaturalStatusSTO', $taxonTO->name->status, "nomStatus"); |
|
450 |
}*/ |
|
440 |
$name_html = theme('cdm_taxon', $taxon, $showNomRef, $showStatus, false, true, '', FALSE); |
|
441 |
$out = l($name_html, cdm_dataportal_taxon_path($accepted_uuid), array('class'=>'synonym'), 'highlite='.$taxonTO->uuid.'&acceptedFor='.$taxon->uuid, NULL, FALSE, TRUE); |
|
451 | 442 |
|
452 | 443 |
return $out; |
453 | 444 |
} |
454 | 445 |
|
455 | 446 |
|
456 |
function theme_cdm_related_taxon($taxonSTO, $reltype_uuid = '', $displayNomRef = true){
|
|
447 |
function theme_cdm_related_taxon($taxon, $reltype_uuid = '', $displayNomRef = true){ |
|
457 | 448 |
|
458 | 449 |
$relsign = ''; |
459 | 450 |
$name_prefix = ''; |
... | ... | |
476 | 467 |
$relsign = '–'; |
477 | 468 |
} |
478 | 469 |
|
479 |
$out = '<span class="relation_sign">'.$relsign.'</span>'.$name_prefix.theme('cdm_taxon',$taxonSTO, $displayNomRef).$name_postfix;
|
|
470 |
$out = '<span class="relation_sign">'.$relsign.'</span>'.$name_prefix.theme('cdm_taxon',$taxon, $displayNomRef).$name_postfix; |
|
480 | 471 |
return $out; |
481 | 472 |
|
482 | 473 |
} |
483 | 474 |
|
484 |
|
|
475 |
/** |
|
476 |
* will theme form elements of type 'select_secuuid' |
|
477 |
* see $form['cdm_dataportal']['secuuid_widget'] |
|
478 |
* @param FormElement $element |
|
479 |
*/ |
|
485 | 480 |
function theme_select_secuuid($element) { |
486 | 481 |
|
487 | 482 |
$default_uuid = variable_get($element['#varname'], false); |
... | ... | |
526 | 521 |
return $out; |
527 | 522 |
} |
528 | 523 |
|
529 |
function theme_cdm_list_of_taxa($taxonSTOs){ |
|
530 |
|
|
524 |
function theme_cdm_list_of_taxa($taxonPager){ |
|
531 | 525 |
$out = '<ul class="cdm_names" style="background-image: none;">'; |
532 | 526 |
|
533 | 527 |
$synonym_uuids = array(); |
534 |
foreach($taxonSTOs as $taxon){
|
|
528 |
foreach($taxonPager->records as $taxon){
|
|
535 | 529 |
if(!_cdm_dataportal_acceptedByCurrentView($taxon)){ |
536 | 530 |
if(!array_key_exists($taxon->uuid, $synonym_uuids)){ |
537 | 531 |
$synonym_uuids[$taxon->uuid] = $taxon->uuid; |
538 | 532 |
} |
539 | 533 |
} |
540 | 534 |
} |
541 |
$table_of_accepted = cdm_ws_get(CDM_WS_ACCEPTED_TAXON, join(',', $synonym_uuids)); |
|
535 |
// batch service not jet implemented: $table_of_accepted = cdm_ws_property(CDM_WS_TAXON_ACCEPTED, join(',', $synonym_uuids)); |
|
536 |
// thus ... |
|
537 |
$table_of_accepted = array(); |
|
538 |
foreach($synonym_uuids as $synUuid){ |
|
539 |
$table_of_accepted[$synUuid] = cdm_ws_property(CDM_WS_TAXON_ACCEPTED, $synUuid); |
|
540 |
} |
|
541 |
// .. well, for sure not as performant as before, but better than nothing. |
|
542 | 542 |
|
543 |
foreach($taxonSTOs as $taxon){
|
|
543 |
foreach($taxonPager->records as $taxon){
|
|
544 | 544 |
if(_cdm_dataportal_acceptedByCurrentView($taxon)){ |
545 | 545 |
$out .= '<li>'.theme('cdm_taxon_link', $taxon, /*$fragment*/ NULL, /*$showNomRef*/ true, /*$nomRefLink*/ false ).'</li>'; |
546 | 546 |
} else { |
... | ... | |
549 | 549 |
if(count($acceptedTaxa) == 1){ |
550 | 550 |
$out .= '<li>'.theme('cdm_synonym_link', $taxon, $acceptedTaxa[0]->uuid ).'</li>'; |
551 | 551 |
} else { |
552 |
//TODO avoid using AHAH ion the cdm_dynabox
|
|
553 |
$out .= theme('cdm_dynabox', theme('cdm_name', $taxon->name), cdm_compose_url(CDM_WS_ACCEPTED_TAXON, array($taxon->uuid)), 'cdm_list_of_taxa');
|
|
552 |
//TODO avoid using AHAH in the cdm_dynabox |
|
553 |
$out .= theme('cdm_dynabox', theme('cdm_name', $taxon->name), cdm_compose_url(CDM_WS_TAXON_ACCEPTED, array($taxon->uuid)), 'cdm_list_of_taxa');
|
|
554 | 554 |
} |
555 | 555 |
} |
556 | 556 |
} |
... | ... | |
576 | 576 |
} |
577 | 577 |
} |
578 | 578 |
} |
579 |
$table_of_accepted = cdm_ws_get(CDM_WS_ACCEPTED_TAXON, join(',', $synonym_uuids));
|
|
579 |
$table_of_accepted = cdm_ws_get(CDM_WS_TAXON_ACCEPTED, join(',', $synonym_uuids));
|
|
580 | 580 |
*/ |
581 | 581 |
/* |
582 | 582 |
// get the secUuid of the actual taxonomy. |
... | ... | |
610 | 610 |
} |
611 | 611 |
else { |
612 | 612 |
// get accepted taxa for this taxon |
613 |
$table_of_accepted = cdm_ws_get(CDM_WS_ACCEPTED_TAXON, $taxon->uuid);
|
|
613 |
$table_of_accepted = cdm_ws_get(CDM_WS_TAXON_ACCEPTED, $taxon->uuid);
|
|
614 | 614 |
if(count($table_of_accepted) == 1){ |
615 | 615 |
$out .= '<li>'.theme('cdm_synonym_link', $taxon, $table_of_accepted[0]->uuid ).'<li>'; |
616 | 616 |
} |
617 | 617 |
else { |
618 | 618 |
//TODO avoid using AHAH ion the cdm_dynabox |
619 |
$out .= theme('cdm_dynabox', theme('cdm_name', $taxon->name), cdm_compose_url(CDM_WS_ACCEPTED_TAXON, array($taxon->uuid)), 'cdm_list_of_taxa');
|
|
619 |
$out .= theme('cdm_dynabox', theme('cdm_name', $taxon->name), cdm_compose_url(CDM_WS_TAXON_ACCEPTED, array($taxon->uuid)), 'cdm_list_of_taxa');
|
|
620 | 620 |
} |
621 | 621 |
} |
622 | 622 |
} |
... | ... | |
624 | 624 |
return $out;*/ |
625 | 625 |
} |
626 | 626 |
|
627 |
function theme_cdm_alternative_taxa($taxonSTOs){ |
|
628 |
$out = '<ul class="cdm_names" style="background-image: none;">'; |
|
629 |
foreach($taxonSTOs as $taxon){ |
|
630 |
$out .= '<li>'.theme('cdm_taxon_link', $taxon).'</li>'; |
|
631 |
} |
|
632 |
$out .= '</ul>'; |
|
633 |
return $out; |
|
634 |
} |
|
635 |
|
|
636 | 627 |
|
637 | 628 |
function theme_cdm_credits(){ |
638 | 629 |
$secRef_array = _cdm_dataportal_currentSecRef_array(); |
639 | 630 |
return '<span class="sec_reference_citation">'.$secRef_array['citation'].'</span>' |
640 |
.( $secRef_array['year'] ? ' <span class="year">'.$secRef_array['year'].'</span>' : '')
|
|
641 |
.( $secRef_array['authorship'] ? '<div class="author">'.$secRef_array['authorship'].'</div>' : '');
|
|
631 |
.( $secRef_array['period'] ? ' <span class="year">'.partialToYear($secRef_array['period']).'</span>' : '')
|
|
632 |
.( $secRef_array['authorTeam'] ? '<div class="author">'.$secRef_array['authorTeam']['titleCache'].'</div>' : '');
|
|
642 | 633 |
} |
643 | 634 |
|
644 | 635 |
|
645 |
function theme_cdm_fullreference($referenceTO, $link = FALSE){
|
|
636 |
function theme_cdm_fullreference($reference, $link = FALSE){ |
|
646 | 637 |
|
647 |
if($referenceTO->fullCitation){
|
|
648 |
$out = $referenceTO->fullCitation;
|
|
638 |
if($reference->titleCache){
|
|
639 |
$out = $reference->titleCache;
|
|
649 | 640 |
}else{ |
650 |
$out = $referenceTO->authorship;
|
|
641 |
$out = $reference->authorship; |
|
651 | 642 |
} |
652 |
if($referenceTO->microReference){ |
|
653 |
$out .= ' : '.$referenceTO->microReference; |
|
643 |
//FIXME CRAP! nomenclaturalMicroReference is property of the name !!! |
|
644 |
if($reference->microReference){ |
|
645 |
$out .= ' : '.$reference->microReference; |
|
654 | 646 |
} |
655 | 647 |
/* |
656 | 648 |
if($referenceTO->year){ |
... | ... | |
659 | 651 |
*/ |
660 | 652 |
|
661 | 653 |
if($link){ |
662 |
$out = l($out, "/cdm_dataportal/reference/".$referenceTO->uuid, array("class"=>"reference"));
|
|
654 |
$out = l($out, "/cdm_dataportal/reference/".$reference->uuid, array("class"=>"reference")); |
|
663 | 655 |
} |
664 | 656 |
return $out; |
665 | 657 |
} |
... | ... | |
673 | 665 |
* @param unknown_type $enclosingTag |
674 | 666 |
* @return unknown |
675 | 667 |
*/ |
676 |
function theme_cdm_nomenclaturalReferenceSTO($referenceSTO, $doLink = FALSE, $cssClass = '', $separator = '<br />' , $enclosingTag = 'li'){
|
|
668 |
function theme_cdm_nomenclaturalReferenceSTO($reference, $doLink = FALSE, $cssClass = '', $separator = '<br />' , $enclosingTag = 'li'){ |
|
677 | 669 |
|
678 |
if(isset($referenceSTO->microReference)){ |
|
670 |
//FIXME CRAP! nomenclaturalMicroReference is property of the name !!! |
|
671 |
if(isset($reference->microReference)){ |
|
679 | 672 |
// it is a ReferenceTO |
680 |
$nomref_citation = theme('cdm_fullreference', $referenceSTO);
|
|
673 |
$nomref_citation = theme('cdm_fullreference', $reference); |
|
681 | 674 |
} else { |
682 | 675 |
// it is ReferenceSTO |
683 |
$nomref_citation = $referenceSTO->fullCitation;
|
|
676 |
$nomref_citation = $reference->titleCache;
|
|
684 | 677 |
} |
685 | 678 |
|
686 | 679 |
$is_IN_reference = str_beginsWith($nomref_citation, 'in'); |
687 | 680 |
|
688 | 681 |
if($doLink){ |
689 |
$nomref_citation = l($nomref_citation, "/cdm_dataportal/reference/".$referenceSTO->uuid, array(), NULL, NULL, FALSE, TRUE);
|
|
682 |
$nomref_citation = l($nomref_citation, "/cdm_dataportal/reference/".$reference->uuid, array(), NULL, NULL, FALSE, TRUE); |
|
690 | 683 |
} |
691 | 684 |
|
692 | 685 |
if(!empty($nomref_citation)){ |
... | ... | |
696 | 689 |
return $nomref_citation; |
697 | 690 |
} |
698 | 691 |
|
699 |
/** |
|
700 |
* Enter description here... |
|
701 |
* |
|
702 |
* @param unknown_type $statusSTO |
|
703 |
* @param unknown_type $cssClass |
|
704 |
* @param unknown_type $enclosingTag |
|
705 |
* @return unknown |
|
706 |
*/ |
|
707 |
function theme_cdm_nomenclaturalStatusSTO($statusSTO, $cssClass = '', $enclosingTag = 'span'){ |
|
708 |
|
|
709 |
$out = "<$enclosingTag" . ($cssClass == '' ? '' : ' class="' . $cssClass . '"') . ">"; |
|
710 |
foreach ($statusSTO as $status){ |
|
711 |
$out .= ", " . $status->term; |
|
712 |
} |
|
713 |
$out .= "</$enclosingTag>"; |
|
714 |
|
|
715 |
return $out; |
|
716 |
} |
|
717 |
|
|
718 | 692 |
/** |
719 | 693 |
* default title for a taxon page |
720 | 694 |
* |
721 | 695 |
* @param NameTO $nameTO |
722 | 696 |
* @return the formatted taxon name |
723 | 697 |
*/ |
724 |
function theme_cdm_taxon_page_title($nameTO){
|
|
698 |
function theme_cdm_taxon_page_title($name){ |
|
725 | 699 |
|
726 | 700 |
if(variable_get('cdm_dataportal_nomref_in_title', 1)){ |
727 | 701 |
// taxon name only with author and year |
728 |
return theme('cdm_name', $nameTO, TRUE, false, false, false);
|
|
702 |
return theme('cdm_name', $name, TRUE, false, false, false); |
|
729 | 703 |
} else { |
730 |
return theme('cdm_name', $nameTO);
|
|
704 |
return theme('cdm_name', $name); |
|
731 | 705 |
} |
732 | 706 |
} |
733 | 707 |
|
... | ... | |
768 | 742 |
* @param $page_part name of the part to display, |
769 | 743 |
* valid values are: 'description', 'images', 'synonymy', 'all' |
770 | 744 |
*/ |
771 |
function theme_cdm_taxon_page_general($taxonTO, $page_part) {
|
|
745 |
function theme_cdm_taxon_page_general($taxon, $page_part) { |
|
772 | 746 |
|
773 | 747 |
if(!$page_part){ |
774 | 748 |
$page_part = 'description'; |
... | ... | |
781 | 755 |
|
782 | 756 |
if($page_part == 'description' || $page_part == 'all'){ |
783 | 757 |
$out .= '<div id="general">'; |
784 |
$out .= theme('cdm_taxon_page_description', $taxonTO);
|
|
758 |
$out .= theme('cdm_taxon_page_description', $taxon); |
|
785 | 759 |
$out .= '</div>'; |
786 | 760 |
} |
787 | 761 |
|
... | ... | |
790 | 764 |
if($page_part == 'all'){ |
791 | 765 |
$out .= '<h2>'.t('Images').'</h2>'; |
792 | 766 |
} |
793 |
$out .= theme('cdm_taxon_page_images', $taxonTO);
|
|
767 |
$out .= theme('cdm_taxon_page_images', $taxon); |
|
794 | 768 |
$out .= '</div>'; |
795 | 769 |
} |
796 | 770 |
|
... | ... | |
800 | 774 |
$out .= '<h2>'.t('Synonymy').'</h2>'; |
801 | 775 |
} |
802 | 776 |
if(!variable_get('cdm_dataportal_nomref_in_title', 1)){ |
803 |
$out .= theme('cdm_name', $taxonTO->name);
|
|
777 |
$out .= theme('cdm_name', $taxon->name); |
|
804 | 778 |
} |
805 |
$out .= theme('cdm_taxon_page_synonymy', $taxonTO);
|
|
779 |
$out .= theme('cdm_taxon_page_synonymy', $taxon); |
|
806 | 780 |
|
807 | 781 |
if(variable_get('cdm_dataportal_display_name_relations', 1)){ |
808 |
$out .= theme('cdm_nameRelations', $taxonTO->name->nameRelations); |
|
782 |
// TODO is it correct to skip relationsFromThisName since all relationships are to be understood as 'is .... of' |
|
783 |
$out .= theme('cdm_nameRelations', $taxon->name->relationsToThisName); |
|
809 | 784 |
} |
810 | 785 |
$out .= '</div>'; |
811 | 786 |
} |
... | ... | |
818 | 793 |
* accepted taxon. |
819 | 794 |
* |
820 | 795 |
*/ |
821 |
function theme_cdm_taxon_page_description($taxonTO){
|
|
796 |
function theme_cdm_taxon_page_description($taxon){ |
|
822 | 797 |
|
823 | 798 |
// description TOC |
824 |
$out .= theme('cdm_featureTreeToc', $taxonTO->featureTree);
|
|
799 |
$out .= theme('cdm_featureTreeToc', $taxon->featureTree); |
|
825 | 800 |
// description |
826 |
$out .= theme('cdm_featureTree', $taxonTO->featureTree);
|
|
801 |
$out .= theme('cdm_featureTree', $taxon->featureTree); |
|
827 | 802 |
return $out; |
828 | 803 |
} |
829 | 804 |
|
... | ... | |
836 | 811 |
|
837 | 812 |
$out .= theme('cdm_homotypicSynonyms', $taxonTO->homotypicSynonyms, $taxonTO->typeDesignations); |
838 | 813 |
|
839 |
foreach($taxonTO->heterotypicSynonymyGroups as $HomotypicTaxonGroupSTO){
|
|
840 |
$out .= theme('cdm_heterotypicSynonymyGroup', $HomotypicTaxonGroupSTO);
|
|
814 |
foreach($taxonTO->heterotypicSynonymyGroups as $homotypicalGroup){
|
|
815 |
$out .= theme('cdm_heterotypicSynonymyGroup', $homotypicalGroup);
|
|
841 | 816 |
} |
842 | 817 |
$out .= theme('cdm_taxonRelations', $taxonTO->taxonRelations); |
843 | 818 |
|
... | ... | |
1029 | 1004 |
|
1030 | 1005 |
|
1031 | 1006 |
|
1032 |
function theme_cdm_homotypicSynonyms($synonymRelationshipTOs, $typeDesignations = false, $prependedSynonyms = array()){
|
|
1007 |
function theme_cdm_homotypicSynonyms($synonymList, $typeDesignations = false, $prependedSynonyms = array()){
|
|
1033 | 1008 |
|
1034 | 1009 |
$out = ''; |
1035 | 1010 |
$out = '<ul class="homotypicSynonyms">'; |
... | ... | |
1040 | 1015 |
} |
1041 | 1016 |
} |
1042 | 1017 |
|
1043 |
foreach($synonymRelationshipTOs as $synonym){
|
|
1044 |
$out .= '<li class="synonym">'.theme('cdm_related_taxon', $synonym->synonym, UUID_HOMOTYPIC_SYNONYM_OF).'</li>';
|
|
1018 |
foreach($synonymList as $synonym){
|
|
1019 |
$out .= '<li class="synonym">'.theme('cdm_related_taxon', $synonym, UUID_HOMOTYPIC_SYNONYM_OF).'</li>'; |
|
1045 | 1020 |
} |
1046 | 1021 |
if($typeDesignations){ |
1047 | 1022 |
$out .= theme('cdm_typedesignations', $typeDesignations); |
... | ... | |
1051 | 1026 |
return $out; |
1052 | 1027 |
} |
1053 | 1028 |
|
1054 |
function theme_cdm_homotypicSynonymLine($taxonSTO){
|
|
1029 |
function theme_cdm_homotypicSynonymLine($taxon){ |
|
1055 | 1030 |
$out = ''; |
1056 |
$out .= '<li class="synonym">'.theme('cdm_related_taxon', $taxonSTO, UUID_HOMOTYPIC_SYNONYM_OF).'</li>';
|
|
1031 |
$out .= '<li class="synonym">'.theme('cdm_related_taxon', $taxon, UUID_HOMOTYPIC_SYNONYM_OF).'</li>'; |
|
1057 | 1032 |
return $out; |
1058 | 1033 |
} |
1059 | 1034 |
|
1060 |
function theme_cdm_heterotypicSynonymyGroup($HomotypicTaxonGroupSTO){
|
|
1035 |
function theme_cdm_heterotypicSynonymyGroup($homotypicalGroup){
|
|
1061 | 1036 |
$out = ''; |
1062 | 1037 |
$out = '<ul class="heterotypicSynonymyGroup">'; |
1063 | 1038 |
|
1064 | 1039 |
$is_first_entry = true; |
1065 |
foreach($HomotypicTaxonGroupSTO->synonyms as $SynonymRelationshipTO){
|
|
1040 |
foreach($homotypicalGroup as $synonym){
|
|
1066 | 1041 |
if($is_first_entry){ |
1067 | 1042 |
$is_first_entry = false; |
1068 | 1043 |
// is first list entry |
1069 |
$out .= '<li class="firstentry synonym">'.theme('cdm_related_taxon',$SynonymRelationshipTO->synonym, $SynonymRelationshipTO->typeUuid).'</li>';
|
|
1044 |
$out .= '<li class="firstentry synonym">'.theme('cdm_related_taxon',$synonym, UUID_HETEROTYPIC_SYNONYM_OF).'</li>';
|
|
1070 | 1045 |
} else { |
1071 |
$out .= '<li class="synonym">'.theme('cdm_related_taxon',$SynonymRelationshipTO->synonym, UUID_HOMOTYPIC_SYNONYM_OF).'</li>';
|
|
1046 |
$out .= '<li class="synonym">'.theme('cdm_related_taxon',$synonym, UUID_HOMOTYPIC_SYNONYM_OF).'</li>'; |
|
1072 | 1047 |
} |
1073 | 1048 |
} |
1074 | 1049 |
|
1075 |
if(isset($HomotypicTaxonGroupSTO->typeDesignations)){
|
|
1076 |
$out .= theme('cdm_typedesignations', $HomotypicTaxonGroupSTO->typeDesignations);
|
|
1050 |
if(isset($homotypicalGroup->typeDesignations)){
|
|
1051 |
$out .= theme('cdm_typedesignations', $homotypicalGroup->typeDesignations);
|
|
1077 | 1052 |
} |
1078 | 1053 |
|
1079 | 1054 |
$out .= '</ul>'; |
... | ... | |
1111 | 1086 |
foreach($TaxonRelationshipTOs as $taxonRelation){ |
1112 | 1087 |
if(true || $taxonRelation->type->uuid == UUID_MISAPPLIED_NAME_FOR || $taxonRelation->type->uuid == UUID_INVALID_DESIGNATION_FOR ){ |
1113 | 1088 |
|
1114 |
$sensu_reference_list = cdm_ws_get(CDM_WS_SIMPLE_REFERENCE ,$taxonRelation->taxon->secUuid);
|
|
1089 |
$sensu_reference_list = cdm_ws_get(CDM_WS_REFERENCE ,$taxonRelation->taxon->secUuid); |
|
1115 | 1090 |
$sensu_reference = $sensu_reference_list[0]; |
1116 | 1091 |
$name = $taxonRelation->taxon->name->fullname; |
1117 | 1092 |
if(!isset($misapplied[$name])){ |
... | ... | |
1146 | 1121 |
return $out; |
1147 | 1122 |
} |
1148 | 1123 |
|
1149 |
function theme_cdm_nameRelations($NameRelationshipTOs){
|
|
1124 |
function theme_cdm_nameRelations($nameRelationshipList){
|
|
1150 | 1125 |
|
1126 |
//FIXME in contrast to the NameRelationshipTO the cdm NameRelationshipType only references to one Name |
|
1127 |
// => grouping needed! |
|
1151 | 1128 |
$out = ''; |
1152 | 1129 |
|
1153 |
foreach($NameRelationshipTOs as $NameRelationshipTO){
|
|
1130 |
foreach($nameRelationshipList as $nameRelationship){
|
|
1154 | 1131 |
|
1155 | 1132 |
$block->module = 'cdm_dataportal'; |
1156 | 1133 |
|
1157 |
$type = isset($NameRelationshipTO->type->term) ? $NameRelationshipTO->type->term : 'Name relation';
|
|
1134 |
$type = !empty($nameRelationship->type->representation_L10n) ? $nameRelationship->type->representation_L10n : 'Name relation';
|
|
1158 | 1135 |
|
1159 | 1136 |
$block->delta = $type; |
1160 | 1137 |
$block->subject = t(ucfirst($block->delta)); |
... | ... | |
1162 | 1139 |
|
1163 | 1140 |
$block->content = '<ul class="nameRelationships '.$block->delta.'">'; |
1164 | 1141 |
$relatedNames = array(); |
1142 |
/* old stuff .. |
|
1165 | 1143 |
foreach($NameRelationshipTO->relatedNames as $name){ |
1166 | 1144 |
$relatedNames[] = theme('cdm_name', $name); |
1167 | 1145 |
} |
1168 |
|
|
1146 |
new stuff HACK ..*/ |
|
1147 |
$relatedNames[] = theme('cdm_name', $nameRelationship->relatedFrom); |
|
1148 |
|
|
1169 | 1149 |
$block->content .= implode(', ', $relatedNames); |
1170 | 1150 |
|
1171 | 1151 |
$out .= theme('block', $block); |
... | ... | |
1176 | 1156 |
|
1177 | 1157 |
/** |
1178 | 1158 |
* FIXME this definitively has to be in another spot. just didn't know where to put it right now. |
1179 |
* |
|
1180 |
* @param String $a a typeDesignation status
|
|
1181 |
* @param String $b another typeDesignation status
|
|
1159 |
* Compares the status of two SpecimenTypeDesignations
|
|
1160 |
* @param String $a a SpecimenTypeDesignations
|
|
1161 |
* @param String $b another SpecimenTypeDesignations
|
|
1182 | 1162 |
*/ |
1183 | 1163 |
function compare_specimenTypeDesignationStatus($a, $b){ |
1184 | 1164 |
/* this is the desired sort oder as of now: |
... | ... | |
1196 | 1176 |
// make that static for now |
1197 | 1177 |
$typeOrder = array('Holotype', 'Isotype', 'Lectotype', 'Isolectotype', 'Syntype'); |
1198 | 1178 |
|
1199 |
$aQuantifier = array_search($a->status->text, $typeOrder);
|
|
1200 |
$bQuantifier = array_search($b->status->text, $typeOrder);
|
|
1179 |
$aQuantifier = array_search($a->typeStatus->label, $typeOrder);
|
|
1180 |
$bQuantifier = array_search($b->typeStatus->label, $typeOrder);
|
|
1201 | 1181 |
|
1202 | 1182 |
if ($aQuantifier == $bQuantifier) { |
1203 | 1183 |
// sort alphabetically |
1204 |
return ($a->status->text < $b->status->text) ? -1 : 1;
|
|
1184 |
return ($a->typeStatus->label < $b->typeStatus->label) ? -1 : 1;
|
|
1205 | 1185 |
} |
1206 | 1186 |
return ($aQuantifier < $bQuantifier) ? -1 : 1; |
1207 | 1187 |
|
... | ... | |
1213 | 1193 |
|
1214 | 1194 |
$specimenTypeDesignations = array(); |
1215 | 1195 |
foreach($typeDesignations as $variant => $typeDesignation){ |
1216 |
if($typeDesignation->typeSpecimen){ |
|
1217 |
// specimenTypeDesignations should be ordered. collect theme here only |
|
1196 |
if(isset($typeDesignation->typeSpecimen)){ |
|
1197 |
// it's a SpecimenTypeDesignation |
|
1198 |
// SpecimenTypeDesignation should be ordered. collect theme here only |
|
1218 | 1199 |
$specimenTypeDesignations[] = $typeDesignation; |
1219 | 1200 |
}else { |
1201 |
// it's a NameTypeDesignation |
|
1220 | 1202 |
if($typeDesignation->notDesignated){ |
1221 | 1203 |
$out .= '<li class="nameTypeDesignation"><span class="status">Type</span>: '.t('not designated'). '</li>'; |
1222 | 1204 |
}else if($typeDesignation->typeSpeciesName){ |
1223 |
$out .= '<li class="nameTypeDesignation"><span class="status">Type</span>: '.theme('cdm_name', $typeDesignation->typeSpeciesName, false);
|
|
1205 |
$out .= '<li class="nameTypeDesignation"><span class="status">Type</span>: '.theme('cdm_name', $typeDesignation->typeName, false); |
|
1224 | 1206 |
$out .= '</li>'; |
1225 | 1207 |
} |
1226 | 1208 |
} |
... | ... | |
1232 | 1214 |
foreach($specimenTypeDesignations as $std){ |
1233 | 1215 |
|
1234 | 1216 |
$typeReference = ''; |
1235 |
if($std->reference){
|
|
1217 |
if(!empty($std->citation)){
|
|
1236 | 1218 |
$typeReference .= ' (' . t('designated by'); |
1237 |
$typeReference .= ' <span class="typeReference cluetip no-print" title="|'. htmlspecialchars(theme('cdm_fullreference',$std->reference )) .'|">';
|
|
1238 |
$typeReference .= $std->reference->authorship . ' ' . $std->reference->year;
|
|
1219 |
$typeReference .= ' <span class="typeReference cluetip no-print" title="|'. htmlspecialchars(theme('cdm_fullreference',$std->citation )) .'|">';
|
|
1220 |
$typeReference .= $std->citation->authorTeam->titleCache . ' ' . partialToYear($std->citation->datePublished);
|
|
1239 | 1221 |
$typeReference .= '</span>'; |
1240 | 1222 |
$typeReference .= ')'; |
1241 |
$typeReference .= '<span class="reference only-print">(designated by '.theme('cdm_fullreference',$std->reference ).')</span>';
|
|
1223 |
$typeReference .= '<span class="reference only-print">(designated by '.theme('cdm_fullreference',$std->citation ).')</span>';
|
|
1242 | 1224 |
} |
1243 | 1225 |
|
1244 | 1226 |
$out .= '<li class="specimenTypeDesignation">'; |
1245 |
$out .= '<span class="status">'.(($std->status->text) ? $std->status->text : t('Type')) .$typeReference.'</span>: '.$std->typeSpecimen->specimenLabel;
|
|
1227 |
$out .= '<span class="status">'.(($std->typeStatus->representation_L10n) ? $std->typeStatus->representation_L10n : t('Type')) .$typeReference.'</span>: '.$std->typeSpecimen->titleCache;
|
|
1246 | 1228 |
$out .= theme('cdm_specimen', $std->typeSpecimen); |
1247 | 1229 |
$out .= '</li>'; |
1248 | 1230 |
} |
... | ... | |
1277 | 1259 |
//TODO this this is PART 2/2 of a HACK - select preferred representation by mimetype and size |
1278 | 1260 |
// |
1279 | 1261 |
if(true || $representation->mimeType == 'image/jpeg'){ |
1280 |
foreach($representation->representationParts as $part){
|
|
1262 |
foreach($representation->parts as $part){
|
|
1281 | 1263 |
// get media uri conversion rules if the module is installed and activated |
1282 | 1264 |
if(module_exists('cdm_mediauri')){ |
1283 | 1265 |
$muris = cdm_mediauri_conversion($part->uri); |
... | ... | |
1304 | 1286 |
} |
1305 | 1287 |
} |
1306 | 1288 |
$media_row .= '<td><a href="'.$part->uri.'" target="'.$part->uuid.'">'.$a_child.'</a></td>'; |
1307 |
$meta_row .= '<td><span class="label">'.check_plain($specimen->specimenLabel).'</span><div class="webapp">'.$webapp.'</div></td>';
|
|
1289 |
$meta_row .= '<td><span class="label">'.check_plain($specimen->titleCache).'</span><div class="webapp">'.$webapp.'</div></td>';
|
|
1308 | 1290 |
} // END parts |
1309 | 1291 |
//TODO this is PART 2/2 of a hack |
1310 | 1292 |
break; |
... | ... | |
1323 | 1305 |
|
1324 | 1306 |
|
1325 | 1307 |
function theme_cdm_featureTree($featureTree){ |
1308 |
//FIXME |
|
1326 | 1309 |
/* |
1327 | 1310 |
* ->featureTree{ |
1328 | 1311 |
* ->descriptions{ |
... | ... | |
1380 | 1363 |
} |
1381 | 1364 |
|
1382 | 1365 |
function theme_cdm_featureTreeToc($featureTree){ |
1383 |
|
|
1366 |
//FIXME |
|
1384 | 1367 |
$out = '<div class="featureTOC">'; |
1385 | 1368 |
$out .= '<h2>' . t('Content') .'</h2>'; |
1386 | 1369 |
$out .= '<ul>'; |
... | ... | |
1406 | 1389 |
return $out; |
1407 | 1390 |
} |
1408 | 1391 |
|
1409 |
/** |
|
1410 |
* Replaces all occurrences of space characters with an underscore and tronsforms the given |
|
1411 |
* string to lowercase. |
|
1412 |
* |
|
1413 |
* @param String $string |
|
1414 |
* @return the transformed string |
|
1415 |
*/ |
|
1416 |
function generalizeString($string){ |
|
1417 |
return str_replace(' ', '_', strtolower($string)); |
|
1418 |
} |
|
1419 | 1392 |
|
1420 | 1393 |
function theme_cdm_descriptionElements($descriptionElements, $feature){ |
1421 |
|
|
1394 |
|
|
1422 | 1395 |
$outArray = array(); |
1423 | 1396 |
$glue = ''; |
1424 | 1397 |
$sortOutArray = false; |
1425 | 1398 |
$enclosingHtml = 'ul'; |
1426 | 1399 |
|
1427 |
foreach($descriptionElements as $descriptionElementSTO){
|
|
1400 |
foreach($descriptionElements as $descriptionElement){ |
|
1428 | 1401 |
|
1429 |
if($descriptionElementSTO->classType == 'TextData'){
|
|
1430 |
$outArray[] = theme('cdm_descriptionElementTextData', $descriptionElementSTO);
|
|
1431 |
}else if($descriptionElementSTO->classType == 'Distribution'){
|
|
1432 |
$outArray[] = $descriptionElementSTO->area->term;
|
|
1402 |
if($descriptionElement->class == 'TextData'){
|
|
1403 |
$outArray[] = theme('cdm_descriptionElementTextData', $descriptionElement); |
|
1404 |
}else if($descriptionElement->class == 'Distribution'){
|
|
1405 |
$outArray[] = $descriptionElement->area->representation_L10n;
|
|
1433 | 1406 |
$glue = ', '; |
1434 | 1407 |
$sortOutArray = true; |
1435 | 1408 |
$enclosingHtml = 'p'; |
1436 | 1409 |
}else{ |
1437 |
$outArray[] = '<li>No method for rendering unknown description class: '.$descriptionElementSTO->classType.'</li>';
|
|
1410 |
$outArray[] = '<li>No method for rendering unknown description class: '.$descriptionElement->classType.'</li>'; |
|
1438 | 1411 |
} |
1439 | 1412 |
} |
1440 | 1413 |
|
... | ... | |
1453 | 1426 |
} |
1454 | 1427 |
|
1455 | 1428 |
function theme_cdm_descriptionElementTextData($element){ |
1456 |
|
|
1457 |
$description = str_replace("\n", "<br/>", $element->description); |
|
1429 |
/* |
|
1430 |
* multilanguageText_L10n is |
|
1431 |
* LanguageString{ |
|
1432 |
annotations |
|
1433 |
created |
|
1434 |
createdBy |
|
1435 |
language |
|
1436 |
markers |
|
1437 |
text |
|
1438 |
updated |
|
1439 |
updatedBy |
|
1440 |
uuid |
|
1441 |
} |
|
1442 |
*/ |
|
1443 |
$description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text); |
|
1458 | 1444 |
$referenceCitation = ''; |
1459 | 1445 |
if($element->reference){ |
1460 | 1446 |
$referenceCitation = '; '.theme('cdm_fullreference', $element->reference, TRUE); |
... | ... | |
1476 | 1462 |
return $out; |
1477 | 1463 |
} |
1478 | 1464 |
|
1479 |
function theme_cdm_pager(&$resultPageSTO, $path, $parameters, $neighbors = 2){ |
|
1480 |
$out = ''; |
|
1481 |
|
|
1482 |
if ($resultPageSTO->totalPageCount > 1) { |
|
1483 |
|
|
1484 |
$viewportsize = $neighbors * 2 + 1; |
|
1485 |
if($resultPageSTO->totalPageCount <= $viewportsize){ |
|
1486 |
$viewportsize = $resultPageSTO->totalPageCount; |
|
1487 |
} |
|
1488 |
|
|
1489 |
$out .= '<div class="pager">'; |
|
1490 |
if($resultPageSTO->pageNumber > 1){ |
|
1491 |
$out .= theme('cdm_pager_link', t('« first'), 1, $resultPageSTO, $path, $parameters, array('class' => 'pager-first')); |
|
1492 |
$out .= theme('cdm_pager_link', t('‹ previous'), $resultPageSTO->pageNumber - 1, $resultPageSTO, $path, $parameters, array('class' => 'pager-previous')); |
|
1493 |
} |
|
1494 |
|
|
1495 |
if($resultPageSTO->totalPageCount <= $viewportsize || $resultPageSTO->pageNumber <= $neighbors){ |
|
1496 |
$first_number = 1; |
|
1497 |
} else if($resultPageSTO->pageNumber >= $resultPageSTO->totalPageCount - $neighbors){ |
|
1498 |
$first_number = $resultPageSTO->totalPageCount - $viewportsize; |
|
1499 |
} else { |
|
1500 |
$first_number = $resultPageSTO->pageNumber - $neighbors; |
|
1501 |
} |
|
1502 |
|
|
1503 |
if($first_number > 1){ |
|
1504 |
$out .= '<div class="pager-list-dots-left">...</div>'; |
|
1505 |
} |
|
1506 |
|
|
1507 |
|
|
1508 |
for($i = $first_number; ($i == $resultPageSTO->totalPageCount) || ($i < $first_number + $viewportsize); $i++){ |
|
1509 |
$out .= theme('cdm_pager_link', $i, $i, $resultPageSTO, $path, $parameters, array('class' => 'pager-first')); |
|
1510 |
} |
|
1511 |
if($i < $resultPageSTO->totalPageCount){ |
|
1512 |
$out .= '<div class="pager-list-dots-right">...</div>'; |
|
1513 |
} |
|
1514 |
|
|
1515 |
if($resultPageSTO->pageNumber < $resultPageSTO->totalPageCount){ |
|
1516 |
$out .= theme('cdm_pager_link', t('next ›'), $resultPageSTO->pageNumber + 1, $resultPageSTO, $path, $parameters, array('class' => 'pager-next')); |
|
1517 |
$out .= theme('cdm_pager_link', t('last »'), $resultPageSTO->totalPageCount, $resultPageSTO, $path, $parameters, array('class' => 'pager-last')); |
|
1518 |
} |
|
1519 |
$out .= '</div>'; |
|
1520 |
|
|
1521 |
return $out; |
|
1522 |
} |
|
1523 |
} |
|
1524 | 1465 |
|
1525 | 1466 |
function theme_cdm_pager_new(&$pager, $path, $parameters, $neighbors = 2){ |
1467 |
//FIXME take advantage of new pager class => nearly no calcualations needed !!! |
|
1526 | 1468 |
$out = ''; |
1527 | 1469 |
|
1528 | 1470 |
if ($pager->pagesAvailable > 1) { |
... | ... | |
1579 | 1521 |
} |
1580 | 1522 |
return $out; |
1581 | 1523 |
} |
1582 |
|
|
1583 |
function theme_cdm_pager_link($text, $linkPageNumber, &$resultPageSTO, $path, $parameters = array(), $attributes) { |
|
1584 |
|
|
1585 |
$out = ''; |
|
1586 |
|
|
1587 |
if ($linkPageNumber == $resultPageSTO->pageNumber) { |
|
1588 |
$out = '<strong>'.$text.'</strong>'; |
|
1589 |
} else { |
|
1590 |
// <a class="pager-next active" title="Go to page 3" href="/node?page=2">3</a> |
|
1591 |
$parameters['page'] = $linkPageNumber; |
|
1592 |
$out = l($text, $path, $attributes, compose_url_prameterstr($parameters)); |
|
1593 |
} |
|
1594 |
|
|
1595 |
|
|
1596 |
return $out; |
|
1597 |
} |
Also available in: Unified diff
DataPortal for CDM 2.1 - adapted to new REST server architecture