Project

General

Profile

Download (2.93 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
// $Id$
3

    
4
/**
5
* Copyright (C) 2007 EDIT
6
* European Distributed Institute of Taxonomy
7
* http://www.e-taxonomy.eu
8
*
9
* The contents of this file are subject to the Mozilla Public License Version 1.1
10
* See http://www.mozilla.org/MPL/MPL-1.1.html for the full license terms.
11
*/
12

    
13
function theme_cdm_reference_pager($referencePager, $path, $parameters = array()){
14
	drupal_set_title(t('Bibliographic index'));
15
	$out = '';
16
	if(count($referencePager->records) > 0){
17
		$out .= '<ul>';
18
		foreach($referencePager->records as $reference){
19
			$reference->fullCitation = $reference->titleCache; //FIXME remove hack for matching cdm entity to STO
20
			$out .= '<li>'.theme('cdm_reference', $reference, null, TRUE).'</li>';
21
		}
22
		$out .= '</ul>';
23
		$out .= theme('cdm_pager', $referencePager,  $path, $parameters);
24
	} else {
25
		$out = '<h4 class="error">Sorry, this page contains not entries.</h4>';
26
	}
27
	return $out;
28
}
29

    
30

    
31
/**
32
 * used by
33
 *  - theme_cdm_typedesignations
34
 *  - theme_cdm_reference_pager
35
 *  - theme_cdm_taxonRelationships
36
 *
37
 */
38
function theme_cdm_reference($reference, $microReference = null, $doLink = FALSE, $referenceStyle = NULL ){
39
  global $theme_key; //TODO: implement in the palmae theme the concrete case
40
  $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
41

    
42
	if($style == "zoology"){
43
		$year = partialToYear($reference->datePublished->start);
44
		$citation = $author_team->titleCache . ($year ? '. '.$year : '');
45
	}else
46
	  //FIXME move palmweb specific lines to palweb theme !!!!
47
	if ($theme_key == 'palmweb_2') {
48
		$year = partialToYear($reference->datePublished->start);
49
    	$citation = short_form_of_author_team ($author_team->titleCache) . ($year ? '. '.$year : '');
50
    	$citation = str_replace('..', '.', $citation);
51
	} else {
52
		$citation = $reference->titleCache;
53

    
54
		//$year = partialToYear($reference->datePublished->start);
55
		//$citation = short_form_of_author_team ($author_team->titleCache) . ($year ? '. '.$year : '');
56
		//$citation = str_replace('..', '.', $citation);
57
	}
58

    
59
	if($doLink){
60
		$out = l('<span class="reference">'.$citation.'</span>'
61
          , path_to_reference($reference->uuid)
62
          , array("class"=>"reference")
63
          , NULL, NULL, FALSE ,TRUE);
64
    } else {
65
		$out = '<span class="reference">'.$citation.'</span>';
66
	}
67
    if(!empty($descriptionElementSource->citationMicroReference)){
68
        $out .= ': '. $descriptionElementSource->citationMicroReference;
69
     }
70

    
71
    return $out;
72
}
73

    
74
function short_form_of_author_team ($author_team){
75

    
76
	$number_of_authors = substr_count($author_team, ' & ') + 1;
77
	//var_dump($author_team);
78
	//var_dump($number_of_authors);
79
	switch ($number_of_authors) {
80
		case 1:
81
			$result = $author_team;
82
			break;
83
		case 2:
84
			$result = str_replace(' & ', ' and ', $author_team);
85
			break;
86
		default:
87
			$result_parts = explode(' & ', $author_team);
88
      $result = $result_parts[0] . ' et al.';
89
	}
90
	return $result;
91
}
(7-7/8)