1
|
<?php
|
2
|
// $Id$
|
3
|
|
4
|
/**
|
5
|
* Overrides of generic themeing functions in cdm_datportal.theme.php
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* @param NameTO $nameTO
|
10
|
* @return taxon name without author and nomencaltural reference
|
11
|
*/
|
12
|
function garland_cichorieae_cdm_taxon_page_title($nameTO){
|
13
|
return theme('cdm_name', $nameTO, false, false, false, false);
|
14
|
}
|
15
|
|
16
|
|
17
|
/**
|
18
|
* The description page is supposed to be the front page for a taxon.
|
19
|
*
|
20
|
* @param TaxonTO $taxonTO
|
21
|
* @return
|
22
|
*/
|
23
|
function garland_cichorieae_cdm_taxon_page_description($taxonTO){
|
24
|
// preferred image
|
25
|
// hardcoded for testing
|
26
|
$defaultPreferredImage = drupal_get_path('theme', 'garland_cichorieae').'/images/nopic.jpg';
|
27
|
|
28
|
$out = theme('cdm_preferredImage', $taxonTO, $defaultPreferredImage, '&width=333&height=220&quality=95&format=jpeg');
|
29
|
|
30
|
// description TOC
|
31
|
$out .= theme('cdm_featureTreeToc', $taxonTO->featureTree);
|
32
|
|
33
|
// descriptions
|
34
|
$out .= theme('cdm_featureTree', $taxonTO->featureTree);
|
35
|
|
36
|
return $out;
|
37
|
}
|
38
|
|
39
|
function garland_cichorieae_cdm_descriptionElementTextData($element){
|
40
|
|
41
|
$description = str_replace("\n", "<br/>", $element->description);
|
42
|
$referenceCitation = '';
|
43
|
if($element->reference){
|
44
|
// disabling references for cichorieae description Elements because they all have faulty references
|
45
|
//$referenceCitation = '; '.theme('cdm_fullreference', $element->reference, TRUE);
|
46
|
}
|
47
|
return '<p class="descriptionText">' . $description . $referenceCitation.'</p>';
|
48
|
}
|
49
|
|
50
|
function garland_cichorieae_cdm_taxon_page_images($taxonTO){
|
51
|
|
52
|
$descriptions = $taxonTO->featureTree->descriptions;
|
53
|
foreach($descriptions as $descriptionTo){
|
54
|
$features = $descriptionTo->features;
|
55
|
foreach($features as $featureTo){
|
56
|
if($featureTo->feature->term == 'Image'){
|
57
|
$flashLink = count($featureTo->descriptionElements) > 0;
|
58
|
break;
|
59
|
}
|
60
|
}
|
61
|
}
|
62
|
|
63
|
if($flashLink){
|
64
|
|
65
|
$taggedName = $taxonTO->name->taggedName;
|
66
|
|
67
|
$nameArray = array();
|
68
|
foreach($taggedName as $taggedText){
|
69
|
if($taggedText->type == 'name' || $taggedText->type == 'rank'){
|
70
|
// replacing of "subsp." with "s" is cichorieae specific
|
71
|
$part = $taggedText->text == "subsp." ? "s" : $taggedText->text;
|
72
|
$nameArray[] = $part;
|
73
|
}
|
74
|
}
|
75
|
|
76
|
$query = join("%5F", $nameArray) . '%20AND%20jpg';
|
77
|
|
78
|
$out = '
|
79
|
|
80
|
<script type="text/javascript" src="http://media.bgbm.org/erez/js/fsiwriter.js"></script>
|
81
|
|
82
|
<script type="text/javascript">
|
83
|
<!--
|
84
|
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¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343&plugins=PrintSave,textbox",
|
85
|
"http://media.bgbm.org/erez/erez?src=erez-private/flashrequired.svg&tmp=Large&quality=97&width=620&height=400",
|
86
|
"width=620;height=400;bgcolor=454343;wmode=opaque");
|
87
|
// -->
|
88
|
</script>
|
89
|
<noscript>
|
90
|
<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">
|
91
|
<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¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox"/>
|
92
|
<param name="bgcolor" value="454343" />
|
93
|
<param name="wmode" value="opaque" />
|
94
|
<param name="allowscriptaccess" value="always" />
|
95
|
<param name="allowfullscreen" value="true" />
|
96
|
<param name="quality" value="high" />
|
97
|
<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¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox"
|
98
|
width="620"
|
99
|
height="400"
|
100
|
bgcolor="454343"
|
101
|
wmode="opaque"
|
102
|
allowscriptaccess="always"
|
103
|
allowfullscreen="true"
|
104
|
quality="high"
|
105
|
type="application/x-shockwave-flash"
|
106
|
pluginspage="http://www.adobe.com/go/getflashplayer">
|
107
|
</embed>
|
108
|
</object>
|
109
|
|
110
|
</noscript>';
|
111
|
|
112
|
}else{
|
113
|
$out = 'No images available.';
|
114
|
|
115
|
}
|
116
|
return $out;
|
117
|
|
118
|
|
119
|
}
|
120
|
|
121
|
/**
|
122
|
* @overrides theme_cdm_taggedtext2html in order to replace t.infr and t.infgen. with '[unranked]'
|
123
|
*/
|
124
|
function garland_cichorieae_cdm_taggedtext2html(array &$taggedtxt, $tag = 'span', $glue = ' ', $skiptags = array()){
|
125
|
$out = '';
|
126
|
$i = 0;
|
127
|
foreach($taggedtxt as $tt){
|
128
|
if(!in_array($tt->type, $skiptags) && strlen($tt->text) > 0){
|
129
|
$out .= (strlen($out) > 0 && ++$i < count($taggedtxt)? $glue : '').'<'.$tag.' class="'.$tt->type.'">';
|
130
|
if($tt->type == "rank" && ($tt->text == "t.infr." || $tt->text == "t.infgen.")){
|
131
|
$out .= t('[unranked]');
|
132
|
}else{
|
133
|
$out .= t($tt->text);
|
134
|
}
|
135
|
$out .= '</'.$tag.'>';
|
136
|
}
|
137
|
}
|
138
|
return $out;
|
139
|
}
|
140
|
|
141
|
function garland_cichorieae_cdm_descriptionElementArray($elementArray, $feature, $glue = '', $sortArray = false, $enclosingHtml = 'ul'){
|
142
|
$enclosingHtml = 'div';
|
143
|
$out = '<'.$enclosingHtml.' class="description" id="'.$feature.'">';
|
144
|
|
145
|
if($sortArray) sort($elementArray);
|
146
|
|
147
|
$out .= join($elementArray, $glue);
|
148
|
|
149
|
$out .= '</'.$enclosingHtml.'>';
|
150
|
return $out;
|
151
|
}
|
152
|
|
153
|
/* #### exact duplicate of theme method in cdm_dataportal.theme.php ###
|
154
|
*
|
155
|
function garland_cichorieae_cdm_descriptionElementTextData($element){
|
156
|
$description = str_replace("\n", "<br/>", $element->description);
|
157
|
return '<p class="descriptionText">' . $description . '</p>';
|
158
|
}*/
|
159
|
|
160
|
|
161
|
/**
|
162
|
* all reference links switched of
|
163
|
*/
|
164
|
function garland_cichorieae_cdm_nomenclaturalReferenceSTO($referenceSTO, $doLink = FALSE, $cssClass = '', $separator = '<br />' , $enclosingTag = 'li'){
|
165
|
|
166
|
$doLink = FALSE;
|
167
|
|
168
|
if(isset($referenceSTO->microReference)){
|
169
|
// it is a ReferenceTO
|
170
|
$nomref_citation = theme('cdm_fullreference', $referenceSTO);
|
171
|
} else {
|
172
|
// it is ReferenceSTO
|
173
|
$nomref_citation = $referenceSTO->fullCitation;
|
174
|
}
|
175
|
|
176
|
$is_IN_reference = str_beginsWith($nomref_citation, 'in');
|
177
|
|
178
|
if($doLink){
|
179
|
$nomref_citation = l($nomref_citation, "/cdm_dataportal/reference/".$referenceSTO->uuid, array(), NULL, NULL, FALSE, TRUE);
|
180
|
}
|
181
|
|
182
|
if(!empty($nomref_citation)){
|
183
|
$nomref_citation = ($is_IN_reference ? ' ':', ') . $nomref_citation;
|
184
|
}
|
185
|
|
186
|
return $nomref_citation;
|
187
|
}
|
188
|
|
189
|
|
190
|
/***** GARLAND OVERRIDES ******/
|
191
|
|
192
|
/**
|
193
|
* Sets the body-tag class attribute.
|
194
|
*
|
195
|
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
|
196
|
*/
|
197
|
function phptemplate_body_class($sidebar_left, $sidebar_right) {
|
198
|
if ($sidebar_left != '' && $sidebar_right != '') {
|
199
|
$class = 'sidebars';
|
200
|
}
|
201
|
else {
|
202
|
if ($sidebar_left != '') {
|
203
|
$class = 'sidebar-left';
|
204
|
}
|
205
|
if ($sidebar_right != '') {
|
206
|
$class = 'sidebar-right';
|
207
|
}
|
208
|
}
|
209
|
|
210
|
if (isset($class)) {
|
211
|
print ' class="'. $class .'"';
|
212
|
}
|
213
|
}
|
214
|
|
215
|
/**
|
216
|
* Return a themed breadcrumb trail.
|
217
|
*
|
218
|
* @param $breadcrumb
|
219
|
* An array containing the breadcrumb links.
|
220
|
* @return a string containing the breadcrumb output.
|
221
|
*/
|
222
|
function phptemplate_breadcrumb($breadcrumb) {
|
223
|
if (!empty($breadcrumb)) {
|
224
|
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
|
225
|
}
|
226
|
}
|
227
|
|
228
|
/**
|
229
|
* Allow themable wrapping of all comments.
|
230
|
*/
|
231
|
function phptemplate_comment_wrapper($content, $type = null) {
|
232
|
static $node_type;
|
233
|
if (isset($type)) $node_type = $type;
|
234
|
|
235
|
if (!$content || $node_type == 'forum') {
|
236
|
return '<div id="comments">'. $content . '</div>';
|
237
|
}
|
238
|
else {
|
239
|
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
|
240
|
}
|
241
|
}
|
242
|
|
243
|
/**
|
244
|
* Override or insert PHPTemplate variables into the templates.
|
245
|
*/
|
246
|
function _phptemplate_variables($hook, $vars) {
|
247
|
if ($hook == 'page') {
|
248
|
|
249
|
if ($secondary = menu_secondary_local_tasks()) {
|
250
|
$output = '<span class="clear"></span>';
|
251
|
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
|
252
|
$vars['tabs2'] = $output;
|
253
|
}
|
254
|
|
255
|
// Hook into color.module
|
256
|
if (module_exists('color')) {
|
257
|
_color_page_alter($vars);
|
258
|
}
|
259
|
return $vars;
|
260
|
}
|
261
|
return array();
|
262
|
}
|
263
|
|
264
|
/**
|
265
|
* Returns the rendered local tasks. The default implementation renders
|
266
|
* them as tabs.
|
267
|
*
|
268
|
* @ingroup themeable
|
269
|
*/
|
270
|
function phptemplate_menu_local_tasks() {
|
271
|
$output = '';
|
272
|
|
273
|
if ($primary = menu_primary_local_tasks()) {
|
274
|
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
|
275
|
}
|
276
|
|
277
|
return $output;
|
278
|
}
|