Project

General

Profile

« Previous | Next » 

Revision 1bc28c7e

Added by Andreas Kohlbecker over 16 years ago

View differences:

modules/cdm_dataportal/cdm/cdm_api.php
24 24
   return $out;
25 25
}
26 26

  
27
/**
28
 * Loads the XML response for the given url from the CDM Data Store Webservice.
29
 * The XML is turned into a object wich is retuned. Incase of an error a 
30
 * approriate watchdog message is generated and the function returns false.
31
 * 
32
 * 
33
 *
34
 * @param String $url the relative url of the web service call. 
35
 *        Relative means relative to the web service base url which is stored in cdm_webservice_url
36
 * @return An object or false
37
 */
38
function cdm_ws_load($url){
39

  
40
  $obj = simplexml_load_file(variable_get('cdm_webservice_url', '').$url);
41
  if(!$obj){
42
    $backtrace = debug_backtrace();
43
    watchdog('CDM', $backtrace[1]['function'].' - failed to load '.$url, WATCHDOG_ERROR);
44
  }
45
  return $obj;
46
}
47

  
27 48
/**
28 49
 * The whatis service returns the type 
29 50
 * i.e. DTO class name and simplename & cdm class name and simplename of the instance referenced by the $uuid parameter. 
30 51
 * 
31 52
 *
32 53
 * @param unknown_type $uuid
33
 * @return false if the cdm store has no matching instance. An associative array with the following key, value pairs:
34
 *   - 'cdmName': name of the cdm class as returned by Class.getName()
35
 *   - ' 
54
 * @return false if the cdm store contains no matching instance. An associative array with the following key-value pairs:
55
 *   - 'cdmName':       name of the cdm class as returned by Class.getName(), e.g. eu.etaxonomy.cdm.model.taxon.Taxon
56
 *   - 'cdmSimpleName': simple name of the cdm class as returned by Class.getSimpleName(), e.g. Taxon
57
 *   - 'dtoName':       name of the DTO class as returned by Class.getName(), e.g. eu.etaxonomy.cdm.dto.TaxonTO
58
 *   - 'dtoSimpleName': simple name of the TDO class as returned by Class.getSimpleName(), e.g. TaxonTO
36 59
 */
37 60
function cdm_ws_whatis($uuid){
38
  
61
  return cdm_ws_load("whatis/?uuid=$uuid");
39 62
}
40 63

  
41 64
/**
......
45 68
 * @return a NameTO instance or false 
46 69
 */
47 70
function cdm_ws_get_nameTO($uuid){
48
  
49
  $url = variable_get('cdm_webservice_url', '')."name/?uuid=$uuid";
50
  $name = simplexml_load_file(url);
51
  if(!$name){
52
    watchdog('CDM', "cdm_get_nameTO() - failed to load $url", WATCHDOG_ERROR);
53
  }
54
  return $name;
71
  return cdm_ws_load("name/?uuid=$uuid");
55 72
}
56 73

  
57 74
/**
......
60 77
 * @param unknown_type $page
61 78
 * @param unknown_type $hide_unaccepted
62 79
 */
63
function cdm_ws_list_names($page = 1, $hide_unaccepted){
80
function cdm_ws_nameTO_list($page = 1, $hide_unaccepted){
64 81
   
65 82
}

Also available in: Unified diff