tripal_genetic.views_default.inc 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <?php
  2. /**
  3. * @file
  4. * Describe default genetic views
  5. */
  6. /**
  7. * Implements hook_views_default_views().
  8. *
  9. * @ingroup tripal_genetic
  10. */
  11. function tripal_genetic_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_genetic_search_biological_data_views()
  16. $view = tripal_genetic_defaultvalue_user_genotypes();
  17. $view = tripal_make_view_compatible_with_external($view);
  18. $views[$view->name] = $view;
  19. // Admin view
  20. $view = tripal_genetic_defaultviews_admin_genotypes();
  21. $view = tripal_make_view_compatible_with_external($view);
  22. $views[$view->name] = $view;
  23. return $views;
  24. }
  25. /**
  26. * Defines the genetic user search default view.
  27. *
  28. * @ingroup tripal_genetic
  29. */
  30. function tripal_genetic_defaultvalue_user_genotypes() {
  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_genetic_defaultviews_admin_genotypes();
  34. // change some view admin stuff
  35. $view->name = 'tripal_genetic_user_genotypes';
  36. $view->human_name = 'Genotype User Search';
  37. $view->description = 'Allows users to search genotype data';
  38. $view->tag = 'tripal search';
  39. // Change the path
  40. $view->display['page_1']->display_options['path'] = 'chado/genotype';
  41. $view->display['page_1']->display_options['menu'] = [
  42. 'type' => 'normal',
  43. 'title' => 'Genotypes',
  44. 'description' => 'Genetic variations such as SNPs, MNPs and indels.',
  45. 'weight' => '-10',
  46. ];
  47. unset($view->display['page_1']->display_options['tab_options']);
  48. // Remove edit/delete node
  49. unset(
  50. $view->display['default']->display_options['fields']['delete_node'],
  51. $view->display['default']->display_options['fields']['edit_node'],
  52. $view->display['default']->display_options['fields']['nothing']
  53. );
  54. // Remove the admin action links
  55. unset($view->display['default']->display_options['header']['action_links_area']);
  56. return $view;
  57. }
  58. /**
  59. * Describes the default administration genetic view
  60. *
  61. * @ingroup tripal_genetic
  62. */
  63. function tripal_genetic_defaultviews_admin_genotypes() {
  64. $view = new view();
  65. $view->name = 'tripal_genetic_admin_genetics';
  66. $view->description = 'DO NOT DISABLE';
  67. $view->tag = 'tripal admin';
  68. $view->base_table = 'genotype';
  69. $view->human_name = 'Genotype Admin';
  70. $view->core = 7;
  71. $view->api_version = '3.0';
  72. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  73. /* Display: Defaults */
  74. $handler = $view->new_display('default', 'Defaults', 'default');
  75. $handler->display->display_options['title'] = 'Genotypes Observed';
  76. $handler->display->display_options['use_more_always'] = FALSE;
  77. $handler->display->display_options['access']['type'] = 'perm';
  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 genotypes that meet the filter requirements. Use the filters to restrict this set to a more reasonable number of genotypes or to find a specific genotype.';
  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. 'uniquename' => 'uniquename',
  93. 'name' => 'name',
  94. 'description' => 'description',
  95. ];
  96. $handler->display->display_options['style_options']['default'] = 'uniquename';
  97. $handler->display->display_options['style_options']['info'] = [
  98. 'uniquename' => [
  99. 'sortable' => 1,
  100. 'separator' => '',
  101. ],
  102. 'name' => [
  103. 'sortable' => 1,
  104. 'separator' => '',
  105. ],
  106. 'description' => [
  107. 'sortable' => 1,
  108. 'separator' => '',
  109. ],
  110. ];
  111. /* No results behavior: Global: Text area */
  112. $handler->display->display_options['empty']['text']['id'] = 'area';
  113. $handler->display->display_options['empty']['text']['table'] = 'views';
  114. $handler->display->display_options['empty']['text']['field'] = 'area';
  115. $handler->display->display_options['empty']['text']['content'] = 'No genotypes match the current criteria.';
  116. $handler->display->display_options['empty']['text']['format'] = '2';
  117. /* Field: Chado Genotype: Uniquename */
  118. $handler->display->display_options['fields']['uniquename']['id'] = 'uniquename';
  119. $handler->display->display_options['fields']['uniquename']['table'] = 'genotype';
  120. $handler->display->display_options['fields']['uniquename']['field'] = 'uniquename';
  121. /* Field: Chado Genotype: Name */
  122. $handler->display->display_options['fields']['name']['id'] = 'name';
  123. $handler->display->display_options['fields']['name']['table'] = 'genotype';
  124. $handler->display->display_options['fields']['name']['field'] = 'name';
  125. /* Field: Chado Genotype: Description */
  126. $handler->display->display_options['fields']['description']['id'] = 'description';
  127. $handler->display->display_options['fields']['description']['table'] = 'genotype';
  128. $handler->display->display_options['fields']['description']['field'] = 'description';
  129. /* Sort criterion: Chado Genotype: Id */
  130. $handler->display->display_options['sorts']['genotype_id']['id'] = 'genotype_id';
  131. $handler->display->display_options['sorts']['genotype_id']['table'] = 'genotype';
  132. $handler->display->display_options['sorts']['genotype_id']['field'] = 'genotype_id';
  133. $handler->display->display_options['sorts']['genotype_id']['order'] = 'DESC';
  134. /* Filter criterion: Chado Genotype: Uniquename */
  135. $handler->display->display_options['filters']['uniquename']['id'] = 'uniquename';
  136. $handler->display->display_options['filters']['uniquename']['table'] = 'genotype';
  137. $handler->display->display_options['filters']['uniquename']['field'] = 'uniquename';
  138. $handler->display->display_options['filters']['uniquename']['operator'] = 'contains';
  139. $handler->display->display_options['filters']['uniquename']['group'] = '0';
  140. $handler->display->display_options['filters']['uniquename']['exposed'] = TRUE;
  141. $handler->display->display_options['filters']['uniquename']['expose']['operator_id'] = 'uniquename_op';
  142. $handler->display->display_options['filters']['uniquename']['expose']['label'] = 'Unique Name Contains';
  143. $handler->display->display_options['filters']['uniquename']['expose']['operator'] = 'uniquename_op';
  144. $handler->display->display_options['filters']['uniquename']['expose']['identifier'] = 'uniquename';
  145. $handler->display->display_options['filters']['uniquename']['expose']['remember_roles'] = [
  146. 2 => '2',
  147. 1 => 0,
  148. 3 => 0,
  149. ];
  150. /* Filter criterion: Chado Genotype: Description */
  151. $handler->display->display_options['filters']['description']['id'] = 'description';
  152. $handler->display->display_options['filters']['description']['table'] = 'genotype';
  153. $handler->display->display_options['filters']['description']['field'] = 'description';
  154. $handler->display->display_options['filters']['description']['operator'] = 'contains';
  155. $handler->display->display_options['filters']['description']['group'] = '0';
  156. $handler->display->display_options['filters']['description']['exposed'] = TRUE;
  157. $handler->display->display_options['filters']['description']['expose']['operator_id'] = 'description_op';
  158. $handler->display->display_options['filters']['description']['expose']['label'] = 'Description Contains';
  159. $handler->display->display_options['filters']['description']['expose']['operator'] = 'description_op';
  160. $handler->display->display_options['filters']['description']['expose']['identifier'] = 'description';
  161. $handler->display->display_options['filters']['description']['expose']['remember_roles'] = [
  162. 2 => '2',
  163. 1 => 0,
  164. 3 => 0,
  165. ];
  166. /* Display: Page */
  167. $handler = $view->new_display('page', 'Page', 'page_1');
  168. $handler->display->display_options['path'] = 'admin/tripal/legacy/tripal_genetic/genotypes';
  169. $handler->display->display_options['menu']['type'] = 'default tab';
  170. $handler->display->display_options['menu']['title'] = 'Genotypes';
  171. $handler->display->display_options['menu']['description'] = 'A genotype is defined by a collection of features, mutations, etc.';
  172. $handler->display->display_options['menu']['weight'] = '-10';
  173. $handler->display->display_options['menu']['context'] = 0;
  174. $handler->display->display_options['menu']['context_only_inline'] = 0;
  175. $handler->display->display_options['tab_options']['weight'] = '0';
  176. return $view;
  177. }