Project

General

Profile

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

    
3
/**
4
 * The description page is supposed to be the front page for a taxon.
5
 *
6
 * @param TaxonTO $taxonTO
7
 * @return
8
 */
9
function palmweb_2_cdm_taxon_page_description($taxon, $mergedTrees, $media, $hideImages = false){
10

    
11
  
12
  if(!$hideImages){
13
    // preferred image
14
    // hardcoded for testing;
15
    $defaultRepresentationPart = false;
16
    $defaultRepresentationPart->width = 184;
17
    $defaultRepresentationPart->height = 144;
18
    $defaultRepresentationPart->uri = drupal_get_path('theme', 'palmweb_2').'/images/no_picture.png';
19
    
20
    // preferred image size 184px × 144
21
    $imageMaxExtend = 184;
22
    $out .= '<div class="preferredImage">'.theme('cdm_preferredImage', $media, $defaultRepresentationPart, $imageMaxExtend).'</div>';
23
  }
24
  
25
  // description TOC
26
  $out .= theme('cdm_featureTreeTOCs', $mergedTrees);
27
  // description
28
  $out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
29
  
30
  return $out;
31
}
32

    
33
function _disabled_palmweb_2_cdm_taxon_page_images($taxon, $media){
34

    
35
  $flashLink = isset($media[0]);
36
  
37
  if($flashLink){
38
    
39
    $taggedName = $taxon->name->taggedName;
40
    
41
    $nameArray = array();
42
    foreach($taggedName as $taggedText){
43
      if($taggedText->type == 'name'){
44
        $nameArray[] = $taggedText->text;
45
      }
46
    }
47
    
48
   $query = join("%5F", $nameArray) . '%20AND%20EditWP6%20AND%20jpg';
49
    
50
  $out = '
51
  
52
  <script type="text/javascript" src="http://media.bgbm.org/erez/js/fsiwriter.js"></script>
53

    
54
<script type="text/javascript">
55
<!--
56
	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",
57
		"http://media.bgbm.org/erez/erez?src=erez-private/flashrequired.svg&tmp=Large&quality=97&width=500&height=323",
58
		"width=500;height=323;bgcolor=454343;wmode=opaque");
59
// -->
60
</script>
61
<noscript>
62
	<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="500" height="323">
63
		<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"/>
64
		<param name="bgcolor" value="454343" />
65
		<param name="wmode" value="opaque" />
66
		<param name="allowscriptaccess" value="always" />
67
		<param name="allowfullscreen" value="true" />
68
		<param name="quality" value="high" />
69
		<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"
70
			width="500"
71
			height="323"
72
			bgcolor="454343"
73
			wmode="opaque"
74
			allowscriptaccess="always"
75
			allowfullscreen="true"
76
			quality="high"
77
			type="application/x-shockwave-flash"
78
			pluginspage="http://www.adobe.com/go/getflashplayer">
79
		</embed>
80
	</object>
81

    
82
</noscript>';
83
  
84
  }else{
85
    $out = 'No images available.';
86
  
87
  }
88
  return $out;
89
  
90
  
91
}
92

    
93
function palmweb_2_cdm_descriptionElementDistribution($descriptionElements) {
94

    
95
  $descriptions = '';
96
  $separator = ', ';
97

    
98
  foreach($descriptionElements as $descriptionElement){
99
    $descriptions .= $descriptionElement->area->representation_L10n . $separator;
100
  }
101
  $descriptions = substr($descriptions, 0, strlen($descriptions)-2);
102
  $taxonTrees =  cdm_ws_get(CDM_WS_TAXONOMY);
103
  foreach($taxonTrees as $taxonTree){
104
    if ($taxonTree -> uuid == variable_get('cdm_taxonomictree_uuid', FALSE)){
105
      $reference = $taxonTree-> reference;
106
      break;
107
    }
108
  }
109
  $out = substr($out, 0, strlen($out)-strlen($separator) );
110

    
111
  $referenceCitation = '('.l('<span class="reference">World Checklist of Monocotyledons</span>', path_to_reference($reference->uuid), array("class"=>"reference"), NULL, NULL, FALSE ,TRUE).')';
112
  
113
  if($descriptions && strlen($descriptions) > 0 ){
114
    $sourceRefs .= ' '.$referenceCitation;
115
  }
116

    
117
  if(strlen($sourceRefs) > 0){
118
    $sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
119
  }
120
  return $descriptions. $sourceRefs ;
121

    
122
}
123

    
124

    
125
/**
126
 * Sets the body-tag class attribute.
127
 *
128
 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
129
 */
