tripal_project.api.inc 2.6 KB

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