tripal_cv.views.inc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions for views integration of
  5. * chado/tripal db tables. Supplementary functions can be found in
  6. * ./views/
  7. *
  8. * Documentation on views integration can be found at
  9. * http://views2.logrus.com/doc/html/index.html.
  10. */
  11. /**
  12. * @defgroup tripal_cv_views Controlled Vocabulary Views Integration
  13. * @ingroup views
  14. */
  15. /**
  16. *
  17. * @ingroup tripal_cv_views
  18. */
  19. function tripal_cv_views_default_views() {
  20. $views = array();
  21. if (!module_exists('tripal_views')) {
  22. return $views;
  23. }
  24. // Main default view
  25. // List all cvterms based on cv
  26. $view = new view;
  27. $view->name = 'cvterm_listing';
  28. $view->description = 'A listing of all controlled vocabulary terms filtered by controlled vocabulary';
  29. $view->tag = 'chado default';
  30. $view->base_table = 'cvterm';
  31. $view->core = 0;
  32. $view->api_version = '2';
  33. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  34. $handler = $view->new_display('default', 'Defaults', 'default');
  35. $handler->override_option('fields', array(
  36. 'name_1' => array(
  37. 'label' => 'Vocabulary',
  38. 'alter' => array(
  39. 'alter_text' => 0,
  40. 'text' => '',
  41. 'make_link' => 0,
  42. 'path' => '',
  43. 'absolute' => 0,
  44. 'link_class' => '',
  45. 'alt' => '',
  46. 'rel' => '',
  47. 'prefix' => '',
  48. 'suffix' => '',
  49. 'target' => '',
  50. 'help' => '',
  51. 'trim' => 0,
  52. 'max_length' => '',
  53. 'word_boundary' => 1,
  54. 'ellipsis' => 1,
  55. 'html' => 0,
  56. 'strip_tags' => 0,
  57. ),
  58. 'empty' => '',
  59. 'hide_empty' => 0,
  60. 'empty_zero' => 0,
  61. 'hide_alter_empty' => 1,
  62. 'type' => 'separator',
  63. 'separator' => ', ',
  64. 'exclude' => 0,
  65. 'id' => 'name_1',
  66. 'table' => 'cv',
  67. 'field' => 'name',
  68. 'relationship' => 'none',
  69. ),
  70. 'name' => array(
  71. 'label' => 'Name',
  72. 'alter' => array(
  73. 'alter_text' => 0,
  74. 'text' => '',
  75. 'make_link' => 0,
  76. 'path' => '',
  77. 'link_class' => '',
  78. 'alt' => '',
  79. 'prefix' => '',
  80. 'suffix' => '',
  81. 'target' => '',
  82. 'help' => '',
  83. 'trim' => 0,
  84. 'max_length' => '',
  85. 'word_boundary' => 1,
  86. 'ellipsis' => 1,
  87. 'html' => 0,
  88. 'strip_tags' => 0,
  89. ),
  90. 'empty' => '',
  91. 'hide_empty' => 0,
  92. 'empty_zero' => 0,
  93. 'exclude' => 0,
  94. 'id' => 'name',
  95. 'table' => 'cvterm',
  96. 'field' => 'name',
  97. 'relationship' => 'none',
  98. ),
  99. 'definition' => array(
  100. 'label' => 'Definition',
  101. 'alter' => array(
  102. 'alter_text' => 0,
  103. 'text' => '',
  104. 'make_link' => 0,
  105. 'path' => '',
  106. 'link_class' => '',
  107. 'alt' => '',
  108. 'prefix' => '',
  109. 'suffix' => '',
  110. 'target' => '',
  111. 'help' => '',
  112. 'trim' => 0,
  113. 'max_length' => '',
  114. 'word_boundary' => 1,
  115. 'ellipsis' => 1,
  116. 'html' => 0,
  117. 'strip_tags' => 0,
  118. ),
  119. 'empty' => '',
  120. 'hide_empty' => 0,
  121. 'empty_zero' => 0,
  122. 'exclude' => 0,
  123. 'id' => 'definition',
  124. 'table' => 'cvterm',
  125. 'field' => 'definition',
  126. 'relationship' => 'none',
  127. ),
  128. 'is_obsolete' => array(
  129. 'label' => 'Is Obsolete',
  130. 'alter' => array(
  131. 'alter_text' => 0,
  132. 'text' => '',
  133. 'make_link' => 0,
  134. 'path' => '',
  135. 'link_class' => '',
  136. 'alt' => '',
  137. 'prefix' => '',
  138. 'suffix' => '',
  139. 'target' => '',
  140. 'help' => '',
  141. 'trim' => 0,
  142. 'max_length' => '',
  143. 'word_boundary' => 1,
  144. 'ellipsis' => 1,
  145. 'html' => 0,
  146. 'strip_tags' => 0,
  147. ),
  148. 'empty' => '',
  149. 'hide_empty' => 0,
  150. 'empty_zero' => 0,
  151. 'type' => 'yes-no',
  152. 'not' => 0,
  153. 'exclude' => 0,
  154. 'id' => 'is_obsolete',
  155. 'table' => 'cvterm',
  156. 'field' => 'is_obsolete',
  157. 'relationship' => 'none',
  158. ),
  159. 'is_relationshiptype' => array(
  160. 'label' => 'Is Relationship',
  161. 'alter' => array(
  162. 'alter_text' => 0,
  163. 'text' => '',
  164. 'make_link' => 0,
  165. 'path' => '',
  166. 'link_class' => '',
  167. 'alt' => '',
  168. 'prefix' => '',
  169. 'suffix' => '',
  170. 'target' => '',
  171. 'help' => '',
  172. 'trim' => 0,
  173. 'max_length' => '',
  174. 'word_boundary' => 1,
  175. 'ellipsis' => 1,
  176. 'html' => 0,
  177. 'strip_tags' => 0,
  178. ),
  179. 'empty' => '',
  180. 'hide_empty' => 0,
  181. 'empty_zero' => 0,
  182. 'type' => 'yes-no',
  183. 'not' => 0,
  184. 'exclude' => 0,
  185. 'id' => 'is_relationshiptype',
  186. 'table' => 'cvterm',
  187. 'field' => 'is_relationshiptype',
  188. 'relationship' => 'none',
  189. ),
  190. ));
  191. $handler->override_option('sorts', array(
  192. 'name' => array(
  193. 'order' => 'ASC',
  194. 'id' => 'name',
  195. 'table' => 'cv',
  196. 'field' => 'name',
  197. 'relationship' => 'none',
  198. ),
  199. 'name_1' => array(
  200. 'order' => 'ASC',
  201. 'id' => 'name_1',
  202. 'table' => 'cvterm',
  203. 'field' => 'name',
  204. 'relationship' => 'none',
  205. ),
  206. ));
  207. $handler->override_option('filters', array(
  208. 'name' => array(
  209. 'operator' => '=',
  210. 'value' => array(),
  211. 'group' => '0',
  212. 'exposed' => TRUE,
  213. 'expose' => array(
  214. 'use_operator' => 0,
  215. 'operator' => 'name_op',
  216. 'identifier' => 'cv',
  217. 'label' => 'Vocabulary',
  218. 'remember' => 0,
  219. ),
  220. 'case' => 1,
  221. 'id' => 'name',
  222. 'table' => 'cv',
  223. 'field' => 'name',
  224. 'relationship' => 'none',
  225. 'values_form_type' => 'select',
  226. 'multiple' => 1,
  227. 'optional' => 0,
  228. 'agg' => array(
  229. 'records_with' => 1,
  230. 'aggregates_with' => 1,
  231. ),
  232. ),
  233. 'name_1' => array(
  234. 'operator' => '~',
  235. 'value' => '',
  236. 'group' => '0',
  237. 'exposed' => TRUE,
  238. 'expose' => array(
  239. 'use_operator' => 0,
  240. 'operator' => '',
  241. 'identifier' => 'name',
  242. 'label' => 'Name Contains',
  243. 'remember' => 0,
  244. ),
  245. 'case' => 0,
  246. 'id' => 'name_1',
  247. 'table' => 'cvterm',
  248. 'field' => 'name',
  249. 'relationship' => 'none',
  250. 'values_form_type' => 'textfield',
  251. 'multiple' => 0,
  252. 'optional' => 0,
  253. 'show_all' => 0,
  254. 'agg' => array(
  255. 'records_with' => 1,
  256. 'aggregates_with' => 1,
  257. ),
  258. ),
  259. 'definition' => array(
  260. 'operator' => '~',
  261. 'value' => '',
  262. 'group' => '0',
  263. 'exposed' => TRUE,
  264. 'expose' => array(
  265. 'use_operator' => 0,
  266. 'operator' => 'definition_op',
  267. 'identifier' => 'definition',
  268. 'label' => 'Definition Contains',
  269. 'remember' => 0,
  270. ),
  271. 'case' => 0,
  272. 'id' => 'definition',
  273. 'table' => 'cvterm',
  274. 'field' => 'definition',
  275. 'relationship' => 'none',
  276. 'agg' => array(
  277. 'records_with' => 1,
  278. 'aggregates_with' => 0,
  279. ),
  280. ),
  281. 'search_results' => array(
  282. 'operator' => '=',
  283. 'value' => '',
  284. 'group' => '0',
  285. 'exposed' => FALSE,
  286. 'expose' => array(
  287. 'operator' => FALSE,
  288. 'label' => '',
  289. ),
  290. 'id' => 'search_results',
  291. 'table' => 'views',
  292. 'field' => 'search_results',
  293. 'relationship' => 'none',
  294. 'apply_button' => 'Show',
  295. 'no_results_text' => 'Click "Show" to see a list of all controlled vocabulary terms matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabulary terms will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabulary terms will be listed.',
  296. ),
  297. ));
  298. $handler->override_option('access', array(
  299. 'type' => 'perm',
  300. 'perm' => 'access chado_cv content',
  301. ));
  302. $handler->override_option('cache', array(
  303. 'type' => 'none',
  304. ));
  305. $handler->override_option('title', 'Controlled Vocabulary Terms');
  306. $handler->override_option('header', 'Click "Show" to see a list of all controlled vocabulary terms matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabulary terms will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabulary terms will be listed.');
  307. $handler->override_option('header_format', '2');
  308. $handler->override_option('header_empty', 0);
  309. $handler->override_option('empty', 'There are no terms associated with the selected controlled vocabulary. Please select a different vocabulary from the list above.');
  310. $handler->override_option('empty_format', '1');
  311. $handler->override_option('items_per_page', 50);
  312. $handler->override_option('use_pager', '1');
  313. $handler->override_option('style_plugin', 'table');
  314. $handler->override_option('style_options', array(
  315. 'grouping' => '',
  316. 'override' => 1,
  317. 'sticky' => 0,
  318. 'order' => 'asc',
  319. 'summary' => '',
  320. 'columns' => array(
  321. 'name_1' => 'name_1',
  322. 'name' => 'name',
  323. 'definition' => 'definition',
  324. 'is_obsolete' => 'is_obsolete',
  325. 'is_relationshiptype' => 'is_relationshiptype',
  326. ),
  327. 'info' => array(
  328. 'name_1' => array(
  329. 'sortable' => 1,
  330. 'separator' => '',
  331. ),
  332. 'name' => array(
  333. 'sortable' => 1,
  334. 'separator' => '',
  335. ),
  336. 'definition' => array(
  337. 'sortable' => 0,
  338. 'separator' => '',
  339. ),
  340. 'is_obsolete' => array(
  341. 'sortable' => 1,
  342. 'separator' => '',
  343. ),
  344. 'is_relationshiptype' => array(
  345. 'sortable' => 1,
  346. 'separator' => '',
  347. ),
  348. ),
  349. 'default' => '-1',
  350. ));
  351. $handler = $view->new_display('page', 'Page', 'page_1');
  352. $handler->override_option('path', 'admin/tripal/tripal_cv/list_cvterms');
  353. $handler->override_option('menu', array(
  354. 'type' => 'normal',
  355. 'title' => 'Term Listing',
  356. 'description' => 'A listing of a controlled vocabulary terms for a given vocabulary',
  357. 'weight' => '10',
  358. 'name' => 'navigation',
  359. ));
  360. $handler->override_option('tab_options', array(
  361. 'type' => 'none',
  362. 'title' => '',
  363. 'description' => '',
  364. 'weight' => 0,
  365. 'name' => 'navigation',
  366. ));
  367. $views[$view->name] = $view;
  368. // Main cv default listing
  369. $view = new view;
  370. $view->name = 'cv_listing';
  371. $view->description = 'A listing of all controlled vocabularies';
  372. $view->tag = 'chado default';
  373. $view->base_table = 'cv';
  374. $view->core = 6;
  375. $view->api_version = '2';
  376. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  377. $handler = $view->new_display('default', 'Defaults', 'default');
  378. $handler->override_option('fields', array(
  379. 'name' => array(
  380. 'label' => 'Name',
  381. 'alter' => array(
  382. 'alter_text' => 0,
  383. 'text' => '',
  384. 'make_link' => 0,
  385. 'path' => '',
  386. 'absolute' => 0,
  387. 'link_class' => '',
  388. 'alt' => '',
  389. 'rel' => '',
  390. 'prefix' => '',
  391. 'suffix' => '',
  392. 'target' => '',
  393. 'help' => '',
  394. 'trim' => 0,
  395. 'max_length' => '',
  396. 'word_boundary' => 1,
  397. 'ellipsis' => 1,
  398. 'html' => 0,
  399. 'strip_tags' => 0,
  400. ),
  401. 'empty' => '',
  402. 'hide_empty' => 0,
  403. 'empty_zero' => 0,
  404. 'hide_alter_empty' => 1,
  405. 'type' => 'separator',
  406. 'separator' => ', ',
  407. 'exclude' => 0,
  408. 'id' => 'name',
  409. 'table' => 'cv',
  410. 'field' => 'name',
  411. 'relationship' => 'none',
  412. ),
  413. 'definition' => array(
  414. 'label' => 'Definition',
  415. 'alter' => array(
  416. 'alter_text' => 0,
  417. 'text' => '',
  418. 'make_link' => 0,
  419. 'path' => '',
  420. 'absolute' => 0,
  421. 'link_class' => '',
  422. 'alt' => '',
  423. 'rel' => '',
  424. 'prefix' => '',
  425. 'suffix' => '',
  426. 'target' => '',
  427. 'help' => '',
  428. 'trim' => 0,
  429. 'max_length' => '',
  430. 'word_boundary' => 1,
  431. 'ellipsis' => 1,
  432. 'html' => 0,
  433. 'strip_tags' => 0,
  434. ),
  435. 'empty' => '',
  436. 'hide_empty' => 0,
  437. 'empty_zero' => 0,
  438. 'hide_alter_empty' => 1,
  439. 'type' => 'separator',
  440. 'separator' => ', ',
  441. 'exclude' => 0,
  442. 'id' => 'definition',
  443. 'table' => 'cv',
  444. 'field' => 'definition',
  445. 'relationship' => 'none',
  446. ),
  447. 'nothing' => array(
  448. 'label' => 'Terms',
  449. 'alter' => array(
  450. 'text' => 'view',
  451. 'make_link' => 1,
  452. 'path' => 'admin/tripal/tripal_cv/list_cvterms?cv%5B%5D=[name]',
  453. 'absolute' => 0,
  454. 'link_class' => '',
  455. 'alt' => '',
  456. 'rel' => '',
  457. 'prefix' => '',
  458. 'suffix' => '',
  459. 'target' => '',
  460. 'help' => '',
  461. 'trim' => 0,
  462. 'max_length' => '',
  463. 'word_boundary' => 1,
  464. 'ellipsis' => 1,
  465. 'html' => 0,
  466. 'strip_tags' => 0,
  467. ),
  468. 'empty' => '',
  469. 'hide_empty' => 0,
  470. 'empty_zero' => 0,
  471. 'hide_alter_empty' => 1,
  472. 'exclude' => 0,
  473. 'id' => 'nothing',
  474. 'table' => 'views',
  475. 'field' => 'nothing',
  476. 'relationship' => 'none',
  477. ),
  478. ));
  479. $handler->override_option('filters', array(
  480. 'name' => array(
  481. 'operator' => '~',
  482. 'value' => '',
  483. 'group' => '0',
  484. 'exposed' => TRUE,
  485. 'expose' => array(
  486. 'use_operator' => 0,
  487. 'operator' => 'name_op',
  488. 'identifier' => 'name',
  489. 'label' => 'Name Contains',
  490. 'remember' => 0,
  491. ),
  492. 'case' => 0,
  493. 'id' => 'name',
  494. 'table' => 'cv',
  495. 'field' => 'name',
  496. 'relationship' => 'none',
  497. 'values_form_type' => 'textfield',
  498. 'multiple' => 0,
  499. 'optional' => 0,
  500. 'agg' => array(
  501. 'records_with' => 1,
  502. 'aggregates_with' => 0,
  503. ),
  504. ),
  505. 'definition' => array(
  506. 'operator' => '~',
  507. 'value' => '',
  508. 'group' => '0',
  509. 'exposed' => TRUE,
  510. 'expose' => array(
  511. 'use_operator' => 0,
  512. 'operator' => 'definition_op',
  513. 'identifier' => 'definition',
  514. 'label' => 'Definition Contains',
  515. 'remember' => 0,
  516. ),
  517. 'case' => 0,
  518. 'id' => 'definition',
  519. 'table' => 'cv',
  520. 'field' => 'definition',
  521. 'relationship' => 'none',
  522. 'agg' => array(
  523. 'records_with' => 1,
  524. 'aggregates_with' => 0,
  525. ),
  526. ),
  527. 'search_results' => array(
  528. 'operator' => '=',
  529. 'value' => '',
  530. 'group' => '0',
  531. 'exposed' => FALSE,
  532. 'expose' => array(
  533. 'operator' => FALSE,
  534. 'label' => '',
  535. ),
  536. 'id' => 'search_results',
  537. 'table' => 'views',
  538. 'field' => 'search_results',
  539. 'relationship' => 'none',
  540. 'apply_button' => 'Show',
  541. 'no_results_text' => 'Click "Show" to see a list of all controlled vocabularies matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabularies will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabularies will be listed.',
  542. ),
  543. ));
  544. $handler->override_option('access', array(
  545. 'type' => 'perm',
  546. 'perm' => 'access chado_cv content',
  547. ));
  548. $handler->override_option('cache', array(
  549. 'type' => 'none',
  550. ));
  551. $handler->override_option('title', 'Controlled Vocabularies');
  552. $handler->override_option('header', 'Click "Show" to see a list of all controlled vocabularies matching the entered criteria. If you leave a any of the criteria blank then the controlled vocabularies will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all controlled vocabularies will be listed.');
  553. $handler->override_option('header_format', '2');
  554. $handler->override_option('header_empty', 0);
  555. $handler->override_option('empty', 'No controlled vocabularies match the supplied criteria.');
  556. $handler->override_option('empty_format', '2');
  557. $handler->override_option('items_per_page', 50);
  558. $handler->override_option('style_plugin', 'table');
  559. $handler->override_option('style_options', array(
  560. 'grouping' => '',
  561. 'override' => 1,
  562. 'sticky' => 0,
  563. 'order' => 'asc',
  564. 'summary' => '',
  565. 'columns' => array(
  566. 'name' => 'name',
  567. 'definition' => 'definition',
  568. 'nothing' => 'nothing',
  569. ),
  570. 'info' => array(
  571. 'name' => array(
  572. 'sortable' => 1,
  573. 'separator' => '',
  574. ),
  575. 'definition' => array(
  576. 'sortable' => 0,
  577. 'separator' => '',
  578. ),
  579. 'nothing' => array(
  580. 'separator' => '',
  581. ),
  582. ),
  583. 'default' => 'name',
  584. ));
  585. $handler = $view->new_display('page', 'Page', 'page_1');
  586. $handler->override_option('path', 'admin/tripal/tripal_cv/list_cvs');
  587. $handler->override_option('menu', array(
  588. 'type' => 'normal',
  589. 'title' => 'CV Listing',
  590. 'description' => 'A listing of all controlled vocabularies',
  591. 'weight' => '10',
  592. 'name' => 'navigation',
  593. ));
  594. $handler->override_option('tab_options', array(
  595. 'type' => 'none',
  596. 'title' => '',
  597. 'description' => '',
  598. 'weight' => 0,
  599. 'name' => 'navigation',
  600. ));
  601. $views[$view->name] = $view;
  602. return $views;
  603. }