function chado_contact_load

2.x tripal_contact.chado_node.inc chado_contact_load($nodes)
3.x tripal_contact.chado_node.inc chado_contact_load($nodes)
1.x tripal_contact.module chado_contact_load($node)

Implementation of tripal_contact_load().

Parameters

$node: The node that is to be accessed from the database

Return value

$node The node with the information to be loaded into the database

File

tripal_contact/tripal_contact.module, line 469
This file contains the basic functions needed for this drupal module. The drupal tripal_contact module maps directly to the chado X module.

Code

function chado_contact_load($node) {
  // get the feature details from chado
  $contact_id = chado_get_id_for_node('contact', $node);

  $values = array('contact_id' => $contact_id);
  $contact = tripal_core_generate_chado_var('contact', $values);

  // get the contact description and replace the contact.description field with this one
  $values = array(
    'contact_id' => $contact->contact_id,
    'type_id' => array(
      'name' => 'contact_description',
    ),
  );
  $options = array(
    'return_array' => 1,
    'include_fk' => array('type_id' => 1),
  );
  $description = tripal_core_generate_chado_var('contactprop', $values, $options);
  if (count($description) == 1) {
    $description = tripal_core_expand_chado_vars($description, 'field', 'contactprop.value');
    $contact->description = $description[0]->value;
  }


  $additions = new stdClass();
  $additions->contact = $contact;
  return $additions;

}