tripal_cv.DEPRECATED.inc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <?php
  2. /**
  3. * @file
  4. * Wrapper functions to provide backwards compatibility for the tripal cv api
  5. */
  6. /**
  7. * @deprecated Restructured API to make naming more readable and consistent.
  8. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  9. * now. This function has been replaced by tripal_get_cv().
  10. *
  11. * @see tripal_get_cv().
  12. */
  13. function tripal_cv_get_cv($select_values) {
  14. tripal_report_error(
  15. 'tripal_deprecated',
  16. TRIPAL_NOTICE,
  17. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  18. [
  19. '%old_function' => 'tripal_cv_get_cv',
  20. '%new_function' => 'tripal_get_cv',
  21. ]
  22. );
  23. return tripal_get_cv($select_values);
  24. }
  25. /**
  26. * @deprecated Restructured API to make naming more readable and consistent.
  27. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  28. * now. This function has been replaced by tripal_get_cv().
  29. *
  30. * @see tripal_get_cv().
  31. */
  32. function tripal_cv_get_cv_by_name($name) {
  33. tripal_report_error(
  34. 'tripal_deprecated',
  35. TRIPAL_NOTICE,
  36. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  37. [
  38. '%old_function' => 'tripal_cv_get_cv_by_name',
  39. '%new_function' => 'tripal_get_cv',
  40. ]
  41. );
  42. return tripal_get_cv(['name' => $name]);
  43. }
  44. /**
  45. * @deprecated Restructured API to make naming more readable and consistent.
  46. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  47. * now. This function has been replaced by tripal_get_cv().
  48. *
  49. * @see tripal_get_cv().
  50. */
  51. function tripal_cv_get_cv_by_id($cv_id) {
  52. tripal_report_error(
  53. 'tripal_deprecated',
  54. TRIPAL_NOTICE,
  55. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  56. [
  57. '%old_function' => 'tripal_cv_get_cv_by_id',
  58. '%new_function' => 'tripal_get_cv',
  59. ]
  60. );
  61. return tripal_get_cv(['cv_id' => $id]);
  62. }
  63. /**
  64. * @deprecated Restructured API to make naming more readable and consistent.
  65. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  66. * now. This function has been replaced by tripal_get_cv().
  67. *
  68. * @see tripal_get_cv().
  69. */
  70. function tripal_cv_get_cv_id($cv_name) {
  71. tripal_report_error(
  72. 'tripal_deprecated',
  73. TRIPAL_NOTICE,
  74. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  75. [
  76. '%old_function' => 'tripal_cv_get_cv_id',
  77. '%new_function' => 'tripal_get_cv',
  78. ]
  79. );
  80. $cv = tripal_get_cv(['name' => $cv_name]);
  81. if (isset($cv->cv_id)) {
  82. return $cv->cv_id;
  83. }
  84. else {
  85. return FALSE;
  86. }
  87. }
  88. /**
  89. * @deprecated Restructured API to make naming more readable and consistent.
  90. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  91. * now. This function has been replaced by tripal_get_cv_select_options().
  92. *
  93. * @see tripal_get_cv_select_options().
  94. */
  95. function tripal_cv_get_cv_options() {
  96. tripal_report_error(
  97. 'tripal_deprecated',
  98. TRIPAL_NOTICE,
  99. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  100. [
  101. '%old_function' => 'tripal_cv_get_cv_options',
  102. '%new_function' => 'tripal_get_cv_select_options',
  103. ]
  104. );
  105. return tripal_get_cv_select_options();
  106. }
  107. /**
  108. * @deprecated Restructured API to make naming more readable and consistent.
  109. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  110. * now. This function has been replaced by tripal_get_cvterm().
  111. *
  112. * @see tripal_get_cvterm().
  113. */
  114. function tripal_cv_get_cvterm_by_id($cvterm_id) {
  115. tripal_report_error(
  116. 'tripal_deprecated',
  117. TRIPAL_NOTICE,
  118. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  119. [
  120. '%old_function' => 'tripal_cv_get_cvterm_by_id',
  121. '%new_function' => 'tripal_get_cvterm',
  122. ]
  123. );
  124. return tripal_get_cvterm(['cvterm_id' => $cvterm_id]);
  125. }
  126. /**
  127. * @deprecated Restructured API to make naming more readable and consistent.
  128. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  129. * now. This function has been replaced by tripal_get_cvterm().
  130. *
  131. * @see tripal_get_cvterm().
  132. */
  133. function tripal_cv_get_cvterm_by_name($name, $cv_id = NULL, $cv_name = 'tripal') {
  134. tripal_report_error(
  135. 'tripal_deprecated',
  136. TRIPAL_NOTICE,
  137. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  138. [
  139. '%old_function' => 'tripal_cv_get_cvterm_by_name',
  140. '%new_function' => 'tripal_get_cvterm',
  141. ]
  142. );
  143. $identifiers = ['name' => $name];
  144. if (isset($cv_id)) {
  145. $identifiers['cv_id'] = $cv_id;
  146. }
  147. if (isset($cv_name)) {
  148. $identifiers['cv_id'] = [
  149. 'name' => $cv_name,
  150. ];
  151. }
  152. return tripal_get_cvterm($identifiers);
  153. }
  154. /**
  155. * @deprecated Restructured API to make naming more readable and consistent.
  156. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  157. * now. This function has been replaced by tripal_get_cvterm().
  158. *
  159. * @see tripal_get_cvterm().
  160. */
  161. function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tripal') {
  162. tripal_report_error(
  163. 'tripal_deprecated',
  164. TRIPAL_NOTICE,
  165. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  166. [
  167. '%old_function' => 'tripal_cv_get_cvterm_by_synonym',
  168. '%new_function' => 'tripal_get_cvterm',
  169. ]
  170. );
  171. return tripal_get_cvterm([
  172. 'synonym' => [
  173. 'name' => $synonym,
  174. 'cv_id' => $cv_id,
  175. 'cv_name' => $cv_name,
  176. ],
  177. ]);
  178. }
  179. /**
  180. * @deprecated Restructured API to make naming more readable and consistent.
  181. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  182. * now. This function has been replaced by
  183. * tripal_get_cvterm_select_options().
  184. *
  185. * @see tripal_get_cvterm_select_options().
  186. */
  187. function tripal_cv_get_cvterm_options($cv_id = 0) {
  188. tripal_report_error(
  189. 'tripal_deprecated',
  190. TRIPAL_NOTICE,
  191. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  192. [
  193. '%old_function' => 'tripal_cv_get_cvterm_options',
  194. '%new_function' => 'tripal_get_cvterm_select_options',
  195. ]
  196. );
  197. return tripal_get_cvterm_select_options($cv_id);
  198. }
  199. /**
  200. * @deprecated Restructured API to make naming more readable and consistent.
  201. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  202. * now. This function has been replaced by tripal_update_cvtermpath().
  203. *
  204. * @see tripal_update_cvtermpath().
  205. */
  206. function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
  207. tripal_report_error(
  208. 'tripal_deprecated',
  209. TRIPAL_NOTICE,
  210. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  211. [
  212. '%old_function' => 'tripal_cv_update_cvtermpath',
  213. '%new_function' => 'tripal_update_cvtermpath',
  214. ]
  215. );
  216. return tripal_update_cvtermpath($cvid, $job_id);
  217. }
  218. /**
  219. * @deprecated Restructured API to make naming more readable and consistent.
  220. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  221. * now. This function has been replaced by tripal_insert_cv().
  222. *
  223. * @see tripal_insert_cv().
  224. */
  225. function tripal_cv_add_cv($name, $definition) {
  226. tripal_report_error(
  227. 'tripal_deprecated',
  228. TRIPAL_NOTICE,
  229. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  230. [
  231. '%old_function' => 'tripal_cv_add_cv',
  232. '%new_function' => 'tripal_insert_cv',
  233. ]
  234. );
  235. return tripal_insert_cv($name, $definition);
  236. }
  237. /**
  238. * @deprecated Restructured API to make naming more readable and consistent.
  239. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  240. * now. This function has been replaced by tripal_insert_cvterm().
  241. *
  242. * @see tripal_insert_cvterm().
  243. */
  244. function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship = 0, $update = 1, $dbname = 'internal') {
  245. tripal_report_error(
  246. 'tripal_deprecated',
  247. TRIPAL_NOTICE,
  248. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  249. [
  250. '%old_function' => 'tripal_cv_add_cvterm',
  251. '%new_function' => 'tripal_insert_cvterm',
  252. ]
  253. );
  254. $term['cv_name'] = $defaultcv;
  255. $term['db_name'] = $dbname;
  256. $term['is_relationship'] = $is_relationship;
  257. if (isset($term['def'])) {
  258. $term['definition'] = $term['def'];
  259. unset($term['def']);
  260. }
  261. return tripal_insert_cvterm(
  262. $term,
  263. [
  264. 'update_existing' => $update,
  265. ]
  266. );
  267. }
  268. /**
  269. * @deprecated Restructured API to make naming more readable and consistent.
  270. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  271. * now. This function has been replaced by tripal_submit_obo_job().
  272. *
  273. * @see tripal_submit_obo_job().
  274. */
  275. function tripal_cv_submit_obo_job($obo_id = NULL, $obo_name = NULL, $obo_url = NULL, $obo_file = NULL) {
  276. tripal_report_error(
  277. 'tripal_deprecated',
  278. TRIPAL_NOTICE,
  279. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  280. [
  281. '%old_function' => 'tripal_cv_submit_obo_job',
  282. '%new_function' => 'tripal_submit_obo_job',
  283. ]
  284. );
  285. return tripal_submit_obo_job(
  286. [
  287. 'obo_id' => $obo_id,
  288. 'name' => $obo_name,
  289. 'url' => $obo_url,
  290. 'file' => $obo_file,
  291. ]
  292. );
  293. }
  294. /**
  295. * @deprecated Restructured API to make naming more readable and consistent.
  296. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  297. * now. This function has been replaced by tripal_insert_obo().
  298. *
  299. * @see tripal_insert_obo().
  300. */
  301. function tripal_cv_add_obo_ref($name, $path) {
  302. tripal_report_error(
  303. 'tripal_deprecated',
  304. TRIPAL_NOTICE,
  305. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  306. [
  307. '%old_function' => 'tripal_cv_add_obo_ref',
  308. '%new_function' => 'chado_insert_obo',
  309. ]
  310. );
  311. return tripal_insert_obo($name, $path);
  312. }
  313. /**
  314. * @deprecated Restructured API to make naming more readable and consistent.
  315. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  316. * now. This function has been replaced by tripal_autocomplete_cvterm().
  317. *
  318. * @see tripal_autocomplete_cvterm().
  319. */
  320. function tripal_cv_cvterm_name_autocomplete($cv_id, $string = '') {
  321. tripal_report_error(
  322. 'tripal_deprecated',
  323. TRIPAL_NOTICE,
  324. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  325. [
  326. '%old_function' => 'tripal_cv_cvterm_name_autocomplete',
  327. '%new_function' => 'tripal_autocomplete_cvterm',
  328. ]
  329. );
  330. return tripal_autocomplete_cvterm($cv_id, $string);
  331. }