Project

General

Profile

« Previous | Next » 

Revision 12196fd5

Added by Francisco Revilla over 13 years ago

type designations with footnotes

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
21 21
require_once ('webservice_uris.php');
22 22
require_once ('cdm_node.php');
23 23

  
24
define('DEFAULT_TAXONTREE_RANKLIMIT', '');//TODO Genus UUID
24
define('DEFAULT_TAXONTREE_RANKLIMIT', '1b11c34c-48a8-4efa-98d5-84f7f66ef43a');//TODO Genus UUID
25 25

  
26 26

  
27 27
/**
......
98 98
  $form['cdm_webservice']['taxontree_ranklimit'] =  array(
99 99
    '#type'          => 'select',
100 100
    '#title'         => t('Rank of highest displayed taxon'),
101
    '#default_value' => variable_get('taxontree_ranklimit', DEFAULT_TAXONTREE_RANKLIMIT_UUID),
101
    '#default_value' => variable_get('taxontree_ranklimit', DEFAULT_TAXONTREE_RANKLIMIT), //before DEFAULT_TAXONTREE_RANKLIMIT_UUID
102 102
    '#options'       => cdm_rankVocabulary_as_option(),
103 103
    '#description'   => t('The rank of the highest displayed taxon in the taxontree.'),
104 104
  );
modules/cdm_dataportal/cdm_api/webservice_uris.php
8 8

  
9 9
define('CDM_WS_TAXON', 'taxon');
10 10

  
11
define('CDM_WS_NAME_TYPEDESIGNATIONS', 'portal/name/$0/typeDesignations');
11
define('CDM_WS_NAME_TYPEDESIGNATIONS', 'name/$0/typeDesignations');
12

  
13
define('CDM_WS_PORTAL_NAME_TYPEDESIGNATIONS', 'portal/name/$0/typeDesignations');
12 14

  
13 15
define('CDM_WS_PORTAL_TAXON_NAMETYPEDESIGNATIONS', 'portal/taxon/$0/nameTypeDesignations');
14 16

  
modules/cdm_dataportal/classes/footnotemanager.php
33 33
      return array_key_exists($footnoteListKey, self::$fnstore) ? self::$fnstore[$footnoteListKey] : NULL;
34 34
    }
35 35
    
36
    /**
37
     * 
38
     * @param $footnoteListKey a string as key to the list of footnotes
39
     * @return
40
     */
41
    public static function removeFootnoteList($footnoteListKey){
42
      if(array_key_exists($footnoteListKey, self::$fnstore)) {
43
	      unset(self::$fnstore[$footnoteListKey]);
44
      }
45
    }
46
    
36 47
    /**
37 48
     * 
38 49
     * @param $footnoteListKey
modules/cdm_dataportal/theme/cdm_dataportal.common.theme
188 188
function theme_cdm_footnotes($footnoteListKey, $enclosingTag = 'span'){
189 189
	
190 190
	$out = '<'.$enclosingTag.' class="footnotes footnotes-'.$footnoteListKey.' ">' . FootnoteManager::renderFootnoteList($footnoteListKey) . '</'.$enclosingTag.'>';
191
	FootnoteManager::removeFootnoteList($footnoteListKey);
191 192
	return $out;
192 193
}
193 194

  
modules/cdm_dataportal/theme/cdm_dataportal.name.theme
16 16
 * @param $typeDesignation_citation The lectotype citation to print
17 17
 * @return html valid string
18 18
 */
