tripal_contact.module 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions needed for this drupal module.
  5. * The drupal tripal_contact module maps directly to the chado X module.
  6. *
  7. * For documentation regarding the Chado X module:
  8. * @see http://gmod.org/wiki/Chado_General_Module
  9. */
  10. require('api/tripal_contact.api.inc');
  11. require('includes/contact_sync.inc');
  12. require('includes/tripal_contact.admin.inc');
  13. require('includes/tripal_contact.form.inc');
  14. /**
  15. * @defgroup tripal_contact Contact Module
  16. * @ingroup tripal_modules
  17. * @{
  18. * Currently this module only provides support for integration with Drupal
  19. * views and some support for querying using the Tripal Core API.
  20. *
  21. * This module needs further development to support full management of
  22. * contact information within Chado, and full definitions for foreign
  23. * key relationships in Chado.
  24. * @}
  25. */
  26. /*************************************************************************
  27. * Implements hook_views_api()
  28. * Purpose: Essentially this hook tells drupal that there is views support for
  29. * for this module which then includes tripal_contact.views.inc where all the
  30. * views integration code is
  31. *
  32. * @ingroup tripal_contact
  33. */
  34. function tripal_contact_views_api() {
  35. return array(
  36. 'api' => 2.0,
  37. );
  38. }
  39. /**
  40. *
  41. * @ingroup tripal_contact
  42. */
  43. function tripal_contact_init() {
  44. drupal_add_js(drupal_get_path('module', 'tripal_contact') . '/theme/js/tripal_contact.js');
  45. drupal_add_css(drupal_get_path('module', 'tripal_contact') . '/theme/css/tripal_contact.css');
  46. }
  47. /**
  48. * Implementation of hook_tripal_contact_node_info().
  49. *
  50. * This node_info, is a simple node that describes the functionallity of the module.
  51. *
  52. */
  53. function tripal_contact_node_info() {
  54. return array(
  55. 'chado_contact' => array(
  56. 'name' => t('Contact'),
  57. 'base' => 'chado_contact',
  58. 'description' => t('A contact from the Chado database'),
  59. 'title_label' => t('Article Title'),
  60. 'body_label' => t('Abstract'),
  61. 'has_title' => TRUE,
  62. 'has_body' => FALSE,
  63. ),
  64. );
  65. }
  66. /**
  67. * Tripal-contact-Menu
  68. *
  69. * Implemets hook_menu(): Adds menu items for the tripal_contact module menu. This section
  70. * gives the outline for the main menu of the Tripal-contact module
  71. *
  72. * @return
  73. * An array of menu items that is visible within the Drupal Menu, returned as soon
  74. * as the program is ran
  75. */
  76. function tripal_contact_menu() {
  77. $items = array();
  78. $items['admin/tripal/chado/tripal_contact']= array(
  79. 'title' => 'Contacts',
  80. 'description' => ('Model persons, institutes, groups, organizations, etc.'),
  81. 'page callback' => 'tripal_contact_admin_contact_view',
  82. 'access arguments' => array('administer tripal contacts'),
  83. 'type' => MENU_NORMAL_ITEM
  84. );
  85. $items['admin/tripal/chado/tripal_contact/configuration'] = array(
  86. 'title' => 'Settings',
  87. 'description' => 'Integration of Chado contacts.',
  88. 'page callback' => 'drupal_get_form',
  89. 'page arguments' => array('tripal_contact_admin'),
  90. 'access arguments' => array('administer tripal contact'),
  91. 'type' => MENU_LOCAL_TASK,
  92. 'weight' => 5
  93. );
  94. $items['admin/tripal/chado/tripal_contact/help']= array(
  95. 'title' => 'Help',
  96. 'description' => ('Help with the contact module.'),
  97. 'page callback' => 'theme',
  98. 'page arguments' => array('tripal_contact_help'),
  99. 'access arguments' => array('administer tripal contacts'),
  100. 'type' => MENU_LOCAL_TASK,
  101. 'weight' => 10
  102. );
  103. $items['admin/tripal/chado/tripal_contact/sync'] = array(
  104. 'title' => ' Sync',
  105. 'description' => 'Sync contacts in Chado with Drupal',
  106. 'page callback' => 'drupal_get_form',
  107. 'page arguments' => array('tripal_contact_sync_form'),
  108. 'access arguments' => array('administer tripal contacts'),
  109. 'type' => MENU_LOCAL_TASK,
  110. 'weight' => 0
  111. );
  112. // AJAX calls for adding/removing properties to a contact
  113. $items['tripal_contact/properties/add'] = array(
  114. 'page callback' => 'tripal_contact_property_add',
  115. 'access arguments' => array('edit chado_contact content'),
  116. 'type ' => MENU_CALLBACK,
  117. );
  118. $items['tripal_contact/properties/description'] = array(
  119. 'page callback' => 'tripal_contact_property_get_description',
  120. 'access arguments' => array('edit chado_contact content'),
  121. 'type ' => MENU_CALLBACK,
  122. );
  123. $items['tripal_contact/properties/minus/%/%'] = array(
  124. 'page callback' => 'tripal_contact_property_delete',
  125. 'page arguments' => array(3, 4),
  126. 'access arguments' => array('edit chado_contact content'),
  127. 'type ' => MENU_CALLBACK,
  128. );
  129. return $items;
  130. }
  131. /**
  132. * Implements hook_theme(): Register themeing functions for this module
  133. *
  134. *
  135. * @return
  136. * An array of themeing functions to register
  137. *
  138. */
  139. function tripal_contact_theme($existing, $type, $theme, $path) {
  140. $core_path = drupal_get_path('module', 'tripal_core');
  141. $items = array(
  142. 'node__chado_contact' => array(
  143. 'template' => 'node--chado-generic',
  144. 'render element' => 'node',
  145. 'base hook' => 'node',
  146. 'path' => "$core_path/theme",
  147. ),
  148. 'tripal_contact_base' => array(
  149. 'variables' => array('node' => NULL),
  150. 'template' => 'tripal_contact_base',
  151. 'path' => "$path/theme/tripal_contact",
  152. ),
  153. 'tripal_contact_properties' => array(
  154. 'variables' => array('node' => NULL),
  155. 'template' => 'tripal_contact_properties',
  156. 'path' => "$path/theme/tripal_contact",
  157. ),
  158. 'tripal_contact_relationships' => array(
  159. 'variables' => array('node' => NULL),
  160. 'template' => 'tripal_contact_relationships',
  161. 'path' => "$path/theme/tripal_contact",
  162. ),
  163. 'tripal_contact_publications' => array(
  164. 'variables' => array('node' => NULL),
  165. 'template' => 'tripal_contact_publications',
  166. 'path' => "$path/theme/tripal_contact",
  167. ),
  168. 'tripal_contact_help' => array(
  169. 'template' => 'tripal_contact_help',
  170. 'variables' => array(NULL),
  171. 'path' => "$path/theme",
  172. ),
  173. 'tripal_contact_teaser' => array(
  174. 'variables' => array('node' => NULL),
  175. 'template' => 'tripal_contact_teaser',
  176. 'path' => "$path/theme/tripal_contact",
  177. ),
  178. );
  179. return $items;
  180. }
  181. /**
  182. * @ingroup tripal_contact
  183. */
  184. function tripal_contact_block_info() {
  185. $blocks['contbase']['info'] = t('Tripal Contact Details');
  186. $blocks['contbase']['cache'] = 'DRUPAL_NO_CACHE';
  187. $blocks['contprops']['info'] = t('Tripal Contact Properties');
  188. $blocks['contprops']['cache'] = 'DRUPAL_NO_CACHE';
  189. $blocks['contrels']['info'] = t('Tripal Contact Relationships');
  190. $blocks['contrels']['cache'] = 'DRUPAL_NO_CACHE';
  191. $blocks['contpubs']['info'] = t('Tripal Contact Publications');
  192. $blocks['contpubs']['cache'] = 'DRUPAL_NO_CACHE';
  193. return $blocks;
  194. }
  195. /**
  196. * @ingroup tripal_contact
  197. */
  198. function tripal_contact_block_view($delta = '') {
  199. if (user_access('access chado_contact content') and arg(0) == 'node' and is_numeric(arg(1))) {
  200. $nid = arg(1);
  201. $node = node_load($nid);
  202. $block = array();
  203. switch ($delta) {
  204. case 'contbase':
  205. $block['subject'] = t('Details');
  206. $block['content'] = array(
  207. '#theme' => 'tripal_contact_base',
  208. '#nodes' => $node,
  209. '#title' => '',
  210. );
  211. break;
  212. case 'contprops':
  213. $block['subject'] = t('Properties');
  214. $block['content'] = array(
  215. '#theme' => 'tripal_contact_properties',
  216. '#nodes' => $node,
  217. '#title' => '',
  218. );
  219. break;
  220. case 'contrels':
  221. $block['subject'] = t('Relationships');
  222. $block['content'] = array(
  223. '#theme' => 'tripal_contact_relationships',
  224. '#nodes' => $node,
  225. '#title' => '',
  226. );
  227. break;
  228. case 'contpubs':
  229. $block['subject'] = t('Publications');
  230. $block['content'] = array(
  231. '#theme' => 'tripal_contact_publications',
  232. '#nodes' => $node,
  233. '#title' => '',
  234. );
  235. break;
  236. default :
  237. }
  238. return $block;
  239. }
  240. }
  241. /**
  242. * Implement hook_perm().
  243. */
  244. function tripal_contact_permissions() {
  245. return array(
  246. 'access chado_contact content' => array(
  247. 'title' => t('View Contacts'),
  248. 'description' => t('Allow users to view contact pages.'),
  249. ),
  250. 'create chado_contact content' => array(
  251. 'title' => t('Create Contacts'),
  252. 'description' => t('Allow users to create new contact pages.'),
  253. ),
  254. 'delete chado_contact content' => array(
  255. 'title' => t('Delete Contacts'),
  256. 'description' => t('Allow users to delete contact pages.'),
  257. ),
  258. 'edit chado_contact content' => array(
  259. 'title' => t('Edit Contacts'),
  260. 'description' => t('Allow users to edit contact pages.'),
  261. ),
  262. 'adminster tripal contact' => array(
  263. 'title' => t('Administer Contacts'),
  264. 'description' => t('Allow users to administer all contacts.'),
  265. ),
  266. );
  267. }
  268. /**
  269. * Implement hook_access().
  270. *
  271. * This hook allows node modules to limit access to the node types they define.
  272. *
  273. * @param $node
  274. * The node on which the operation is to be performed, or, if it does not yet exist, the
  275. * type of node to be created
  276. *
  277. * @param $op
  278. * The operation to be performed
  279. *
  280. * @param $account
  281. * A user object representing the user for whom the operation is to be performed
  282. *
  283. * @return
  284. * If the permission for the specified operation is not set then return FALSE. If the
  285. * permission is set then return NULL as this allows other modules to disable
  286. * access. The only exception is when the $op == 'create'. We will always
  287. * return TRUE if the permission is set.
  288. *
  289. */
  290. function chado_contact_node_access($node, $op, $account ) {
  291. if ($op == 'create') {
  292. if (!user_access('create chado_contact content', $account)) {
  293. return FALSE;
  294. }
  295. return TRUE;
  296. }
  297. if ($op == 'update') {
  298. if (!user_access('edit chado_contact content', $account)) {
  299. return FALSE;
  300. }
  301. }
  302. if ($op == 'delete') {
  303. if (!user_access('delete chado_contact content', $account)) {
  304. return FALSE;
  305. }
  306. }
  307. if ($op == 'view') {
  308. if (!user_access('access chado_contact content', $account)) {
  309. return FALSE;
  310. }
  311. }
  312. return NULL;
  313. }
  314. /**
  315. * Implementation of tripal_contact_insert().
  316. *
  317. * This function inserts user entered information pertaining to the contact instance into the
  318. * 'contactauthor', 'contactprop', 'chado_contact', 'contact' talble of the database.
  319. *
  320. * @parm $node
  321. * Then node which contains the information stored within the node-ID
  322. *
  323. *
  324. */
  325. function chado_contact_insert($node) {
  326. // remove surrounding white-space on submitted values
  327. $node->title = trim($node->title);
  328. $node->description = trim($node->description);
  329. // if there is a contact_id in the $node object then this must be a sync so
  330. // we can skip adding the contact as it is already there, although
  331. // we do need to proceed with the rest of the insert
  332. if (!property_exists($node, 'contact_id')) {
  333. // insert and then get the newly inserted contact record
  334. $values = array(
  335. 'name' => $node->title,
  336. 'description' => '',
  337. 'type_id' => $node->type_id,
  338. );
  339. $contact = tripal_core_chado_insert('contact', $values);
  340. if (!$contact) {
  341. drupal_set_message(t('Unable to add contact.', 'warning'));
  342. watchdog('tripal_contact', 'Insert contact: Unable to create contact where values: %values',
  343. array('%values' => print_r($values, TRUE)), WATCHDOG_ERROR);
  344. return;
  345. }
  346. $contact_id = $contact['contact_id'];
  347. // now add in the properties
  348. $properties = tripal_core_properties_form_retreive($node, 'tripal_contact');
  349. foreach ($properties as $property => $elements) {
  350. foreach ($elements as $rank => $value) {
  351. $status = tripal_contact_insert_property($contact_id, $property, $value, FALSE);
  352. if (!$status) {
  353. drupal_set_message("Error cannot add property: $property", "error");
  354. watchdog('t_contact', "Error cannot add property: %prop",
  355. array('%property' => $property), WATCHDOG_ERROR);
  356. }
  357. }
  358. }
  359. // add in the description as a separate property
  360. tripal_contact_insert_property($contact_id, 'contact_description', $node->description, FALSE);
  361. }
  362. else {
  363. $contact_id = $node->contact_id;
  364. }
  365. // Make sure the entry for this contact doesn't already exist in the
  366. // chado_contact table if it doesn't exist then we want to add it.
  367. $check_org_id = chado_get_id_for_node('contact', $node->nid);
  368. if (!$check_org_id) {
  369. $record = new stdClass();
  370. $record->nid = $node->nid;
  371. $record->vid = $node->vid;
  372. $record->contact_id = $contact_id;
  373. drupal_write_record('chado_contact', $record);
  374. }
  375. return TRUE;
  376. }
  377. /*
  378. *
  379. * Implements hook_update
  380. *
  381. * The purpose of the function is to allow the module to take action when an edited node is being
  382. * updated. It updates any name changes to the database tables that werec reated upon registering a contact.
  383. * As well, the database will be changed, so the user changed information will be saved to the database.
  384. *
  385. * @param $node
  386. * The node being updated
  387. *
  388. * @ingroup tripal_contact
  389. */
  390. function chado_contact_update($node) {
  391. // remove surrounding white-space on submitted values
  392. $node->title = trim($node->title);
  393. $node->description = trim($node->description);
  394. $contact_id = chado_get_id_for_node('contact', $node->nid) ;
  395. // update the contact record
  396. $match = array(
  397. 'contact_id' => $contact_id,
  398. );
  399. $values = array(
  400. 'name' => $node->title,
  401. 'description' => '',
  402. 'type_id' => $node->type_id
  403. );
  404. $status = tripal_core_chado_update('contact', $match, $values);
  405. if (!$status) {
  406. drupal_set_message("Error updating contact", "error");
  407. watchdog('t_contact', "Error updating contact", array(), WATCHDOG_ERROR);
  408. return;
  409. }
  410. // now add in the properties by first removing any the contact
  411. // already has and adding the ones we have
  412. tripal_core_chado_delete('contactprop', array('contact_id' => $contact_id));
  413. $properties = tripal_core_properties_form_retreive($node, 'tripal_contact');
  414. foreach ($properties as $property => $elements) {
  415. foreach ($elements as $rank => $value) {
  416. $status = tripal_contact_insert_property($contact_id, $property, $value, FALSE);
  417. if (!$status) {
  418. drupal_set_message("Error cannot add property: '$property'", "error");
  419. watchdog('t_contact', "Error cannot add property: '%prop'",
  420. array('%prop' => $property), WATCHDOG_ERROR);
  421. }
  422. }
  423. }
  424. // add in the description as a separate property
  425. tripal_contact_update_property($contact_id, 'contact_description', $node->description, 1);
  426. }
  427. /**
  428. * Implementation of tripal_contact_load().
  429. *
  430. *
  431. * @param $node
  432. * The node that is to be accessed from the database
  433. *
  434. * @return $node
  435. * The node with the information to be loaded into the database
  436. *
  437. */
  438. function chado_contact_load($nodes) {
  439. foreach ($nodes as $nid => $node) {
  440. // find the contact and add in the details
  441. $contact_id = chado_get_id_for_node('contact', $nid);
  442. // get the contact
  443. $values = array('contact_id' => $contact_id);
  444. $contact = tripal_core_generate_chado_var('contact', $values);
  445. // get the contact description from the contactprop table and replace
  446. // the contact.description field with this one (we don't use the contact.description
  447. // field because it is only 255 characters (too small)).
  448. $values = array(
  449. 'contact_id' => $contact->contact_id,
  450. 'type_id' => array(
  451. 'name' => 'contact_description',
  452. ),
  453. );
  454. $options = array(
  455. 'return_array' => 1,
  456. 'include_fk' => array('type_id' => 1),
  457. );
  458. $description = tripal_core_generate_chado_var('contactprop', $values, $options);
  459. if (count($description) == 1) {
  460. $description = tripal_core_expand_chado_vars($description, 'field', 'contactprop.value');
  461. $contact->description = $description[0]->value;
  462. }
  463. $nodes[$nid]->contact = $contact;
  464. }
  465. }
  466. /**
  467. * Implementation of tripal_contact_delete().
  468. *
  469. * This function takes a node and if the delete button has been chosen by the user, the contact
  470. * and it's details will be removed.Following,given the node-ID, the instance will be deleted from
  471. * the 'chado_contact' table.
  472. *
  473. * @parm $node
  474. * Then node which contains the information stored within the node-ID
  475. *
  476. */
  477. function chado_contact_delete(&$node) {
  478. $contact_id = chado_get_id_for_node('contact', $node->nid);
  479. // if we don't have a contact id for this node then this isn't a node of
  480. // type chado_contact or the entry in the chado_contact table was lost.
  481. if (!$contact_id) {
  482. return;
  483. }
  484. // Remove data from {chado_contact}, {node} and {node_revisions} tables of
  485. // drupal database
  486. $sql_del = "DELETE FROM {chado_contact} WHERE nid = :nid AND vid = :vid";
  487. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  488. $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
  489. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  490. $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
  491. db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
  492. // Remove data from contact and contactprop tables of chado database as well
  493. chado_query("DELETE FROM {contactprop} WHERE contact_id = :contact_id", array(':contact_id' => $contact_id));
  494. chado_query("DELETE FROM {contact} WHERE contact_id = :contact_id", array(':contact_id' => $contact_id));
  495. }
  496. /**
  497. *
  498. *
  499. * @ingroup tripal_contact
  500. */
  501. function tripal_contact_preprocess_tripal_contact_relationships(&$variables) {
  502. // we want to provide a new variable that contains the matched contacts.
  503. $contact = $variables['node']->contact;
  504. // normally we would use tripal_core_expand_chado_vars to expand our
  505. // organism object and add in the relationships, however whan a large
  506. // number of relationships are present this significantly slows the
  507. // query, therefore we will manually perform the query
  508. $sql = "
  509. SELECT C.name, C.contact_id, CP.nid, CVT.name as rel_type
  510. FROM {contact_relationship} PR
  511. INNER JOIN {contact} C ON PR.object_id = C.contact_id
  512. INNER JOIN {cvterm} CVT ON PR.type_id = CVT.cvterm_id
  513. LEFT JOIN public.chado_contact CP ON C.contact_id = CP.contact_id
  514. WHERE PR.subject_id = :contact_id
  515. ";
  516. $as_subject = chado_query($sql, array(':contact_id' => $contact->contact_id));
  517. $sql = "
  518. SELECT C.name, C.contact_id, CP.nid, CVT.name as rel_type
  519. FROM {contact_relationship} PR
  520. INNER JOIN {contact} C ON PR.subject_id = C.contact_id
  521. INNER JOIN {cvterm} CVT ON PR.type_id = CVT.cvterm_id
  522. LEFT JOIN public.chado_contact CP ON C.contact_id = CP.contact_id
  523. WHERE PR.object_id = :contact_id
  524. ";
  525. $as_object = chado_query($sql, array(':contact_id' => $contact->contact_id));
  526. // combine both object and subject relationshisp into a single array
  527. $relationships = array();
  528. $relationships['object'] = array();
  529. $relationships['subject'] = array();
  530. // iterate through the object relationships
  531. while ($relationship = $as_object->fetchObject()) {
  532. // get the relationship and child types
  533. $rel_type = t(preg_replace('/_/', " ", $relationship->rel_type));
  534. $sub_type = t(preg_replace('/_/', " ", $relationship->sub_type));
  535. if (!array_key_exists($rel_type, $relationships['object'])) {
  536. $relationships['object'][$rel_type] = array();
  537. }
  538. if (!array_key_exists($sub_type, $relationships['object'][$rel_type])) {
  539. $relationships['object'][$rel_type][$sub_type] = array();
  540. }
  541. $relationships['object'][$rel_type][$sub_type][] = $relationship;
  542. }
  543. // now add in the subject relationships
  544. while ($relationship = $as_subject->fetchObject()) {
  545. // get the relationship and child types
  546. $rel_type = t(preg_replace('/_/', " ", $relationship->rel_type));
  547. $obj_type = t(preg_replace('/_/', " ", $relationship->obj_type));
  548. if (!array_key_exists($rel_type, $relationships['subject'])) {
  549. $relationships['subject'][$rel_type] = array();
  550. }
  551. if (!array_key_exists($obj_type, $relationships['subject'][$rel_type])) {
  552. $relationships['subject'][$rel_type][$obj_type] = array();
  553. }
  554. $relationships['subject'][$rel_type][$obj_type][] = $relationship;
  555. }
  556. $contact->all_relationships = $relationships;
  557. }
  558. /**
  559. * Implementation of hook_form_alter()
  560. *
  561. * @param $form
  562. * @param $form_state
  563. * @param $form_id
  564. */
  565. function tripal_contact_form_alter(&$form, &$form_state, $form_id) {
  566. // turn of preview button for insert/updates
  567. if ($form_id == "chado_contact_node_form") {
  568. $form['actions']['preview']['#access'] = FALSE;
  569. }
  570. }
  571. /**
  572. *
  573. * @ingroup tripal_feature
  574. */
  575. function tripal_contact_node_view($node, $view_mode, $langcode) {
  576. switch ($node->type) {
  577. case 'chado_contact':
  578. // Show feature browser and counts
  579. if ($view_mode == 'full') {
  580. $node->content['tripal_contact_base'] = array(
  581. '#value' => theme('tripal_contact_base', array('node' => $node)),
  582. );
  583. $node->content['tripal_contact_properties'] = array(
  584. '#value' => theme('tripal_contact_properties', array('node' => $node)),
  585. );
  586. $node->content['tripal_contact_publications'] = array(
  587. '#value' => theme('tripal_contact_publications', array('node' => $node)),
  588. );
  589. $node->content['tripal_contact_relationships'] = array(
  590. '#value' => theme('tripal_contact_relationships', array('node' => $node)),
  591. );
  592. }
  593. if ($view_mode == 'teaser') {
  594. $node->content['tripal_contact_teaser'] = array(
  595. '#value' => theme('tripal_contact_teaser', array('node' => $node)),
  596. );
  597. }
  598. break;
  599. }
  600. }