Project

General

Profile

Download (4.38 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/**
3
 * @file
4
 * Name theming functions.
5
 *
6
 * @copyright
7
 *   (C) 2007-2012 EDIT
8
 *   European Distributed Institute of Taxonomy
9
 *   http://www.e-taxonomy.eu
10
 *
11
 *   The contents of this module are subject to the Mozilla
12
 *   Public License Version 1.1.
13
 * @see http://www.mozilla.org/MPL/MPL-1.1.html
14
 */
15

    
16
/**
17
 * @todo Please document this function.
18
 * @see http://drupal.org/node/1354
19
 */
20
function theme_cdm_homotypicSynonymLine($variables) {
21
  $taxon = $variables['taxon'];
22
  $out = '';
23
  $out .= '<li class="synonym">' . cdm_related_taxon($taxon, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
24

    
25
  return $out;
26
}
27

    
28
/**
29
 * @todo Please document this function.
30
 * @see http://drupal.org/node/1354
31
 */
32
function theme_cdm_heterotypicSynonymyGroup($variables) {
33
  $homotypical_group = $variables['homotypicalGroup'];
34
  RenderHints::pushToRenderStack('heterotypicSynonymyGroup');
35

    
36
  $out = '';
37
  $out = '<div class="heterotypic-synonymy-group"><ul class="heterotypicSynonymyGroup">';
38
  $footnoteListKey = (isset($homotypical_group[0]) ? $homotypical_group[0]->uuid : 'NULL');
39
  RenderHints::setFootnoteListKey($footnoteListKey);
40

    
41
  $type_designations= type_designations_for_synonymy_group($homotypical_group);
42

    
43
  $is_first_entry = TRUE;
44
  foreach ($homotypical_group as $synonym) {
45
    if ($is_first_entry) {
46
      $is_first_entry = FALSE;
47
      // Is first list entry.
48
      $out .= '<li class="firstentry synonym">' . cdm_related_taxon($synonym, UUID_HETEROTYPIC_SYNONYM_OF) . '</li>';
49
    }
50
    else {
51
      $out .= '<li class="synonym">' . cdm_related_taxon($synonym, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
52
    }
53
  }
54

    
55
  if (count($type_designations) > 0) {
56
    $out .= render_type_designations($type_designations);
57
  }
58
  $out .= '</ul>';
59

    
60
  // ------- footnotes ------- //
61
  $out .= '<ul class="footnotes">';
62
  $out .= theme('cdm_annotation_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey(), 'enclosingTag' => 'li'));
63
  $out .= theme('cdm_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey(), 'enclosingTag' => 'li'));
64
  $out .= '</ul>';
65

    
66
  $out .= '</div>';
67

    
68
  RenderHints::popFromRenderStack();
69
  return $out;
70
}
71

    
72
/**
73
 * Renders the homotypic synonymy group for the accepted taxon in the synonymy.
74
 *
75
 * Foonotes of the accepted taxon will also be rendered here in the
76
 * homotypic synonymy group even if the synonymList or prependedSynonyms are
77
 * empty. Therefore  the homotypic group and accepted taxon share the  same
78
 * footnote key.
79
 *
80
 * @param $variables
81
 *   an associative array:
82
 *   - synonymList: the list of cdm Synonym entities
83
 *   - accepted_taxon_uuid: the uuid of the accepted taxon
84
 *   - prependedSynonyms: further synonyms which should be prepended
85
 *      before the actual list of synonyms
86
 */
87
function theme_cdm_homotypicSynonymyGroup($variables) {
88
  $synonymList = $variables['synonymList'];
89
  $accepted_taxon_name_uuid = $variables['accepted_taxon_name_uuid'];
90
  $prependedSynonyms = $variables['prependedSynonyms'];
91

    
92
  RenderHints::pushToRenderStack('homotypicSynonymyGroup');
93

    
94
  $type_designations_in_group = NULL;
95

    
96
  $out = '<div class="homotypic-synonymy-group">';
97

    
98
  $type_designations = type_designations_for_synonymy_group($synonymList, $accepted_taxon_name_uuid);
99

    
100
  if (count($type_designations) > 0 || is_array($prependedSynonyms) || is_array($synonymList)) {
101
    $out .= '<ul class="homotypicSynonyms">';
102
  if (!empty($prependedSynonyms)) {
103
    foreach ($prependedSynonyms as $taxon) {
104
      $out .= '<li class="synonym">' . cdm_related_taxon($taxon, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
105
    }
106
  }
107

    
108

    
109
  if (isset($synonymList[0])) {
110
    foreach ($synonymList as $synonym) {
111
      $out .= '<li class="synonym">' . cdm_related_taxon($synonym, UUID_HOMOTYPIC_SYNONYM_OF) . '</li>';
112
    }
113
  }
114

    
115
  if (count($type_designations) > 0) {
116
    $out .= theme('cdm_typedesignations', array('typeDesignations' => $type_designations));
117
  }
118

    
119
  }
120

    
121
  $out .= '</ul>';
122

    
123
  // ------- footnotes ------- //
124

    
125
  // all foonotes of the homotypic group and also of the accepted taxon are
126
  // rendered here, both should have the same footnote key
127
  $out .= '<ul class="footnotes">';
128
  $out .= theme('cdm_annotation_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey(), 'enclosingTag' => 'li'));
129
  $out .= theme('cdm_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey(), 'enclosingTag' => 'li'));
130
  $out .= '</ul>';
131

    
132
  $out .= '</div>';
133

    
134

    
135
  RenderHints::popFromRenderStack();
136
  return $out;
137
}
(4-4/9)