tripal_featuremap.views_default.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <?php
  2. /**
  3. * @file
  4. * Default feature map views
  5. */
  6. /**
  7. * Implements hook_views_default_views().
  8. *
  9. * @ingroup tripal_legacy_featuremap
  10. */
  11. function tripal_featuremap_views_default_views() {
  12. $views = [];
  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_featuremap_search_biological_data_views()
  16. $view = tripal_featuremap_defaultvalue_user_featuremaps();
  17. $view = tripal_make_view_compatible_with_external($view);
  18. $views[$view->name] = $view;
  19. // Admin view
  20. $view = tripal_featuremap_defaultview_admin_featuremaps();
  21. $view = tripal_make_view_compatible_with_external($view);
  22. $views[$view->name] = $view;
  23. return $views;
  24. }
  25. /**
  26. * Defines the featuremap user search default view.
  27. *
  28. * @ingroup tripal_legacy_featuremap
  29. */
  30. function tripal_featuremap_defaultvalue_user_featuremaps() {
  31. // As a shortcut, currently I am copying the admin view and then tweaking it
  32. // In the future this should be replaced by a views export
  33. $view = tripal_featuremap_defaultview_admin_featuremaps();
  34. // change some view admin stuff
  35. $view->name = 'tripal_featuremap_user_featuremaps';
  36. $view->human_name = 'Feature Map User Search';
  37. $view->description = 'Allows users to search feature map data';
  38. $view->tag = 'tripal search';
  39. // Change the path
  40. $view->display['page_1']->display_options['path'] = 'chado/featuremap';
  41. $view->display['page_1']->display_options['menu'] = [
  42. 'type' => 'normal',
  43. 'title' => 'Maps',
  44. 'description' => 'A map of features from the chado database (e.g. genetic map)',
  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_featuremap 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. return $view;
  59. }
  60. /**
  61. * Describes the default featuremap admin view
  62. *
  63. * @ingroup tripal_legacy_featuremap
  64. */
  65. function tripal_featuremap_defaultview_admin_featuremaps() {
  66. $view = new view();
  67. $view->name = 'tripal_featuremap_admin_featuremaps';
  68. $view->description = 'DO NOT DISABLE';
  69. $view->tag = 'tripal admin';
  70. $view->base_table = 'featuremap';
  71. $view->human_name = 'Feature Map Admin';
  72. $view->core = 6;
  73. $view->api_version = '3.0';
  74. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  75. /* Display: Defaults */
  76. $handler = $view->new_display('default', 'Defaults', 'default');
  77. $handler->display->display_options['title'] = 'Maps';
  78. $handler->display->display_options['use_more_always'] = FALSE;
  79. $handler->display->display_options['access']['type'] = 'perm';
  80. $handler->display->display_options['access']['perm'] = 'access chado_featuremap content';
  81. $handler->display->display_options['cache']['type'] = 'none';
  82. $handler->display->display_options['query']['type'] = 'views_query';
  83. $handler->display->display_options['exposed_form']['type'] = 'input_required';
  84. $handler->display->display_options['exposed_form']['options']['submit_button'] = 'Search';
  85. $handler->display->display_options['exposed_form']['options']['text_input_required'] = 'Click search to see a listing of feature maps that meet the filter requirements. Use the filters to restrict this set to a more reasonable number of maps or to find a specific map.';
  86. $handler->display->display_options['exposed_form']['options']['text_input_required_format'] = 'full_html';
  87. $handler->display->display_options['pager']['type'] = 'full';
  88. $handler->display->display_options['pager']['options']['items_per_page'] = '25';
  89. $handler->display->display_options['pager']['options']['offset'] = '0';
  90. $handler->display->display_options['pager']['options']['id'] = '0';
  91. $handler->display->display_options['pager']['options']['quantity'] = '9';
  92. $handler->display->display_options['style_plugin'] = 'table';
  93. $handler->display->display_options['style_options']['grouping'] = '';
  94. $handler->display->display_options['style_options']['columns'] = [
  95. 'name' => 'name',
  96. 'description' => 'description',
  97. 'name_1' => 'name_1',
  98. 'nid' => 'nid',
  99. ];
  100. $handler->display->display_options['style_options']['default'] = '-1';
  101. $handler->display->display_options['style_options']['info'] = [
  102. 'name' => [
  103. 'sortable' => 1,
  104. 'separator' => '',
  105. ],
  106. 'description' => [
  107. 'sortable' => 1,
  108. 'separator' => '',
  109. ],
  110. 'name_1' => [
  111. 'sortable' => 1,
  112. 'separator' => '',
  113. ],
  114. 'nid' => [
  115. 'separator' => '',
  116. ],
  117. ];
  118. /* Header: Global: Action Links */
  119. $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
  120. $handler->display->display_options['header']['action_links_area']['table'] = 'views';
  121. $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
  122. $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
  123. $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
  124. $handler->display->display_options['header']['action_links_area']['link-1'] = [
  125. 'label-1' => 'Add Map',
  126. 'path-1' => 'node/add/tripal-featuremap',
  127. ];
  128. $handler->display->display_options['header']['action_links_area']['link-2'] = [
  129. 'label-2' => '',
  130. 'path-2' => '',
  131. ];
  132. $handler->display->display_options['header']['action_links_area']['link-3'] = [
  133. 'label-3' => '',
  134. 'path-3' => '',
  135. ];
  136. $handler->display->display_options['header']['action_links_area']['link-4'] = [
  137. 'label-4' => '',
  138. 'path-4' => '',
  139. ];
  140. /* No results behavior: Global: Text area */
  141. $handler->display->display_options['empty']['text']['id'] = 'area';
  142. $handler->display->display_options['empty']['text']['table'] = 'views';
  143. $handler->display->display_options['empty']['text']['field'] = 'area';
  144. $handler->display->display_options['empty']['text']['content'] = 'No feature maps match the current criteria.';
  145. $handler->display->display_options['empty']['text']['format'] = '1';
  146. /* Relationship: Featuremap: Featuremap => Node */
  147. $handler->display->display_options['relationships']['featuremap_id']['id'] = 'featuremap_id';
  148. $handler->display->display_options['relationships']['featuremap_id']['table'] = 'chado_featuremap';
  149. $handler->display->display_options['relationships']['featuremap_id']['field'] = 'featuremap_id';
  150. /* Field: Content: Nid */
  151. $handler->display->display_options['fields']['nid']['id'] = 'nid';
  152. $handler->display->display_options['fields']['nid']['table'] = 'node';
  153. $handler->display->display_options['fields']['nid']['field'] = 'nid';
  154. $handler->display->display_options['fields']['nid']['relationship'] = 'featuremap_id';
  155. $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
  156. /* Field: Node URL */
  157. $handler->display->display_options['fields']['nid_1']['id'] = 'nid_1';
  158. $handler->display->display_options['fields']['nid_1']['table'] = 'node';
  159. $handler->display->display_options['fields']['nid_1']['field'] = 'nid';
  160. $handler->display->display_options['fields']['nid_1']['relationship'] = 'feature_id';
  161. $handler->display->display_options['fields']['nid_1']['ui_name'] = 'Node URL';
  162. $handler->display->display_options['fields']['nid_1']['label'] = '';
  163. $handler->display->display_options['fields']['nid_1']['exclude'] = TRUE;
  164. $handler->display->display_options['fields']['nid_1']['alter']['alter_text'] = TRUE;
  165. $handler->display->display_options['fields']['nid_1']['alter']['text'] = 'node/[nid]';
  166. $handler->display->display_options['fields']['nid_1']['element_label_colon'] = FALSE;
  167. /* Field: Chado Featuremap: Name */
  168. $handler->display->display_options['fields']['name']['id'] = 'name';
  169. $handler->display->display_options['fields']['name']['table'] = 'featuremap';
  170. $handler->display->display_options['fields']['name']['field'] = 'name';
  171. $handler->display->display_options['fields']['name']['alter']['make_link'] = TRUE;
  172. $handler->display->display_options['fields']['name']['alter']['path'] = '[nid_1]';
  173. /* Field: Chado Featuremap: Description */
  174. $handler->display->display_options['fields']['description']['id'] = 'description';
  175. $handler->display->display_options['fields']['description']['table'] = 'featuremap';
  176. $handler->display->display_options['fields']['description']['field'] = 'description';
  177. /* Field: Chado Cvterm: Name */
  178. $handler->display->display_options['fields']['name_1']['id'] = 'name_1';
  179. $handler->display->display_options['fields']['name_1']['table'] = 'cvterm';
  180. $handler->display->display_options['fields']['name_1']['field'] = 'name';
  181. $handler->display->display_options['fields']['name_1']['label'] = 'Map Units';
  182. /* Field: Content: Delete link */
  183. $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
  184. $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
  185. $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
  186. $handler->display->display_options['fields']['delete_node']['relationship'] = 'featuremap_id';
  187. $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
  188. /* Field: Content: Edit link */
  189. $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
  190. $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
  191. $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
  192. $handler->display->display_options['fields']['edit_node']['relationship'] = 'featuremap_id';
  193. $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
  194. /* Field: Global: Custom text */
  195. $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
  196. $handler->display->display_options['fields']['nothing']['table'] = 'views';
  197. $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
  198. $handler->display->display_options['fields']['nothing']['label'] = '';
  199. $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node] [delete_node]';
  200. $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
  201. /* Sort criterion: Chado Featuremap: Id */
  202. $handler->display->display_options['sorts']['featuremap_id']['id'] = 'featuremap_id';
  203. $handler->display->display_options['sorts']['featuremap_id']['table'] = 'featuremap';
  204. $handler->display->display_options['sorts']['featuremap_id']['field'] = 'featuremap_id';
  205. $handler->display->display_options['sorts']['featuremap_id']['order'] = 'DESC';
  206. /* Filter criterion: Chado Featuremap: Name */
  207. $handler->display->display_options['filters']['name_1']['id'] = 'name_1';
  208. $handler->display->display_options['filters']['name_1']['table'] = 'featuremap';
  209. $handler->display->display_options['filters']['name_1']['field'] = 'name';
  210. $handler->display->display_options['filters']['name_1']['operator'] = 'contains';
  211. $handler->display->display_options['filters']['name_1']['group'] = '0';
  212. $handler->display->display_options['filters']['name_1']['exposed'] = TRUE;
  213. $handler->display->display_options['filters']['name_1']['expose']['operator_id'] = 'name_1_op';
  214. $handler->display->display_options['filters']['name_1']['expose']['label'] = 'Name Contains';
  215. $handler->display->display_options['filters']['name_1']['expose']['operator'] = 'name_1_op';
  216. $handler->display->display_options['filters']['name_1']['expose']['identifier'] = 'name_1';
  217. $handler->display->display_options['filters']['name_1']['expose']['remember_roles'] = [
  218. 2 => '2',
  219. 1 => 0,
  220. 3 => 0,
  221. ];
  222. /* Filter criterion: Chado Featuremap: Description */
  223. $handler->display->display_options['filters']['description']['id'] = 'description';
  224. $handler->display->display_options['filters']['description']['table'] = 'featuremap';
  225. $handler->display->display_options['filters']['description']['field'] = 'description';
  226. $handler->display->display_options['filters']['description']['operator'] = 'contains';
  227. $handler->display->display_options['filters']['description']['group'] = '0';
  228. $handler->display->display_options['filters']['description']['exposed'] = TRUE;
  229. $handler->display->display_options['filters']['description']['expose']['operator_id'] = 'description_op';
  230. $handler->display->display_options['filters']['description']['expose']['label'] = 'Description Contains';
  231. $handler->display->display_options['filters']['description']['expose']['operator'] = 'description_op';
  232. $handler->display->display_options['filters']['description']['expose']['identifier'] = 'description';
  233. $handler->display->display_options['filters']['description']['expose']['remember_roles'] = [
  234. 2 => '2',
  235. 1 => 0,
  236. 3 => 0,
  237. ];
  238. /* Display: Page */
  239. $handler = $view->new_display('page', 'Page', 'page_1');
  240. $handler->display->display_options['path'] = 'admin/tripal/legacy/tripal_featuremap/featuremaps';
  241. $handler->display->display_options['menu']['type'] = 'default tab';
  242. $handler->display->display_options['menu']['title'] = 'Maps';
  243. $handler->display->display_options['menu']['description'] = 'A listing of chado feature maps.';
  244. $handler->display->display_options['menu']['weight'] = '-10';
  245. $handler->display->display_options['menu']['context'] = 0;
  246. $handler->display->display_options['menu']['context_only_inline'] = 0;
  247. $handler->display->display_options['tab_options']['weight'] = '0';
  248. return $view;
  249. }