Project

General

Profile

« Previous | Next » 

Revision d74aa4df

Added by Andreas Kohlbecker over 13 years ago

fixes and modifications for TDWG 2010

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
278 278
 * @return unknown
279 279
 */
280 280
function cdm_preferred_media_representations($media, array $mimeTypes, $width = 400, $height = 300){
281
  /**
282 281

  
283
  *
284
  */
285 282
  $prefRepr = array();
286 283
  if(!isset($media->representations[0])){
287 284
    return $prefRepr;
......
291 288
    // getRepresentationByMimeType
292 289
    $mimeType = array_shift($mimeTypes);
293 290

  
294
    foreach($media->representations as $representation){
291
    foreach($media->representations as &$representation){
295 292

  
296 293
    	//if the mimetype is not known, try inferring it
297 294
    	if(!$representation->mimeType){
......
351 348
	if(isset($mimemap[$extension])){
352 349
		return $mimemap[$extension];
353 350
	} else {
354
		false;
351
		return 'text/html'; //FIXME remove this hack just return false;
355 352
	}
356 353
}
357 354

  
......
474 471
  $uri = urldecode($uriEncoded);
475 472
  $theme = array_shift($args);
476 473

  
477
  //find comma sepatated string in all args
478
  foreach($args as &$arg){
479
  	if(strpos($arg, ',')){
480
  		$arg = explode(',', $arg);
481
  	}
474
  // find and deserialize arrays
475
    foreach($args as &$arg){
476
		  if( strpos($arg, "a:") === 0){ //FIXME use regex to find serialized arrays
477
		    $arg = unserialize($arg);
478
		  }
479
		  //find comma sepatated string in all args
480
//  	if(strpos($arg, ',')){
481
//  		$arg = explode(',', $arg);
482
//  	}
482 483
  }
484

  
483 485

  
484 486
  $request_method = strtoupper($_SERVER["REQUEST_METHOD"]);
485 487

  
......
709 711
  if(!$rankVocabularyOptions){
710 712
    $vocab = cdm_ws_get(CDM_WS_TERMVOCABULARY, UUID_RANK);
711 713
    $rankVocabularyOptions = array();
712
    foreach($vocab->terms as $term){
713
      $rankVocabularyOptions[$term->uuid] = t($term->representation_L10n);
714
    if($vocab){
715
	    foreach($vocab->terms as $term){
716
	      $rankVocabularyOptions[$term->uuid] = t($term->representation_L10n);
717
	    }
718
	    array_reverse($rankVocabularyOptions);
714 719
    }
715
    array_reverse($rankVocabularyOptions);
716 720
  }
717 721
  return $rankVocabularyOptions;
718 722
}
......
722 726

  
723 727
  if(!$featureTree){
724 728
    drupal_set_message('No \'FeatureTree\' has been set so far. '
725
    .'In order to see the species profiles of your taxa, please select a \'FeatureTree\' in the '.l('CDM Dataportal Settings', 'admin/settings/cdm_dataportal/general'), 'warning');
729
    .'In order to see the species profiles of your taxa, please select a \'FeatureTree\' in the '.l('CDM Dataportal Settings', 'admin/settings/cdm_dataportal/layout'), 'warning');
726 730
    return false;
727 731
  }
728 732

  
......
840 844
      // The object has been found in the L1 cache
841 845
      //
842 846
      $obj = $cacheL1_obj;
843
      _add_debugMessageStr('Using cacheL1 for: '.$uri);
847
      if(variable_get('cdm_webservice_debug', 1) && user_access('administer')){
848
      	_add_status_message_toggler();
849
        _add_debugMessageStr('Using cacheL1 for: '.$uri);
850
      }
844 851
    } else if($cacheL2_entry) {
845 852
      //
846 853
      // The object has been found in the L2 cache
......
1105 1112

  
1106 1113
function cdm_get_taxontrees_as_options(){
1107 1114
   $taxonTrees = cdm_ws_get(CDM_WS_PORTAL_TAXONOMY);
1108
    foreach($taxonTrees as $tree){
1109
        $taxonomicTreeOptions[$tree->uuid] = $tree->titleCache;
1110
    }
1111
    return $taxonomicTreeOptions;
1115
   $taxonomicTreeOptions = array();
1116
   if($taxonTrees){
1117
	    foreach($taxonTrees as $tree){
1118
	        $taxonomicTreeOptions[$tree->uuid] = $tree->titleCache;
1119
	    }
1120
   }
1121
   return $taxonomicTreeOptions;
1112 1122
}
1113 1123

  
1114 1124

  

Also available in: Unified diff