130
function phptemplate_body_class($sidebar_left, $sidebar_right) {
131
  if ($sidebar_left != '' && $sidebar_right != '') {
132
    $class = 'sidebars';
133
  }
134
  else {
135
    if ($sidebar_left != '') {
136
      $class = 'sidebar-left';
137
    }
138
    if ($sidebar_right != '') {
139
      $class = 'sidebar-right';
140
    }
141
  }
142

    
143
  if (isset($class)) {
144
    print ' class="'. $class .'"';
145
  }
146
}
147

    
148
/**
149
 * Return a themed breadcrumb trail.
150
 *
151
 * @param $breadcrumb
152
 *   An array containing the breadcrumb links.
153
 * @return a string containing the breadcrumb output.
154
 */
155
function phptemplate_breadcrumb($breadcrumb) {
156
  if (!empty($breadcrumb)) {
157
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
158
  }
159
}
160

    
161
/**
162
 * Allow themable wrapping of all comments.
163
 */
164
function phptemplate_comment_wrapper($content, $type = null) {
165
  static $node_type;
166
  if (isset($type)) $node_type = $type;
167

    
168
  if (!$content || $node_type == 'forum') {
169
    return '<div id="comments">'. $content . '</div>';
170
  }
171
  else {
172
    return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
173
  }
174
}
175

    
176
/**
177
 * Override or insert PHPTemplate variables into the templates.
178
 */
179
function _phptemplate_variables($hook, $vars) {
180
  if ($hook == 'page') {
181

    
182
    if ($secondary = menu_secondary_local_tasks()) {
183
      $output = '<span class="clear"></span>';
184
      $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
185
      $vars['tabs2'] = $output;
186
    }
187

    
188
    // Hook into color.module
189
    if (module_exists('color')) {
190
      _color_page_alter($vars);
191
    }
192
    return $vars;
193
  }
194
  return array();
195
}
196

    
197
/**
198
 * Returns the rendered local tasks. The default implementation renders
199
 * them as tabs.
200
 *
201
 * @ingroup themeable
202
 */
203
function phptemplate_menu_local_tasks() {
204
  $output = '';
205

    
206
  if ($primary = menu_primary_local_tasks()) {
207
    $output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
208
  }
209

    
210
  return $output;
211
}
212

    
213
function palmweb_2_get_partDefinition($nameType){
214
  if($nameType == 'BotanicalName'){
215
    return array(
216
        'namePart' => array(
217
          'name' => true,
218
          'authors' => true,   
219
        ),
220
        'authorshipPart' => array(
221
        ),
222
        'referencePart' => array(
223
          'reference' => true,
224
          'microreference' => true
225
        ),
226
        'statusPart' => array(
227
          'status' => true,
228
        ),
229
        'descriptionPart' => array(
230
          'description' => true,
231
        ),
232
      );
233
  }
234
  return false;
235
}
236

    
237
function palmweb_2_get_nameRenderTemplate($renderPath){
238
  
239
  switch($renderPath) {
240
      case 'acceptedFor':
241
        $template = array(
242
          'namePart' => array('#uri'=>true),
243
        );
244
        break;
245
      case 'typedesignations': 
246
        $template = array(
247
          'namePart' => array('#uri'=>true),
248
          'referencePart' => true
249
        );
250
      case 'taxon_page_title':
251
      case 'list_of_taxa':
252
      case 'taxon_page_synonymy':
253
      case 'related_taxon':
254
      default:
255
        $template = array(
256
          'namePart' => array('#uri'=>true),
257
          'referencePart' => true,
258
          'descriptionPart' => true
259
        );
260
  }
261
  return $template;
262
}
263

    
264
function palmweb_2_cdm_feature_name($feature_name){
265
  switch($feature_name){
266
    case "Protologue": return t("Original Publication");
267
    default: return t(ucfirst($feature_name));
268
  }
269
}
(12-12/12)