Project

General

Profile

Download (8.73 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
    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, UUID_DISTRIBUTION, ($sourcesFootnoteKeyList ? $separator : ''));
108
//        }
109
        if($annotationFootnoteKeys && $sourcesFootnoteKeyList){
110
            $annotationFootnoteKeys .= $separator;
111
        }
112
        $out .= $descriptionElement->area->representation_L10n . $annotationFootnoteKeys . $sourcesFootnoteKeyList . ' ';
113
    }
114
  
115
  $descriptions = substr($descriptions, 0, strlen($descriptions)-2);
116
  $taxonTrees =  cdm_ws_get(CDM_WS_PORTAL_TAXONOMY);
117
  foreach($taxonTrees as $taxonTree){
118
    if ($taxonTree -> uuid == variable_get('cdm_taxonomictree_uuid', FALSE)){
119
      $reference = $taxonTree-> reference;
120
      break;
121
    }
122
  }
123
  $out = substr($out, 0, strlen($out)-strlen($separator) );
124

    
125
  $referenceCitation = '('.l('<span class="reference">World Checklist of Monocotyledons</span>', path_to_reference($reference->uuid), array("class"=>"reference"), NULL, NULL, FALSE ,TRUE).')';
126
  
127
  if($descriptions && strlen($descriptions) > 0 ){
128
    $sourceRefs .= ' '.$referenceCitation;
129
  }
130

    
131
  if(strlen($sourceRefs) > 0){
132
    $sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
133
  }
134
  
135
    RenderHints::popFromRenderStack();
136
  return $descriptions. $sourceRefs ;
137

    
138
}
139

    
140

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

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

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

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

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

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

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

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

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

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

    
226
  return $output;
227
}
228

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

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

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