Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

cdm-dataportal / themes / diptera / template.php @ b5e773ef

History | View | Annotate | Download (3.61 KB)

1
<?php
2
// $Id: $
3

    
4
function diptera_cdm_descriptionElements($descriptionElements){
5

    
6
  $outArray = array();
7
  $glue = '';
8
  $sortOutArray = false;
9
  $enclosingHtml = 'ul';
10
  
11
  
12
   RenderHints::pushToRenderStack('cdm_descriptionElements');
13
    
14
  
15
  // only for diptera
16
  if(isset($descriptionElements[0]) && $descriptionElements[0]->feature->uuid == UUID_CITATION ) {
17
    foreach($descriptionElements as $element){
18
      $tokens = split(":", $element->multilanguageText_L10n->text);
19
      if(count($tokens) == 2){
20
        // token[0]: taxon name; token[1]: note; 
21
        $element->multilanguageText_L10n->text = $tokens[1] . ' [<span class="name">' . $tokens[0] . '</span>]';
22
      }
23
      if(isset($element->citation->datePublished->start)){
24
        $elementMap[partialToYear($element->citation->datePublished->start)] = $element;
25
      } else {
26
        $elementMap[] = $element;
27
      }
28
    }
29
    $success = ksort($elementMap);
30
    $descriptionElements = $elementMap;
31
  }
32
  // ---
33
  
34
  foreach($descriptionElements as $element){
35
    if($element->class == 'TextData'){
36
      $outArray[] = theme('cdm_descriptionElementTextData', $element);
37
    }else if($element->class == 'Distribution'){
38
      if( !array_search($element->area->representation_L10n, $outArray)){
39
        $outArray[] = $element->area->representation_L10n;
40
        $glue = ', ';
41
        $sortOutArray = true;
42
        $enclosingHtml = 'p';
43
      }
44
    }else{
45
      $outArray[] = '<li>No method for rendering unknown description class: '.$element->classType.'</li>';
46
    }
47
  }
48

    
49
      $out = theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
50
      RenderHints::popFromRenderStack();
51
      return  $out;
52
}
53

    
54
/**
55
 * Allows theaming of the taxon page tabs
56
 * 
57
 * @param $tabname
58
 * @return unknown_type
59
 */
60
function diptera_cdm_taxonpage_tab($tabname){
61
  switch($tabname){
62
    case 'Synonymy' : return t('Nomenclature'); break;
63
    default : return t($tabname); 
64
  }
65
}
66

    
67
function diptera_cdm_feature_name($feature_name){
68
  switch($feature_name){
69
    case "Citation": return t("Citations");
70
    default: return t(ucfirst($feature_name));
71
  }
72
}
73

    
74

    
75
function diptera_get_partDefinition($nameType){
76
  
77
  if($nameType == 'ZoologicalName'){
78
    return array(
79
        'namePart' => array(
80
          'name' => true
81
        ),
82
        'nameAuthorPart' => array(
83
          'name' => true,
84
          'authors' => true
85
        ),
86
        'referencePart' => array(
87
         'authors' => true,
88
         'microreference' => true
89
        ),
90
        'statusPart' => array(
91
          'status' => true,
92
        ),
93
        'descriptionPart' => array(
94
          'description' => true,
95
        ),
96
      );
97
  }
98
  return false;
99
}
100

    
101
function diptera_get_nameRenderTemplate($renderPath){
102
  
103
  switch ($renderPath){
104
    case 'taxon_page_title': 
105
      $template = array(
106
          'namePart' => array('#uri'=>true),
107
        );
108
      break;
109
    case  'acceptedFor':
110
    case 'list_of_taxa': 
111
      $template = array(
112
        'namePart' => array('#uri'=>true),
113
        'referencePart' => array('#uri'=>true),
114
      );
115
      break;
116
    case 'typedesignations': 
117
      $template = array(
118
        'namePart' => array('#uri'=>true),
119
        'referencePart' => array('#uri'=>true)
120
      );
121
      break;
122
    case 'taxon_page_synonymy':
123
    case 'related_taxon':
124
    default: 
125
      $template = array(
126
        'namePart' => array('#uri'=>true),
127
        'referencePart' => array('#uri'=>true),
128
        'statusPart' => true,
129
        'descriptionPart' => true
130
      );
131
  }
132
  return $template;
133
}
134

    
135
?>
Add picture from clipboard (Maximum size: 40 MB)