19
function lectotype_citation_layout($typeDesignation_citation){
19
function lectotype_citation_layout($typeDesignation){
20

  
20 21
	$res = '';
21
	if ($typeDesignation_citation){
22
	$citation = $typeDesignation->citation;
23
	$pages = $typeDesignation->citationMicroReference;
24
	if ($citation){
22 25
		//$type = $typeDesignation_citation->type;
23
		$year = substr($typeDesignation_citation->datePublished->start, 0, 4);
24
		$page = $typeDesignation_citation->page;
25
		$author = $typeDesignation_citation->authorTeam->titleCache;
26
		$year = substr($citation->datePublished->start, 0, 4);
27
		$author = $citation->authorTeam->titleCache;
26 28
		$res .= ' (designated by ';
27 29
		$res .= $author;
28 30
		$res .= ($year ? ' '.$year : '');
29
		$res .= ($year && $page ? ': '. $page : '');
31
		$res .= ($pages ? ': '. $pages : '');
30 32
		//$res .= ')';
31
		//$res .= ($type ? ': ' . $type : '');
32 33
	}
33 34
	return $res;
34 35
}
35 36

  
36 37
function theme_cdm_typedesignations($typeDesignations = array()){
37

  
38
	RenderHints::pushToRenderStack('typedesignations');
38
/*
39
	if(isset($renderTemplate['referencePart']['reference']) && $taxonName->nomenclaturalReference){
40
      $microreference = null;
41
      if(isset($renderTemplate['referencePart']['microreference'])){
42
        $microreference = $taxonName->nomenclaturalMicroReference;
43
      }
44
      $citation = cdm_ws_get(CDM_WS_NOMENCLATURAL_REFERENCE_CITATION, array($typeDesignation->uuid), "microReference=".urlencode($microreference));
45
      $citation = $citation->String;
46
*/      
47
	
48
  RenderHints::pushToRenderStack('typedesignations');
39 49
	//_add_js_cluetip();
40 50
	$out = '<ul class="typeDesignations">';
41 51
  $typeDesignation_footnotes = false;
......
47 57
		}else {
48 58
			// it's a NameTypeDesignation
49 59
			if($typeDesignation->notDesignated){
50
				$out .= '<li class="nameTypeDesignation"><span class="status">Lectotype</span> '.t('not designated'). '</li>';
60
				$out .= '<li class="nameTypeDesignation"><span class="status">Lectotype</span>: '.t('not designated'). '</li>';
51 61
			}else if($typeDesignation->typeName){
52 62
				$link_to_name_page = '?q=' . path_to_name($typeDesignation->typeName->uuid);
53
				$out .= '<li class="nameTypeDesignation"><span class="status">Lectotype</span> ';
63
				$out .= '<li class="nameTypeDesignation"><span class="status">Lectotype</span>';
54 64

  
55
			if($typeDesignation->citation){
56
          $out .= lectotype_citation_layout($typeDesignation->citation);
65
			if($typeDesignation->citation){				
66
          $out .= lectotype_citation_layout($typeDesignation);
57 67
          //footnotes
58 68
          $fkey_typeDesignation = FootnoteManager::addNewFootnote(RenderHints::getRenderPath() . '-typeDesignations-' . $typeDesignation->uuid, $typeDesignation->citation->titleCache);
59
          $out .= theme('cdm_footnote_key', $fkey_typeDesignation) . '): ';          
60
          $typeDesignation_footnotes = true;
69
          $out .= theme('cdm_footnote_key', $fkey_typeDesignation) . ')';          
61 70
        }
62 71
				
63 72
				if($typeDesignation->typeName->nomenclaturalReference){
64 73
					$referenceUri = url(path_to_reference($typeDesignation->typeName->nomenclaturalReference->uuid));
65 74
				}
66
				$out .= theme('cdm_taxonName', $typeDesignation->typeName, $link_to_name_page, $referenceUri);
67
				
75
                   
76
				$out .= ': ' . theme('cdm_taxonName', $typeDesignation->typeName, $link_to_name_page, $referenceUri);
68 77
			}
69 78
		}
70 79
	}
......
122 131
		$out .= theme('cdm_footnotes', RenderHints::getRenderPath() . '-lectotypes');
123 132
	}
124 133
	$out .= theme('cdm_footnotes', RenderHints::getRenderPath() . '-acronyms');
125
	if ($typeDesignation_footnotes){
126
	  $out .= theme('cdm_footnotes', RenderHints::getRenderPath() . '-typeDesignations-' . $typeDesignation->uuid);  
127
	}
134
	
135
	$out .= theme('cdm_footnotes', RenderHints::getRenderPath() . '-typeDesignations-' . $typeDesignation->uuid);  
136
	
128 137
	RenderHints::popFromRenderStack();
129 138
	return $out;
130 139
}
......
231 240
	foreach($homotypicalGroup as $synonym){
232 241
		if($is_first_entry){
233 242
			$is_first_entry = false;
234
			$typeDesignations = cdm_ws_get(CDM_WS_NAME_TYPEDESIGNATIONS, $synonym->name->uuid);
243
			$typeDesignations = cdm_ws_get(CDM_WS_PORTAL_NAME_TYPEDESIGNATIONS, $synonym->name->uuid);
235 244
			// is first list entry
236 245
			$out .= '<li class="firstentry synonym">'.theme('cdm_related_taxon',$synonym, UUID_HETEROTYPIC_SYNONYM_OF).'</li>';
237 246
		} else {
......
281 290
		$out .= '<li class="synonym">'.theme('cdm_related_taxon', $synonym, UUID_HOMOTYPIC_SYNONYM_OF).'</li>';
282 291
	}
283 292

  
284
	$typeDesignations = cdm_ws_get(CDM_WS_NAME_TYPEDESIGNATIONS, $synonymList[0]->name->uuid);
293
	$typeDesignations = cdm_ws_get(CDM_WS_PORTAL_NAME_TYPEDESIGNATIONS, $synonymList[0]->name->uuid);
285 294
	if($typeDesignations){
286 295
		$out .= theme('cdm_typedesignations', $typeDesignations);
287 296
	}
modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
126 126
	$out .= '</ul>';
127 127

  
128 128
	//$out .= theme('cdm_footnotes', $footnoteListKey, 'div');
129
	$test = theme('cdm_footnotes', $footnoteListKey, 'div');
130
	
131
	$out .= $test;
129
	$tr_footnotes = theme('cdm_footnotes', $footnoteListKey, 'div');
130
	$tr_footnotes_exploded = explode('sensu', $tr_footnotes);
131
	$tr_footnotes_aux = '';
132
	foreach ($tr_footnotes_exploded as $element){
133
		$tr_footnotes_aux .= $element; 
134
	}
135
	$out .= $tr_footnotes_aux;
132 136
	
133 137
	RenderHints::popFromRenderStack();
134 138
	return $out;

Also available in: Unified diff