tripal_feature.views_default.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <?php
  2. /**
  3. * @file
  4. * Describe default feature views
  5. */
  6. /**
  7. * Implements hook_views_default_views().
  8. *
  9. * @ingroup tripal_feature
  10. */
  11. function tripal_feature_views_default_views() {
  12. $views = array();
  13. // User View ("Search Biological Content")
  14. // Remember, if you change the name/path of this view,
  15. // you also want to change it's description in tripal_feature_search_biological_data_views()
  16. $view = tripal_feature_defaultvalue_user_features();
  17. $view = tripal_views_make_view_compatible_with_external($view);
  18. $views[$view->name] = $view;
  19. // Admin view
  20. $view = tripal_feature_defaultview_admin_features();
  21. $view = tripal_views_make_view_compatible_with_external($view);
  22. $views[$view->name] = $view;
  23. return $views;
  24. }
  25. /**
  26. * Defines the feature user search default view.
  27. *
  28. * @ingroup tripal_feature
  29. */
  30. function tripal_feature_defaultvalue_user_features() {
  31. // As a shortcut, currently I am copying the admin view and then tweaking it
  32. // In thie future this should be replaced by a views export
  33. $view = tripal_feature_defaultview_admin_features();
  34. // change some view admin stuff
  35. $view->name = 'tripal_feature_user_feature';
  36. $view->human_name = 'Feature User Search';
  37. $view->description = 'Allows users to search feature data';
  38. $view->tag = 'tripal search';
  39. // Change the path
  40. $view->display['page_1']->display_options['path'] = 'chado/feature';
  41. $view->display['page_1']->display_options['menu'] = array(
  42. 'type' => 'normal',
  43. 'title' => 'Features',
  44. 'description' => 'A biological sequence or a section of a biological sequence, or a collection of such sections.',
  45. 'weight' => '-10'
  46. );
  47. unset($view->display['page_1']->display_options['tab_options']);
  48. // Change the permission
  49. $view->display['default']->display_options['access']['perm'] = 'access chado_feature content';
  50. // Remove edit/delete node
  51. unset(
  52. $view->display['default']->display_options['fields']['delete_node'],
  53. $view->display['default']->display_options['fields']['edit_node'],
  54. $view->display['default']->display_options['fields']['nothing']
  55. );
  56. // Remove the admin action links
  57. unset($view->display['default']->display_options['header']['action_links_area']);
  58. unset($view->display['default']->display_options['header']['action_links_area_1']);
  59. return $view;
  60. }
  61. /**
  62. * The default feature administration view
  63. *
  64. * @ingroup tripal_feature
  65. */
  66. function tripal_feature_defaultview_admin_features() {
  67. $view = new view();
  68. $view->name = 'tripal_feature_admin_features';
  69. $view->description = 'DO NOT DISABLE';
  70. $view->tag = 'tripal admin';
  71. $view->base_table = 'feature';
  72. $view->human_name = 'Feature Admin';
  73. $view->core = 0;
  74. $view->api_version = '3.0';
  75. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  76. /* Display: features_all */
  77. $handler = $view->new_display('default', 'features_all', 'default');
  78. $handler->display->display_options['title'] = 'Sequence Features';
  79. $handler->display->display_options['use_more_always'] = FALSE;
  80. $handler->display->display_options['access']['type'] = 'perm';
  81. $handler->display->display_options['access']['perm'] = 'access chado_feature content';
  82. $handler->display->display_options['cache']['type'] = 'none';
  83. $handler->display->display_options['query']['type'] = 'views_query';
  84. $handler->display->display_options['exposed_form']['type'] = 'basic';
  85. $handler->display->display_options['pager']['type'] = 'full';
  86. $handler->display->display_options['pager']['options']['items_per_page'] = '25';
  87. $handler->display->display_options['pager']['options']['offset'] = '0';
  88. $handler->display->display_options['pager']['options']['id'] = '0';
  89. $handler->display->display_options['pager']['options']['quantity'] = '9';
  90. $handler->display->display_options['style_plugin'] = 'table';
  91. $handler->display->display_options['style_options']['grouping'] = '';
  92. $handler->display->display_options['style_options']['columns'] = array(
  93. 'accession' => 'accession',
  94. 'accession_link' => 'accession_link',
  95. 'name' => 'name',
  96. 'uniquename' => 'uniquename',
  97. 'name_1' => 'name_1',
  98. 'common_name' => 'common_name',
  99. 'seqlen' => 'seqlen',
  100. 'is_obsolete' => 'is_obsolete',
  101. 'is_analysis' => 'is_analysis',
  102. 'nid' => 'nid',
  103. );
  104. $handler->display->display_options['style_options']['default'] = '-1';
  105. $handler->display->display_options['style_options']['info'] = array(
  106. 'accession' => array(
  107. 'sortable' => 1,
  108. 'separator' => '',
  109. ),
  110. 'accession_link' => array(
  111. 'sortable' => 1,
  112. 'separator' => '',
  113. ),
  114. 'name' => array(
  115. 'sortable' => 1,
  116. 'separator' => '',
  117. ),
  118. 'uniquename' => array(
  119. 'sortable' => 1,
  120. 'separator' => '',
  121. ),
  122. 'name_1' => array(
  123. 'sortable' => 1,
  124. 'separator' => '',
  125. ),
  126. 'common_name' => array(
  127. 'sortable' => 1,
  128. 'separator' => '',
  129. ),
  130. 'seqlen' => array(
  131. 'sortable' => 1,
  132. 'separator' => '',
  133. ),
  134. 'is_obsolete' => array(
  135. 'sortable' => 1,
  136. 'separator' => '',
  137. ),
  138. 'is_analysis' => array(
  139. 'sortable' => 1,
  140. 'separator' => '',
  141. ),
  142. 'nid' => array(
  143. 'separator' => '',
  144. ),
  145. );
  146. /* Header: Global: Action Links */
  147. $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
  148. $handler->display->display_options['header']['action_links_area']['table'] = 'views';
  149. $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
  150. $handler->display->display_options['header']['action_links_area']['label'] = 'Add/Import';
  151. $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
  152. $handler->display->display_options['header']['action_links_area']['link-1'] = array(
  153. 'label-1' => 'Add Feature',
  154. 'path-1' => 'node/add/tripal-feature',
  155. );
  156. $handler->display->display_options['header']['action_links_area']['link-2'] = array(
  157. 'label-2' => 'Import via FASTA file',
  158. 'path-2' => 'admin/tripal/loaders/fasta_loader',
  159. );
  160. $handler->display->display_options['header']['action_links_area']['link-3'] = array(
  161. 'label-3' => 'Import via GFF3 file',
  162. 'path-3' => 'admin/tripal/loaders/gff3_load',
  163. );
  164. $handler->display->display_options['header']['action_links_area']['link-4'] = array(
  165. 'label-4' => '',
  166. 'path-4' => '',
  167. );
  168. /* Header: Global: Action Links */
  169. $handler->display->display_options['header']['action_links_area_1']['id'] = 'action_links_area_1';
  170. $handler->display->display_options['header']['action_links_area_1']['table'] = 'views';
  171. $handler->display->display_options['header']['action_links_area_1']['field'] = 'action_links_area';
  172. $handler->display->display_options['header']['action_links_area_1']['label'] = 'Extract';
  173. $handler->display->display_options['header']['action_links_area_1']['empty'] = TRUE;
  174. $handler->display->display_options['header']['action_links_area_1']['link-1'] = array(
  175. 'label-1' => 'Retrieve Sequences',
  176. 'path-1' => 'find/sequences',
  177. );
  178. $handler->display->display_options['header']['action_links_area_1']['link-2'] = array(
  179. 'label-2' => '',
  180. 'path-2' => '',
  181. );
  182. $handler->display->display_options['header']['action_links_area_1']['link-3'] = array(
  183. 'label-3' => '',
  184. 'path-3' => '',
  185. );
  186. $handler->display->display_options['header']['action_links_area_1']['link-4'] = array(
  187. 'label-4' => '',
  188. 'path-4' => '',
  189. );
  190. /* No results behavior: Global: Text area */
  191. $handler->display->display_options['empty']['text']['id'] = 'area';
  192. $handler->display->display_options['empty']['text']['table'] = 'views';
  193. $handler->display->display_options['empty']['text']['field'] = 'area';
  194. $handler->display->display_options['empty']['text']['content'] = 'No features matched the supplied criteria.';
  195. $handler->display->display_options['empty']['text']['format'] = '2';
  196. /* Relationship: Feature: Feature => Node */
  197. $handler->display->display_options['relationships']['feature_id']['id'] = 'feature_id';
  198. $handler->display->display_options['relationships']['feature_id']['table'] = 'chado_feature';
  199. $handler->display->display_options['relationships']['feature_id']['field'] = 'feature_id';
  200. /* Field: Content: Nid */
  201. $handler->display->display_options['fields']['nid']['id'] = 'nid';
  202. $handler->display->display_options['fields']['nid']['table'] = 'node';
  203. $handler->display->display_options['fields']['nid']['field'] = 'nid';
  204. $handler->display->display_options['fields']['nid']['relationship'] = 'feature_id';
  205. $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
  206. /* Field: Node URL */
  207. $handler->display->display_options['fields']['nid_1']['id'] = 'nid_1';
  208. $handler->display->display_options['fields']['nid_1']['table'] = 'node';
  209. $handler->display->display_options['fields']['nid_1']['field'] = 'nid';
  210. $handler->display->display_options['fields']['nid_1']['relationship'] = 'feature_id';
  211. $handler->display->display_options['fields']['nid_1']['ui_name'] = 'Node URL';
  212. $handler->display->display_options['fields']['nid_1']['label'] = '';
  213. $handler->display->display_options['fields']['nid_1']['exclude'] = TRUE;
  214. $handler->display->display_options['fields']['nid_1']['alter']['alter_text'] = TRUE;
  215. $handler->display->display_options['fields']['nid_1']['alter']['text'] = 'node/[nid]';
  216. $handler->display->display_options['fields']['nid_1']['element_label_colon'] = FALSE;
  217. /* Field: Chado Feature: Uniquename */
  218. $handler->display->display_options['fields']['uniquename']['id'] = 'uniquename';
  219. $handler->display->display_options['fields']['uniquename']['table'] = 'feature';
  220. $handler->display->display_options['fields']['uniquename']['field'] = 'uniquename';
  221. $handler->display->display_options['fields']['uniquename']['label'] = 'Unique Name';
  222. $handler->display->display_options['fields']['uniquename']['alter']['path'] = 'node/[nid]';
  223. $handler->display->display_options['fields']['uniquename']['alter']['make_link'] = TRUE;
  224. $handler->display->display_options['fields']['uniquename']['alter']['path'] = '[nid_1]';
  225. /* Field: Chado Feature: Name */
  226. $handler->display->display_options['fields']['name']['id'] = 'name';
  227. $handler->display->display_options['fields']['name']['table'] = 'feature';
  228. $handler->display->display_options['fields']['name']['field'] = 'name';
  229. $handler->display->display_options['fields']['name']['alter']['make_link'] = TRUE;
  230. $handler->display->display_options['fields']['name']['alter']['path'] = '[nid_1]';
  231. /* Field: Chado Cvterm: Name */
  232. $handler->display->display_options['fields']['name_1']['id'] = 'name_1';
  233. $handler->display->display_options['fields']['name_1']['table'] = 'cvterm';
  234. $handler->display->display_options['fields']['name_1']['field'] = 'name';
  235. $handler->display->display_options['fields']['name_1']['label'] = 'Type';
  236. /* Field: Chado Organism: Common Name */
  237. $handler->display->display_options['fields']['common_name']['id'] = 'common_name';
  238. $handler->display->display_options['fields']['common_name']['table'] = 'organism';
  239. $handler->display->display_options['fields']['common_name']['field'] = 'common_name';
  240. /* Field: Chado Feature: Seqlen */
  241. $handler->display->display_options['fields']['seqlen']['id'] = 'seqlen';
  242. $handler->display->display_options['fields']['seqlen']['table'] = 'feature';
  243. $handler->display->display_options['fields']['seqlen']['field'] = 'seqlen';
  244. $handler->display->display_options['fields']['seqlen']['label'] = 'Sequence Length';
  245. /* Field: Chado Feature: Is Obsolete */
  246. $handler->display->display_options['fields']['is_obsolete']['id'] = 'is_obsolete';
  247. $handler->display->display_options['fields']['is_obsolete']['table'] = 'feature';
  248. $handler->display->display_options['fields']['is_obsolete']['field'] = 'is_obsolete';
  249. $handler->display->display_options['fields']['is_obsolete']['type'] = 'separator';
  250. $handler->display->display_options['fields']['is_obsolete']['not'] = 0;
  251. /* Field: Content: Delete link */
  252. $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
  253. $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
  254. $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
  255. $handler->display->display_options['fields']['delete_node']['relationship'] = 'feature_id';
  256. $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
  257. /* Field: Content: Edit link */
  258. $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
  259. $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
  260. $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
  261. $handler->display->display_options['fields']['edit_node']['relationship'] = 'feature_id';
  262. $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
  263. /* Field: Global: Custom text */
  264. $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
  265. $handler->display->display_options['fields']['nothing']['table'] = 'views';
  266. $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
  267. $handler->display->display_options['fields']['nothing']['label'] = '';
  268. $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node] [delete_node]';
  269. $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
  270. /* Sort criterion: Chado Organism: Common Name */
  271. $handler->display->display_options['sorts']['common_name']['id'] = 'common_name';
  272. $handler->display->display_options['sorts']['common_name']['table'] = 'organism';
  273. $handler->display->display_options['sorts']['common_name']['field'] = 'common_name';
  274. /* Sort criterion: Chado Cvterm: Name */
  275. $handler->display->display_options['sorts']['name']['id'] = 'name';
  276. $handler->display->display_options['sorts']['name']['table'] = 'cvterm';
  277. $handler->display->display_options['sorts']['name']['field'] = 'name';
  278. /* Sort criterion: Chado Feature: Name */
  279. $handler->display->display_options['sorts']['name_1']['id'] = 'name_1';
  280. $handler->display->display_options['sorts']['name_1']['table'] = 'feature';
  281. $handler->display->display_options['sorts']['name_1']['field'] = 'name';
  282. /* Filter criterion: Chado Organism: Common Name */
  283. $handler->display->display_options['filters']['common_name']['id'] = 'common_name';
  284. $handler->display->display_options['filters']['common_name']['table'] = 'organism';
  285. $handler->display->display_options['filters']['common_name']['field'] = 'common_name';
  286. $handler->display->display_options['filters']['common_name']['value'] = array();
  287. $handler->display->display_options['filters']['common_name']['group'] = '0';
  288. $handler->display->display_options['filters']['common_name']['exposed'] = TRUE;
  289. $handler->display->display_options['filters']['common_name']['expose']['operator_id'] = 'common_name_op';
  290. $handler->display->display_options['filters']['common_name']['expose']['label'] = 'Organism Common Name';
  291. $handler->display->display_options['filters']['common_name']['expose']['operator'] = 'common_name_op';
  292. $handler->display->display_options['filters']['common_name']['expose']['identifier'] = 'organism';
  293. /* Filter criterion: Chado Feature: Type Id */
  294. $handler->display->display_options['filters']['type_id']['id'] = 'type_id';
  295. $handler->display->display_options['filters']['type_id']['table'] = 'feature';
  296. $handler->display->display_options['filters']['type_id']['field'] = 'type_id';
  297. $handler->display->display_options['filters']['type_id']['value'] = array();
  298. $handler->display->display_options['filters']['type_id']['group'] = '0';
  299. $handler->display->display_options['filters']['type_id']['exposed'] = TRUE;
  300. $handler->display->display_options['filters']['type_id']['expose']['operator_id'] = 'type_id_op';
  301. $handler->display->display_options['filters']['type_id']['expose']['label'] = 'Type';
  302. $handler->display->display_options['filters']['type_id']['expose']['operator'] = 'type_id_op';
  303. $handler->display->display_options['filters']['type_id']['expose']['identifier'] = 'type_id';
  304. /* Filter criterion: Chado Feature: Name */
  305. $handler->display->display_options['filters']['name_1']['id'] = 'name_1';
  306. $handler->display->display_options['filters']['name_1']['table'] = 'feature';
  307. $handler->display->display_options['filters']['name_1']['field'] = 'name';
  308. $handler->display->display_options['filters']['name_1']['operator'] = '~';
  309. $handler->display->display_options['filters']['name_1']['group'] = '0';
  310. $handler->display->display_options['filters']['name_1']['exposed'] = TRUE;
  311. $handler->display->display_options['filters']['name_1']['expose']['operator_id'] = 'name_1_op';
  312. $handler->display->display_options['filters']['name_1']['expose']['label'] = 'Name Contains';
  313. $handler->display->display_options['filters']['name_1']['expose']['operator'] = 'name_1_op';
  314. $handler->display->display_options['filters']['name_1']['expose']['identifier'] = 'name';
  315. /** MANUALLY ADD since filter handler no exporting correctly */
  316. $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
  317. $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
  318. $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
  319. $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
  320. $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
  321. $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
  322. $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
  323. $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
  324. /* Display: Page */
  325. $handler = $view->new_display('page', 'Page', 'page_1');
  326. $handler->display->display_options['path'] = 'admin/tripal/chado/tripal_feature/features';
  327. $handler->display->display_options['menu']['type'] = 'default tab';
  328. $handler->display->display_options['menu']['title'] = 'Features';
  329. $handler->display->display_options['menu']['description'] = 'A feature is a biological sequence or a section of a biological sequence, or a collection of such sections.';
  330. $handler->display->display_options['menu']['weight'] = '-10';
  331. $handler->display->display_options['menu']['context'] = 0;
  332. $handler->display->display_options['menu']['context_only_inline'] = 0;
  333. $handler->display->display_options['tab_options']['weight'] = '0';
  334. /** MANUALLY ADD since filter handler no exporting correctly
  335. $handler->display->display_options['filters']['common_name']['expose']['values_form_type'] = 'select';
  336. $handler->display->display_options['filters']['common_name']['expose']['select_multiple'] = FALSE;
  337. $handler->display->display_options['filters']['common_name']['expose']['select_optional'] = TRUE;
  338. $handler->display->display_options['filters']['common_name']['expose']['max_length'] = 40;
  339. $handler->display->display_options['filters']['type_id']['expose']['values_form_type'] = 'select';
  340. $handler->display->display_options['filters']['type_id']['expose']['select_multiple'] = FALSE;
  341. $handler->display->display_options['filters']['type_id']['expose']['select_optional'] = TRUE;
  342. $handler->display->display_options['filters']['type_id']['expose']['max_length'] = 40;
  343. */
  344. return $view;
  345. }