tripal_project.api.inc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * @file
  4. * @todo Add file header description
  5. */
  6. /**
  7. * @defgroup tripal_project_api Library Module API
  8. * @ingroup tripal_api
  9. * @ingroup tripal_project
  10. */
  11. /**
  12. * Retrieve properties of a given type for a given project
  13. *
  14. * @param $project_id
  15. * The project_id of the properties you would like to retrieve
  16. * @param $property
  17. * The cvterm name of the properties to retrieve
  18. *
  19. * @return
  20. * An project chado variable with the specified properties expanded
  21. *
  22. * @ingroup tripal_project_api
  23. */
  24. function tripal_project_get_property($project_id, $property) {
  25. return tripal_core_get_property('project', $project_id, $property, 'tripal');
  26. }
  27. /**
  28. * Insert a given property
  29. *
  30. * @param $project_id
  31. * The project_id of the property to insert
  32. * @param $property
  33. * The cvterm name of the property to insert
  34. * @param $value
  35. * The value of the property to insert
  36. * @param $update_if_present
  37. * A boolean indicated whether to update the record if it's already present
  38. *
  39. * @return
  40. * True of success, False otherwise
  41. *
  42. * @ingroup tripal_project_api
  43. */
  44. function tripal_project_insert_property($project_id, $property, $value, $update_if_present = 0) {
  45. return tripal_core_insert_property('project', $project_id, $property, 'tripal', $value, $update_if_present);
  46. }
  47. /**
  48. * Update a given property
  49. *
  50. * @param $project_id
  51. * The project_id of the property to update
  52. * @param $property
  53. * The cvterm name of the property to update
  54. * @param $value
  55. * The value of the property to update
  56. * @param $insert_if_missing
  57. * A boolean indicated whether to insert the record if it's absent
  58. *
  59. * Note: The property will be identified using the unique combination of the $project_id and $property
  60. * and then it will be updated with the supplied value
  61. *
  62. * @return
  63. * True of success, False otherwise
  64. *
  65. * @ingroup tripal_project_api
  66. */
  67. function tripal_project_update_property($project_id, $property, $value, $insert_if_missing = 0) {
  68. return tripal_core_update_property('project', $project_id, $property, 'tripal', $value, $insert_if_missing);
  69. }
  70. /**
  71. * Delete a given property
  72. *
  73. * @param $project_id
  74. * The project_id of the property to delete
  75. * @param $property
  76. * The cvterm name of the property to delete
  77. *
  78. * Note: The property will be identified using the unique combination of the $project_id and $property
  79. * and then it will be deleted
  80. *
  81. * @return
  82. * True of success, False otherwise
  83. *
  84. * @ingroup tripal_project_api
  85. */
  86. function tripal_project_delete_property($project_id, $property) {
  87. return tripal_core_delete_property('project', $project_id, $property, 'tripal');
  88. }