Project

General

Profile

Download (9.8 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
  $out = '';
96
  $separator = ', ';
97

    
98
    RenderHints::pushToRenderStack('descriptionElementDistribution');
99
    RenderHints::setFootnoteListKey(UUID_DISTRIBUTION);
100
    foreach($descriptionElements as $descriptionElement){
101
        // annotations as footnotes
102
//        $annotationFootnoteKeys = theme('cdm_annotations_as_footnotekeys', $descriptionElement);
103
//        // source references as footnotes
104
//        $sourcesFootnoteKeyList = '';
105
//        foreach($descriptionElement->sources as $source){
106
//            $_fkey = FootnoteManager::addNewFootnote(UUID_DISTRIBUTION, theme('cdm_DescriptionElementSource', $source, false));
107
//            $sourcesFootnoteKeyList .= theme('cdm_footnote_key', $_fkey, ($sourcesFootnoteKeyList ? $separator : ''));
108
//        }
109
//        if($annotationFootnoteKeys && $sourcesFootnoteKeyList){
110
//            $annotationFootnoteKeys .= $separator;
111
//        }
112
        $out .= $descriptionElement->area->representation_L10n . $annotationFootnoteKeys . $sourcesFootnoteKeyList . $separator;
113
    }
114

    
115
  $taxonTrees =  cdm_ws_get(CDM_WS_PORTAL_TAXONOMY);
116
  foreach($taxonTrees as $taxonTree){
117
    if ($taxonTree->uuid == variable_get('cdm_taxonomictree_uuid', FALSE)){
118
      $reference = $taxonTree->reference;
119
      break;
120
    }
121
  }
122
  $out = substr($out, 0, strlen($out)-strlen($separator) );
123

    
124
  $referenceCitation = '('.l('<span class="reference">World Checklist of Monocotyledons</span>', path_to_reference($reference->uuid), array("class"=>"reference"), NULL, NULL, FALSE ,TRUE).')';
125

    
126
  if($out && strlen($out) > 0 ){
127
    $sourceRefs .= ' '.$referenceCitation;
128
  }
129

    
130
  if(strlen($sourceRefs) > 0){
131
    $sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
132
  }
133

    
134
    RenderHints::popFromRenderStack();
135
  return $out. $sourceRefs ;
136

    
137
}
138

    
139

    
140
/**
141
 * Sets the body-tag class attribute.
142
 *
143
 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
144
 */
145
function phptemplate_body_class($sidebar_left, $sidebar_right) {
146
  if ($sidebar_left != '' && $sidebar_right != '') {
147
    $class = 'sidebars';
148
  }
149
  else {
150
    if ($sidebar_left != '') {
151
      $class = 'sidebar-left';
152
    }
153
    if ($sidebar_right != '') {
154
      $class = 'sidebar-right';
155
    }
156
  }
157

    
158
  if (isset($class)) {
159
    print ' class="'. $class .'"';
160
  }
161
}
162

    
163
/**
164
 * Return a themed breadcrumb trail.
165
 *
166
 * @param $breadcrumb
167
 *   An array containing the breadcrumb links.
168
 * @return a string containing the breadcrumb output.
169
 */
170
function phptemplate_breadcrumb($breadcrumb) {
171
  if (!empty($breadcrumb)) {
172
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
173
  }
174
}
175

    
176
/**
177
 * Allow themable wrapping of all comments.
178
 */
179
function phptemplate_comment_wrapper($content, $type = null) {
180
  static $node_type;
181
  if (isset($type)) $node_type = $type;
182

    
183
  if (!$content || $node_type == 'forum') {
184
    return '<div id="comments">'. $content . '</div>';
185
  }
186
  else {
187
    return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
188
  }
189
}
190

    
191
/**
192
 * Override or insert PHPTemplate variables into the templates.
193
 */
