Project

General

Profile

Download (7.03 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2

    
3
/**
4
 * Overrides of generic themeing functions in cdm_datportal.theme.php
5
 */
6

    
7
/**
8
 * @param NameTO $nameTO
9
 * @return taxon name without author and nomencaltural reference
10
 */
11
function garland_cichorieae_cdm_taxon_page_title($nameTO){
12
  return theme('cdm_name', $nameTO, false, false, false, false);
13
}
14

    
15

    
16
/**
17
 * The description page is supposed to be the front page for a taxon.
18
 *
19
 * @param TaxonTO $taxonTO
20
 * @return
21
 */
22
function garland_cichorieae_cdm_taxon_page_description($taxonTO){
23
  // preferred image
24
  // hardcoded for testing
25
  $defaultPreferredImage = drupal_get_path('theme', 'garland_cichorieae').'/images/nopic.jpg';
26
  
27
  $out = theme('cdm_preferredImage', $taxonTO, $defaultPreferredImage, '&width=333&height=220&quality=95&format=jpeg');
28
  
29
  // description TOC
30
  $out .= theme('cdm_featureTreeToc', $taxonTO->featureTree);
31
  
32
  // descriptions
33
  $out .= theme('cdm_featureTree', $taxonTO->featureTree);
34
  
35
  return $out;
36
}
37

    
38

    
39
function garland_cichorieae_cdm_taxon_page_images($taxonTO){
40
  
41
  $descriptions = $taxonTO->featureTree->descriptions;
42
  foreach($descriptions as $descriptionTo){
43
    $features = $descriptionTo->features;
44
    foreach($features as $featureTo){
45
      print($featureTo->feature->term.',');
46
      if($featureTo->feature->term == 'Image'){
47
        $flashLink = true;
48
        break;        
49
      }
50
    }
51
  }
52
  
53
  if($flashLink){
54
    
55
    $taggedName = $taxonTO->name->taggedName;
56
    
57
    $nameArray = array();
58
    foreach($taggedName as $taggedText){
59
      if($taggedText->type == 'name'){
60
        $nameArray[] = $taggedText->text;
61
      }
62
    }
63
    
64
    $query = join("%5F", $nameArray) . '%20AND%20jpg';
65
    
66
  $out = '
67
  
68
  <script type="text/javascript" src="http://media.bgbm.org/erez/js/fsiwriter.js"></script>
69

    
70
<script type="text/javascript">
71
<!--
72
	writeFlashCode( "http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50&param_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343&plugins=PrintSave,textbox",
73
		"http://media.bgbm.org/erez/erez?src=erez-private/flashrequired.svg&tmp=Large&quality=97&width=470&height=400",
74
		"width=470;height=400;bgcolor=454343;wmode=opaque");
75
// -->
76
</script>
77
<noscript>
78
	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="470" height="400">
79
		<param name="movie" value="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50&param_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox"/>
80
		<param name="bgcolor" value="454343" />
81
		<param name="wmode" value="opaque" />
82
		<param name="allowscriptaccess" value="always" />
83
		<param name="allowfullscreen" value="true" />
84
		<param name="quality" value="high" />
85
		<embed src="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50&param_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox"
86
			width="470"
87
			height="400"
88
			bgcolor="454343"
89
			wmode="opaque"
90
			allowscriptaccess="always"
91
			allowfullscreen="true"
92
			quality="high"
93
			type="application/x-shockwave-flash"
94
			pluginspage="http://www.adobe.com/go/getflashplayer">
95
		</embed>
96
	</object>
97

    
98
</noscript>';
99
  
100
  }else{
101
    $out = 'No images available.';
102
  
103
  }
104
  return $out;
105
  
106
  
107
}
108

    
109
/**
110
 * @overrides theme_cdm_taggedtext2html in order to replace t.infr and t.infgen. with '[unranked]'
111
 */
112
function garland_cichorieae_cdm_taggedtext2html(array &$taggedtxt, $tag = 'span', $glue = ' ', $skiptags = array()){
113
   $out = '';
114
   $i = 0;
115
   foreach($taggedtxt as $tt){
116
     if(!in_array($tt->type, $skiptags) && strlen($tt->text) > 0){
117
      $out .= (strlen($out) > 0 && ++$i < count($taggedtxt)? $glue : '').'<'.$tag.' class="'.$tt->type.'">';
118
      if($tt->type == "rank" && ($tt->text == "t.infr." || $tt->text == "t.infgen.")){
119
        $out .= t('[unranked]');
120
      }else{
121
        $out .= t($tt->text);
122
      }
123
      $out .= '</'.$tag.'>';
124
     }
125
   }
126
   return $out;
127
}
128

    
129
function garland_cichorieae_cdm_descriptionElementArray($elementArray, $feature, $glue = '', $sortArray = false, $enclosingHtml = 'ul'){
130
  $out = '<div class="description" id="'.$feature.'">';
131
  
132
  if($sortArray) sort($elementArray);
133
  
134
  $out .= join($elementArray, $glue);
135
  
136
  $out .= '</div>';
137
  return $out;
138
}
139

    
140
/* #### exact duplicate of theme method in cdm_dataportal.theme.php ###
141
 *  
142
function garland_cichorieae_cdm_descriptionElementTextData($element){
143
  $description = str_replace("\n", "<br/>", $element->description);
144
  return '<p class="descriptionText">' . $description . '</p>';
145
}*/
146

    
147

    
148
/***** GARLAND OVERRIDES ******/
149

    
150
/**
151
 * Sets the body-tag class attribute.
152
 *
153
 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
154
 */
155
function phptemplate_body_class($sidebar_left, $sidebar_right) {
156
  if ($sidebar_left != '' && $sidebar_right != '') {
157
    $class = 'sidebars';
158
  }
159
  else {
160
    if ($sidebar_left != '') {
161
      $class = 'sidebar-left';
162
    }
163
    if ($sidebar_right != '') {
164
      $class = 'sidebar-right';
165
    }
166
  }
167

    
168
  if (isset($class)) {
169
    print ' class="'. $class .'"';
170
  }
171
}
172

    
173
/**
174
 * Return a themed breadcrumb trail.
175
 *
176
 * @param $breadcrumb
177
 *   An array containing the breadcrumb links.
178
 * @return a string containing the breadcrumb output.
179
 */
180
function phptemplate_breadcrumb($breadcrumb) {
181
  if (!empty($breadcrumb)) {
182
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
183
  }
184
}
185

    
186
/**
187
 * Allow themable wrapping of all comments.
188
 */
189
function phptemplate_comment_wrapper($content, $type = null) {
190
  static $node_type;
191
  if (isset($type)) $node_type = $type;
192

    
193
  if (!$content || $node_type == 'forum') {
194
    return '<div id="comments">'. $content . '</div>';
195
  }
196
  else {
197
    return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
198
  }
199
}
200

    
201
/**
202
 * Override or insert PHPTemplate variables into the templates.
203
 */
204
function _phptemplate_variables($hook, $vars) {
205
  if ($hook == 'page') {
206

    
207
    if ($secondary = menu_secondary_local_tasks()) {
208
      $output = '<span class="clear"></span>';
209
      $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
210
      $vars['tabs2'] = $output;
211
    }
212

    
213
    // Hook into color.module
214
    if (module_exists('color')) {
215
      _color_page_alter($vars);
216
    }
217
    return $vars;
218
  }
219
  return array();
220
}
221

    
222
/**
223
 * Returns the rendered local tasks. The default implementation renders
224
 * them as tabs.
225
 *
226
 * @ingroup themeable
227
 */
228
function phptemplate_menu_local_tasks() {
229
  $output = '';
230

    
231
  if ($primary = menu_primary_local_tasks()) {
232
    $output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
233
  }
234

    
235
  return $output;
236
}
(11-11/11)