Revision 94bb9048
Added by Francisco Revilla over 13 years ago
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme | ||
---|---|---|
267 | 267 |
//$out .= theme('cdm_annotations_as_footnotekeys', $element); move above |
268 | 268 |
return $out; |
269 | 269 |
} |
270 |
function theme_cdm_image_sources($elements){ |
|
271 |
var_dump($elements); |
|
272 |
} |
|
273 | 270 |
|
274 | 271 |
function theme_cdm_common_names($elements){ |
275 | 272 |
$text_data_out = ''; |
... | ... | |
351 | 348 |
} |
352 | 349 |
$sortOutArray = false; |
353 | 350 |
$distributionElements = array(); |
354 |
|
|
351 |
|
|
355 | 352 |
RenderHints::pushToRenderStack('cdm_descriptionElements'); |
356 | 353 |
//$common_names = theme('cdm_common_names', $descriptionElements); |
357 | 354 |
if(is_array($descriptionElements)){//avoiding warning box in drupal for flora malesiana |
... | ... | |
371 | 368 |
} |
372 | 369 |
} |
373 | 370 |
}else if($descriptionElement->feature->uuid == UUID_IMAGE_SOURCES){ |
374 |
// do nothing?
|
|
371 |
$image_sources[] = $descriptionElement;
|
|
375 | 372 |
}else if($descriptionElement->class == 'TextData'){ |
376 | 373 |
$asListElement = true; |
377 | 374 |
$outArray[] = theme('cdm_descriptionElementTextData', $descriptionElement, $asListElement, $descriptionElement->feature->uuid); |
... | ... | |
387 | 384 |
if($descriptionElement->feature->uuid == UUID_NAME_USAGE){ |
388 | 385 |
sort($outArray); |
389 | 386 |
} |
390 |
|
|
387 |
if($image_sources){ |
|
388 |
$outArray[] = theme('cdm_description_element_image_source', $image_sources, true); |
|
389 |
|
|
390 |
} |
|
391 | 391 |
if(variable_get('distribution_sort', 'NO_SORT') != 'NO_SORT'){ |
392 | 392 |
$outArray[] = theme('cdm_description_ordered_distributions', $taxon_uuid, $distributionElements); |
393 | 393 |
}else{ |
... | ... | |
404 | 404 |
return $out; |
405 | 405 |
} |
406 | 406 |
|
407 |
function compare_image_sources($a, $b){ |
|
408 |
if($a->multilanguageText_L10n->text == $b->multilanguageText_L10n->text){ |
|
409 |
return 0; |
|
410 |
} |
|
411 |
return ($a->multilanguageText_L10n->text < $b->multilanguageText_L10n->text) ? -1 : 1; |
|
412 |
} |
|
413 |
|
|
414 |
/** |
|
415 |
* |
|
416 |
*/ |
|
417 |
function theme_cdm_description_element_image_source($image_sources, $asListElement) { |
|
418 |
$out = ''; |
|
419 |
$separator = ','; |
|
420 |
RenderHints::pushToRenderStack('descriptionElementImageSource'); |
|
421 |
RenderHints::setFootnoteListKey(UUID_IMAGE_SOURCES); |
|
422 |
|
|
423 |
//sorting the image sources |
|
424 |
usort($image_sources, "compare_image_sources"); |
|
425 |
//generate the footnotes |
|
426 |
foreach($image_sources as $image_source){ |
|
427 |
$footNoteKeys = cdm_annotations_as_footnotekeys($image_source); |
|
428 |
foreach($image_source->sources as $source){ |
|
429 |
if(_is_original_source_type($source)){ |
|
430 |
$fn_key = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false)); |
|
431 |
cdm_add_footnote_to_array($footNoteKeys, $fn_key);// ensure uniqueness of the footnote keys |
|
432 |
} |
|
433 |
} |
|
434 |
//sort and render footnote keys |
|
435 |
$footnoteKeyListStr = ''; |
|
436 |
asort($footNoteKeys); |
|
437 |
foreach($footNoteKeys as $footNoteKey){ |
|
438 |
$footnoteKeyListStr .= theme('cdm_footnote_key', $footNoteKey, ($footnoteKeyListStr ? $separator : '')); |
|
439 |
} |
|
440 |
//return value! |
|
441 |
if ($asListElement){ |
|
442 |
$out .= '<p><span class="descriptionElement descriptionElement-'.$image_source->uuid.'">'.$image_source->multilanguageText_L10n->text . $footnoteKeyListStr . ' </span><p>'; |
|
443 |
}else{ |
|
444 |
$out .= '<span class="descriptionElement descriptionElement-'.$image_source->uuid.'">'.$image_source->multilanguageText_L10n->text . $footnoteKeyListStr . ' </span>'; |
|
445 |
} |
|
446 |
} |
|
447 |
|
|
448 |
RenderHints::popFromRenderStack(); |
|
449 |
return $out; |
|
450 |
} |
|
451 |
|
|
407 | 452 |
/** |
408 | 453 |
* |
409 | 454 |
* @param unknown_type $descriptionElements |
... | ... | |
438 | 483 |
|
439 | 484 |
RenderHints::popFromRenderStack(); |
440 | 485 |
return $out; |
441 |
|
|
442 | 486 |
} |
443 | 487 |
/** |
444 | 488 |
* Function target is to compare two different foootnotes objects. |
Also available in: Unified diff
Ticket #1861