194
function _phptemplate_variables($hook, $vars) {
195
  if ($hook == 'page') {
196

    
197
    if ($secondary = menu_secondary_local_tasks()) {
198
      $output = '<span class="clear"></span>';
199
      $output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
200
      $vars['tabs2'] = $output;
201
    }
202

    
203
    // Hook into color.module
204
    if (module_exists('color')) {
205
      _color_page_alter($vars);
206
    }
207
    return $vars;
208
  }
209
  return array();
210
}
211

    
212
/**
213
 * Returns the rendered local tasks. The default implementation renders
214
 * them as tabs.
215
 *
216
 * @ingroup themeable
217
 */
218
function phptemplate_menu_local_tasks() {
219
  $output = '';
220

    
221
  if ($primary = menu_primary_local_tasks()) {
222
    $output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
223
  }
224

    
225
  return $output;
226
}
227

    
228
function palmweb_2_get_partDefinition($nameType){
229
  if($nameType == 'BotanicalName'){
230
    return array(
231
        'namePart' => array(
232
          'name' => true,
233
          'authors' => true,
234
        ),
235
        'authorshipPart' => array(
236
        ),
237
        'referencePart' => array(
238
          'reference' => true,
239
          'microreference' => true
240
        ),
241
        'statusPart' => array(
242
          'status' => true,
243
        ),
244
        'descriptionPart' => array(
245
          'description' => true,
246
        ),
247
      );
248
  }
249
  return false;
250
}
251

    
252
function palmweb_2_get_nameRenderTemplate($renderPath){
253

    
254
  switch($renderPath) {
255
      case 'acceptedFor':
256
        $template = array(
257
          'namePart' => array('#uri'=>true),
258
        );
259
        break;
260
      case 'typedesignations':
261
        $template = array(
262
          'namePart' => array('#uri'=>true),
263
          'referencePart' => true
264
        );
265
      case 'taxon_page_title':
266
      case 'list_of_taxa':
267
      case 'taxon_page_synonymy':
268
      case 'related_taxon':
269
      case 'polytomousKey':
270
      case '#DEFAULT':
271
        $template = array(
272
          'namePart' => array('#uri'=>true),
273
          'referencePart' => true,
274
          'descriptionPart' => true,
275
          'statusPart' => true
276
        );
277
  }
278
  return $template;
279
}
280

    
281
function palmweb_2_cdm_feature_name($feature_name){
282
  switch($feature_name){
283
    case "Protologue": return t("Original Publication");
284
    default: return t(ucfirst($feature_name));
285
  }
286
}
287

    
288
function palmweb_2_cdm_taxon_page_title($taxon, $uuid, $synonym_uuid){
289
	RenderHints::pushToRenderStack('taxon_page_title');
290
	$synonym = cdm_ws_get(CDM_WS_PORTAL_TAXON, $synonym_uuid);
291
	if(isset($taxon->name->nomenclaturalReference)){
292
		$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
293
	}
294
	$out = theme('cdm_taxonName', $taxon->name, null, $referenceUri, false);
295

    
296
	RenderHints::popFromRenderStack();
297
	if ($synonym->name->titleCache){
298
	$result = '<span class = "synonym_title">' .$synonym->name->titleCache . ' is synonym of ' .'</span>'.
299
		   '<span class="'.$taxon->class.'">'.$out.'</span>';
300
	}else{
301
		$result = '<span class="'.$taxon->class.'">'.$out.'</span>';
302
	}
303
	return $result;
304

    
305
}
306

    
307
function palmweb_2_cdm_uri_to_synonym($synonymUuid, $acceptedUuid, $pagePart = null) {
308
	$acceptedPath = path_to_taxon($acceptedUuid, true);
309
	return url($acceptedPath . ($pagePart ? '/'.$pagePart : '') . '/'.$synonymUuid, 'highlite='.$synonymUuid);
310
	//return url($acceptedPath.($pagePart ? '/'.$pagePart : ''), 'highlite='.$synonymUuid, $synonymUuid."/$synonymUuid");
311
	//return url("$acceptedPath/$synonymUuid".($pagePart ? '/'.$pagePart : ''), 'highlite='.$synonymUuid);
312
}
(12-12/12)