Tripal v1.0 (6.x-1.0)
|
Go to the source code of this file.
Functions | |
tripal_organism_get_organism_by_nid ($nid) | |
tripal_organism_get_organism_by_organism_id ($organism_id) | |
tripal_organism_get_synced () |
Provides an application programming interface (API) to manage organisms
Definition in file tripal_organism.api.inc.
tripal_organism_get_organism_by_nid | ( | $ | nid | ) |
Purpose: Return a given organism object using the nid
Definition at line 18 of file tripal_organism.api.inc.
{
return node_load($nid);
}
tripal_organism_get_organism_by_organism_id | ( | $ | organism_id | ) |
Purpose: Return a given organism object using the organism id
Definition at line 31 of file tripal_organism.api.inc.
{ $sql = "SELECT nid FROM {chado_organism} WHERE organism_id=%d"; $r = db_fetch_object(db_query($sql, $organism_id)); if (!empty($r->nid)) { return node_load($r->nid); } else { drupal_set_message(t("Function: tripal_organism_get_organism_by_organism_id() -no organism with that organism id sync'd with drupal"), 'error'); } return 0; }
tripal_organism_get_synced | ( | ) |
Returns a list of organisms that are currently synced with Drupal
Definition at line 50 of file tripal_organism.api.inc.
{ // use this SQL for getting synced organisms $dsql = "SELECT * FROM {chado_organism}"; $orgs = db_query($dsql); // use this SQL statement for getting the organisms $csql = "SELECT * FROM {Organism} ". "WHERE organism_id = %d"; $org_list = array(); // iterate through the organisms and build an array of those that are synced while ($org = db_fetch_object($orgs)) { $info = db_fetch_object(chado_query($csql, $org->organism_id)); $org_list[] = $info; } return $org_list; }