tripal_db.views.inc 17 KB

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