tripal_analysis.views_default.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <?php
  2. /**
  3. * @file
  4. * Contains the default views for the analysis module.
  5. *
  6. * @ingroup tripal_legacy_analysis
  7. */
  8. /**
  9. * Implements hook_views_default_views().
  10. *
  11. * @ingroup tripal_legacy_analysis
  12. */
  13. function tripal_analysis_views_default_views() {
  14. $views = [];
  15. // User View ("Search Biological Content")
  16. // Remember, if you change the name/path of this view,
  17. // you also want to change it's description in tripal_analysis_search_biological_data_views()
  18. $view = tripal_analysis_defaultvalue_user_analysis();
  19. $view = tripal_make_view_compatible_with_external($view);
  20. $views[$view->name] = $view;
  21. // Admin View
  22. $view = tripal_analysis_defaultvalue_admin_analysis();
  23. $view = tripal_make_view_compatible_with_external($view);
  24. $views[$view->name] = $view;
  25. return $views;
  26. }
  27. /**
  28. * Defines the analysis user search default view.
  29. *
  30. * @ingroup tripal_legacy_analysis
  31. */
  32. function tripal_analysis_defaultvalue_user_analysis() {
  33. // As a shortcut, currently I am copying the admin view and then tweaking it
  34. // In the future this should be replaced by a views export
  35. $view = tripal_analysis_defaultvalue_admin_analysis();
  36. // change some view admin stuff
  37. $view->name = 'tripal_analysis_user_analyses';
  38. $view->human_name = 'Analysis User Search';
  39. $view->description = 'Allows users to search analysis data';
  40. $view->tag = 'tripal search';
  41. // Change the path
  42. $view->display['page_1']->display_options['path'] = 'chado/analysis';
  43. $view->display['page_1']->display_options['menu']['type'] = 'normal';
  44. unset($view->display['page_1']->display_options['tab_options']);
  45. // Change the permission
  46. $view->display['default']->display_options['access']['perm'] = 'access chado_analysis content';
  47. // Remove edit/delete node
  48. unset(
  49. $view->display['default']->display_options['fields']['delete_node'],
  50. $view->display['default']->display_options['fields']['edit_node'],
  51. $view->display['default']->display_options['fields']['nothing']
  52. );
  53. // Remove the admin action links
  54. unset($view->display['default']->display_options['header']['action_links_area']);
  55. return $view;
  56. }
  57. /**
  58. * Defines the analysis admin default view.
  59. *
  60. * @ingroup tripal_legacy_analysis
  61. */
  62. function tripal_analysis_defaultvalue_admin_analysis() {
  63. $view = new view();
  64. $view->name = 'tripal_analysis_admin_analyses';
  65. $view->description = 'DO NOT DISABLE';
  66. $view->tag = 'tripal admin';
  67. $view->base_table = 'analysis';
  68. $view->human_name = 'Analysis Admin';
  69. $view->core = 0;
  70. $view->api_version = '3.0';
  71. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  72. /* Display: Defaults */
  73. $handler = $view->new_display('default', 'Defaults', 'default');
  74. $handler->display->display_options['title'] = 'Analysis';
  75. $handler->display->display_options['use_more_always'] = FALSE;
  76. $handler->display->display_options['access']['type'] = 'perm';
  77. $handler->display->display_options['access']['perm'] = 'access chado_analysis content';
  78. $handler->display->display_options['cache']['type'] = 'none';
  79. $handler->display->display_options['query']['type'] = 'views_query';
  80. $handler->display->display_options['exposed_form']['type'] = 'input_required';
  81. $handler->display->display_options['exposed_form']['options']['submit_button'] = 'Search';
  82. $handler->display->display_options['exposed_form']['options']['text_input_required'] = 'Click search to see a listing of analyses that meet the filter requirements. Use the filters to restrict this set to a more reasonable number of analyses or to find a specific analysis.';
  83. $handler->display->display_options['exposed_form']['options']['text_input_required_format'] = 'full_html';
  84. $handler->display->display_options['pager']['type'] = 'full';
  85. $handler->display->display_options['pager']['options']['items_per_page'] = '25';
  86. $handler->display->display_options['pager']['options']['offset'] = '0';
  87. $handler->display->display_options['pager']['options']['id'] = '0';
  88. $handler->display->display_options['pager']['options']['quantity'] = '9';
  89. $handler->display->display_options['style_plugin'] = 'table';
  90. $handler->display->display_options['style_options']['grouping'] = '';
  91. $handler->display->display_options['style_options']['columns'] = [
  92. 'name' => 'name',
  93. 'program' => 'program',
  94. 'sourcename' => 'sourcename',
  95. 'num_features' => 'num_features',
  96. 'timeexecuted' => 'timeexecuted',
  97. ];
  98. $handler->display->display_options['style_options']['default'] = 'name';
  99. $handler->display->display_options['style_options']['info'] = [
  100. 'name' => [
  101. 'sortable' => 1,
  102. 'separator' => '',
  103. ],
  104. 'program' => [
  105. 'sortable' => 1,
  106. 'separator' => '',
  107. ],
  108. 'sourcename' => [
  109. 'sortable' => 1,
  110. 'separator' => '',
  111. ],
  112. 'num_features' => [
  113. 'separator' => '',
  114. ],
  115. 'timeexecuted' => [
  116. 'sortable' => 1,
  117. 'separator' => '',
  118. ],
  119. ];
  120. /* Header: Global: Action Links */
  121. $handler->display->display_options['header']['action_links_area']['id'] = 'action_links_area';
  122. $handler->display->display_options['header']['action_links_area']['table'] = 'views';
  123. $handler->display->display_options['header']['action_links_area']['field'] = 'action_links_area';
  124. $handler->display->display_options['header']['action_links_area']['label'] = 'Action Links';
  125. $handler->display->display_options['header']['action_links_area']['empty'] = TRUE;
  126. $handler->display->display_options['header']['action_links_area']['link-1'] = [
  127. 'label-1' => 'Add Analysis',
  128. 'path-1' => 'node/add/tripal-analysis',
  129. ];
  130. $handler->display->display_options['header']['action_links_area']['link-2'] = [
  131. 'label-2' => '',
  132. 'path-2' => '',
  133. ];
  134. $handler->display->display_options['header']['action_links_area']['link-3'] = [
  135. 'label-3' => '',
  136. 'path-3' => '',
  137. ];
  138. $handler->display->display_options['header']['action_links_area']['link-4'] = [
  139. 'label-4' => '',
  140. 'path-4' => '',
  141. ];
  142. /* No results behavior: Global: Text area */
  143. $handler->display->display_options['empty']['text']['id'] = 'text';
  144. $handler->display->display_options['empty']['text']['table'] = 'views';
  145. $handler->display->display_options['empty']['text']['field'] = 'area';
  146. $handler->display->display_options['empty']['text']['empty'] = TRUE;
  147. $handler->display->display_options['empty']['text']['content'] = 'No analyses match the supplied criteria.';
  148. $handler->display->display_options['empty']['text']['format'] = 'full_html';
  149. /* Relationship: Analysis: Analysis => Node */
  150. $handler->display->display_options['relationships']['analysis_id']['id'] = 'analysis_id';
  151. $handler->display->display_options['relationships']['analysis_id']['table'] = 'chado_analysis';
  152. $handler->display->display_options['relationships']['analysis_id']['field'] = 'analysis_id';
  153. /* Field: Content: Nid */
  154. $handler->display->display_options['fields']['nid']['id'] = 'nid';
  155. $handler->display->display_options['fields']['nid']['table'] = 'node';
  156. $handler->display->display_options['fields']['nid']['field'] = 'nid';
  157. $handler->display->display_options['fields']['nid']['relationship'] = 'analysis_id';
  158. $handler->display->display_options['fields']['nid']['exclude'] = TRUE;
  159. /* Field: Node URL */
  160. $handler->display->display_options['fields']['nid_1']['id'] = 'nid_1';
  161. $handler->display->display_options['fields']['nid_1']['table'] = 'node';
  162. $handler->display->display_options['fields']['nid_1']['field'] = 'nid';
  163. $handler->display->display_options['fields']['nid_1']['relationship'] = 'feature_id';
  164. $handler->display->display_options['fields']['nid_1']['ui_name'] = 'Node URL';
  165. $handler->display->display_options['fields']['nid_1']['label'] = '';
  166. $handler->display->display_options['fields']['nid_1']['exclude'] = TRUE;
  167. $handler->display->display_options['fields']['nid_1']['alter']['alter_text'] = TRUE;
  168. $handler->display->display_options['fields']['nid_1']['alter']['text'] = 'node/[nid]';
  169. $handler->display->display_options['fields']['nid_1']['element_label_colon'] = FALSE;
  170. /* Field: Chado Analysis: Name */
  171. $handler->display->display_options['fields']['name']['id'] = 'name';
  172. $handler->display->display_options['fields']['name']['table'] = 'analysis';
  173. $handler->display->display_options['fields']['name']['field'] = 'name';
  174. $handler->display->display_options['fields']['name']['alter']['make_link'] = TRUE;
  175. $handler->display->display_options['fields']['name']['alter']['path'] = '[nid_1]';
  176. /* Field: Chado Analysis: Program */
  177. $handler->display->display_options['fields']['program']['id'] = 'program';
  178. $handler->display->display_options['fields']['program']['table'] = 'analysis';
  179. $handler->display->display_options['fields']['program']['field'] = 'program';
  180. /* Field: Chado Analysis: Sourcename */
  181. $handler->display->display_options['fields']['sourcename']['id'] = 'sourcename';
  182. $handler->display->display_options['fields']['sourcename']['table'] = 'analysis';
  183. $handler->display->display_options['fields']['sourcename']['field'] = 'sourcename';
  184. $handler->display->display_options['fields']['sourcename']['label'] = 'Source';
  185. /* Field: Content: Delete link */
  186. $handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
  187. $handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node';
  188. $handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
  189. $handler->display->display_options['fields']['delete_node']['relationship'] = 'analysis_id';
  190. $handler->display->display_options['fields']['delete_node']['exclude'] = TRUE;
  191. /* Field: Content: Edit link */
  192. $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
  193. $handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node';
  194. $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
  195. $handler->display->display_options['fields']['edit_node']['relationship'] = 'analysis_id';
  196. $handler->display->display_options['fields']['edit_node']['exclude'] = TRUE;
  197. /* Field: Global: Custom text */
  198. $handler->display->display_options['fields']['nothing']['id'] = 'nothing';
  199. $handler->display->display_options['fields']['nothing']['table'] = 'views';
  200. $handler->display->display_options['fields']['nothing']['field'] = 'nothing';
  201. $handler->display->display_options['fields']['nothing']['label'] = '';
  202. $handler->display->display_options['fields']['nothing']['alter']['text'] = '[edit_node] [delete_node]';
  203. $handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE;
  204. /* Sort criterion: Chado Analysis: Analysis Id */
  205. $handler->display->display_options['sorts']['analysis_id']['id'] = 'analysis_id';
  206. $handler->display->display_options['sorts']['analysis_id']['table'] = 'analysis';
  207. $handler->display->display_options['sorts']['analysis_id']['field'] = 'analysis_id';
  208. $handler->display->display_options['sorts']['analysis_id']['order'] = 'DESC';
  209. /* Filter criterion: Chado Analysis: Name */
  210. $handler->display->display_options['filters']['name']['id'] = 'name';
  211. $handler->display->display_options['filters']['name']['table'] = 'analysis';
  212. $handler->display->display_options['filters']['name']['field'] = 'name';
  213. $handler->display->display_options['filters']['name']['operator'] = '~';
  214. $handler->display->display_options['filters']['name']['group'] = 1;
  215. $handler->display->display_options['filters']['name']['exposed'] = TRUE;
  216. $handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op';
  217. $handler->display->display_options['filters']['name']['expose']['label'] = 'Name Contains';
  218. $handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op';
  219. $handler->display->display_options['filters']['name']['expose']['identifier'] = 'name';
  220. /* Filter criterion: Chado Analysis: Program */
  221. $handler->display->display_options['filters']['program']['id'] = 'program';
  222. $handler->display->display_options['filters']['program']['table'] = 'analysis';
  223. $handler->display->display_options['filters']['program']['field'] = 'program';
  224. $handler->display->display_options['filters']['program']['operator'] = 'contains';
  225. $handler->display->display_options['filters']['program']['group'] = 1;
  226. $handler->display->display_options['filters']['program']['exposed'] = TRUE;
  227. $handler->display->display_options['filters']['program']['expose']['operator_id'] = 'program_op';
  228. $handler->display->display_options['filters']['program']['expose']['label'] = 'Program Name Contains';
  229. $handler->display->display_options['filters']['program']['expose']['operator'] = 'program_op';
  230. $handler->display->display_options['filters']['program']['expose']['identifier'] = 'program';
  231. $handler->display->display_options['filters']['program']['expose']['remember_roles'] = [
  232. 2 => '2',
  233. 1 => 0,
  234. 3 => 0,
  235. ];
  236. /* Filter criterion: Chado Analysis: Sourcename */
  237. $handler->display->display_options['filters']['sourcename']['id'] = 'sourcename';
  238. $handler->display->display_options['filters']['sourcename']['table'] = 'analysis';
  239. $handler->display->display_options['filters']['sourcename']['field'] = 'sourcename';
  240. $handler->display->display_options['filters']['sourcename']['operator'] = '~';
  241. $handler->display->display_options['filters']['sourcename']['group'] = 1;
  242. $handler->display->display_options['filters']['sourcename']['exposed'] = TRUE;
  243. $handler->display->display_options['filters']['sourcename']['expose']['operator_id'] = 'sourcename_op';
  244. $handler->display->display_options['filters']['sourcename']['expose']['label'] = 'Source Contains';
  245. $handler->display->display_options['filters']['sourcename']['expose']['operator'] = 'sourcename_op';
  246. $handler->display->display_options['filters']['sourcename']['expose']['identifier'] = 'sourcename';
  247. /* Display: Page */
  248. $handler = $view->new_display('page', 'Page', 'page_1');
  249. $handler->display->display_options['path'] = 'admin/tripal/legacy/tripal_analysis/analysis';
  250. $handler->display->display_options['menu']['type'] = 'default tab';
  251. $handler->display->display_options['menu']['title'] = 'Analyses';
  252. $handler->display->display_options['menu']['weight'] = '-10';
  253. $handler->display->display_options['menu']['context'] = 0;
  254. $handler->display->display_options['menu']['context_only_inline'] = 0;
  255. $handler->display->display_options['tab_options']['weight'] = '0';
  256. return $view;
  257. }