Project

General

Profile

« Previous | Next » 

Revision 6d3d2b4a

Added by Francisco Revilla almost 14 years ago

fixing showing repeated sources(citations) on FOOTNOTES

View differences:

modules/cdm_dataportal/theme/cdm_dataportal.common.theme
169 169
/* ============================ footnotes ============================= */
170 170

  
171 171
function theme_cdm_footnote_key($footnoteKey, $separator = '', $highlightable=true){
172
	if (!$footnoteKey->footnoteListKey){
173
		//var_dump('#####' . $footnoteKey);
174
		return ''; 	  
175
	}
172 176
  $out = '<span class="footnote-key footnote-key-'.$footnoteKey->keyStr.' member-of-footnotes-'.$footnoteKey->footnoteListKey.'">'.$separator
173 177
        .'<a href="#footnote-'.$footnoteKey->keyStr.'">'.$footnoteKey->keyStr.'</a>'
174 178
        .'</span>';
......
188 192
	return $out;
189 193
}
190 194

  
195
function cdm_exist_footnote($footnote_list, $footnote){
196
	$result = false;
197
	foreach ($footnote_list as $element){
198
		if ($element == $footnote){
199
			$result = true;
200
		}
201
	}
202
	return $result;
203
}
204

  
205
function cdm_add_footnote_to_array(&$footnote_list, $footnote){
206
	if(!cdm_exist_footnote($footnote_list, $footnote)){
207
		$footnote_list[] = $footnote;		
208
	}
209
}
191 210

  
192 211
/* ============================ pager ============================= */
193 212

  
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
258 258
				foreach($element->sources as $source){
259 259
					if(_is_original_source_type($source)){
260 260
						$_fkey = FootnoteManager::addNewFootnote(UUID_COMMON_NAME, theme('cdm_DescriptionElementSource', $source, false));
261
						$sourcesFootnoteKeyList .= theme('cdm_footnote_key', $_fkey, ($sourcesFootnoteKeyList ? $separator : ''));
261
						$sourcesFootnoteKeyList .= theme('cdm_footnote_key', $_fkey, ($sourcesFootnoteKeyList ? $separator : ''));						
262 262
					}
263 263
				}
264 264
				$rendered_element_list .= (strlen($rendered_element_list) > 0 ? ', ': '') . $element->name . $sourcesFootnoteKeyList;
......
345 345
		// source references as footnotes
346 346
		foreach($descriptionElement->sources as $source){
347 347
			if(_is_original_source_type($source)){
348
				$footNoteKeys[] = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
348
				$fn_key = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
349
        cdm_add_footnote_to_array($footNoteKeys, $fn_key);// ensure uniqueness of the footnote keys
349 350
			}
350 351
		}
351 352
		// sort and render footnote keys
......
402 403
        $footNoteKeys2 = cdm_annotations_as_footnotekeys($element_l3->data);
403 404
				foreach($element_l3->data->sources as $source){
404 405
					if(_is_original_source_type($source)){
405
						$footNoteKeys2[] = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
406
						//$footNoteKeys2[] = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));						
407
						$fn_key = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
408
            cdm_add_footnote_to_array($footNoteKeys2, $fn_key);           
406 409
					}
407 410
				}
408 411
		    foreach($footNoteKeys2 as $key){
409
          $footnoteKeyListStr2 .= theme('cdm_footnote_key', $key, ($footnoteKeyListStr2 ? $separator : ''));
412
            $footnoteKeyListStr2 .= theme('cdm_footnote_key', $key, ($footnoteKeyListStr2 ? $separator : ''));
410 413
        }
411 414
				$out_l4 .= $l3 . $footnoteKeyListStr2 . ', ';
412 415
			}
......
419 422
						$footNoteKeys = cdm_annotations_as_footnotekeys($element_l4->data);
420 423
						foreach($element_l4->data->sources as $source){
421 424
							if(_is_original_source_type($source)){
422
								$footNoteKeys[] = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
425
								//$footNoteKeys[] = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
426
								$fn_key = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
427
								cdm_add_footnote_to_array($footNoteKeys, $fn_key);
423 428
							}
424 429
						}
425 430
						foreach($footNoteKeys as $key){
......
440 445
			}
441 446
		}
442 447
		$out = substr($out, 0, -2);
443
		$out .= '<br>';
448
		$out .= '.<br>';
444 449
	}
445 450
	RenderHints::popFromRenderStack();
446 451
	return $out;

Also available in: Unified diff