tripal_organism.views_default.inc 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <?php
  2. /**
  3. *
  4. * @ingroup tripal_organism_views
  5. */
  6. function tripal_organism_views_default_views() {
  7. $views = array();
  8. if (!module_exists('tripal_views')) {
  9. return $views;
  10. }
  11. // Main default view
  12. $view = new view;
  13. $view->name = 'organism_listing';
  14. $view->description = 'A listing of all organism in chado';
  15. $view->tag = 'chado default';
  16. $view->base_table = 'organism';
  17. $view->core = 0;
  18. $view->api_version = '2';
  19. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  20. $handler = $view->new_display('default', 'Defaults', 'default');
  21. $handler->override_option('fields', array(
  22. 'common_name' => array(
  23. 'label' => 'Common Name',
  24. 'alter' => array(
  25. 'alter_text' => 0,
  26. 'text' => '',
  27. 'make_link' => 0,
  28. 'path' => '',
  29. 'link_class' => '',
  30. 'alt' => '',
  31. 'prefix' => '',
  32. 'suffix' => '',
  33. 'target' => '',
  34. 'help' => '',
  35. 'trim' => 0,
  36. 'max_length' => '',
  37. 'word_boundary' => 1,
  38. 'ellipsis' => 1,
  39. 'html' => 0,
  40. 'strip_tags' => 0,
  41. ),
  42. 'empty' => '',
  43. 'hide_empty' => 0,
  44. 'empty_zero' => 0,
  45. 'link_to_node' => 1,
  46. 'exclude' => 0,
  47. 'id' => 'common_name',
  48. 'table' => 'organism',
  49. 'field' => 'common_name',
  50. 'relationship' => 'none',
  51. ),
  52. 'genus' => array(
  53. 'label' => 'Genus',
  54. 'alter' => array(
  55. 'alter_text' => 0,
  56. 'text' => '',
  57. 'make_link' => 0,
  58. 'path' => '',
  59. 'link_class' => '',
  60. 'alt' => '',
  61. 'prefix' => '',
  62. 'suffix' => '',
  63. 'target' => '',
  64. 'help' => '',
  65. 'trim' => 0,
  66. 'max_length' => '',
  67. 'word_boundary' => 1,
  68. 'ellipsis' => 1,
  69. 'html' => 0,
  70. 'strip_tags' => 0,
  71. ),
  72. 'empty' => '',
  73. 'hide_empty' => 0,
  74. 'empty_zero' => 0,
  75. 'exclude' => 0,
  76. 'id' => 'genus',
  77. 'table' => 'organism',
  78. 'field' => 'genus',
  79. 'relationship' => 'none',
  80. ),
  81. 'species' => array(
  82. 'label' => 'Species',
  83. 'alter' => array(
  84. 'alter_text' => 0,
  85. 'text' => '',
  86. 'make_link' => 0,
  87. 'path' => '',
  88. 'link_class' => '',
  89. 'alt' => '',
  90. 'prefix' => '',
  91. 'suffix' => '',
  92. 'target' => '',
  93. 'help' => '',
  94. 'trim' => 0,
  95. 'max_length' => '',
  96. 'word_boundary' => 1,
  97. 'ellipsis' => 1,
  98. 'html' => 0,
  99. 'strip_tags' => 0,
  100. ),
  101. 'empty' => '',
  102. 'hide_empty' => 0,
  103. 'empty_zero' => 0,
  104. 'exclude' => 0,
  105. 'id' => 'species',
  106. 'table' => 'organism',
  107. 'field' => 'species',
  108. 'relationship' => 'none',
  109. ),
  110. 'abbreviation' => array(
  111. 'label' => 'Abbreviation',
  112. 'alter' => array(
  113. 'alter_text' => 0,
  114. 'text' => '',
  115. 'make_link' => 0,
  116. 'path' => '',
  117. 'link_class' => '',
  118. 'alt' => '',
  119. 'prefix' => '',
  120. 'suffix' => '',
  121. 'target' => '',
  122. 'help' => '',
  123. 'trim' => 0,
  124. 'max_length' => '',
  125. 'word_boundary' => 1,
  126. 'ellipsis' => 1,
  127. 'html' => 0,
  128. 'strip_tags' => 0,
  129. ),
  130. 'empty' => '',
  131. 'hide_empty' => 0,
  132. 'empty_zero' => 0,
  133. 'link_to_node' => 0,
  134. 'exclude' => 0,
  135. 'id' => 'abbreviation',
  136. 'table' => 'organism',
  137. 'field' => 'abbreviation',
  138. 'relationship' => 'none',
  139. ),
  140. ));
  141. $handler->override_option('sorts', array(
  142. 'genus' => array(
  143. 'order' => 'ASC',
  144. 'id' => 'genus',
  145. 'table' => 'organism',
  146. 'field' => 'genus',
  147. 'relationship' => 'none',
  148. ),
  149. 'species' => array(
  150. 'order' => 'ASC',
  151. 'id' => 'species',
  152. 'table' => 'organism',
  153. 'field' => 'species',
  154. 'relationship' => 'none',
  155. ),
  156. ));
  157. $handler->override_option('access', array(
  158. 'type' => 'perm',
  159. 'perm' => 'access chado_organism content',
  160. ));
  161. $handler->override_option('cache', array(
  162. 'type' => 'none',
  163. ));
  164. $handler->override_option('title', 'Organisms');
  165. $handler->override_option('empty', 'No organisms matched the supplied criteria.');
  166. $handler->override_option('empty_format', '1');
  167. $handler->override_option('items_per_page', 0);
  168. $handler->override_option('style_plugin', 'table');
  169. $handler->override_option('style_options', array(
  170. 'grouping' => '',
  171. 'override' => 1,
  172. 'sticky' => 0,
  173. 'order' => 'asc',
  174. 'summary' => '',
  175. 'columns' => array(
  176. 'common_name' => 'common_name',
  177. 'genus' => 'genus',
  178. 'species' => 'species',
  179. 'abbreviation' => 'abbreviation',
  180. ),
  181. 'info' => array(
  182. 'common_name' => array(
  183. 'sortable' => 1,
  184. 'separator' => '',
  185. ),
  186. 'genus' => array(
  187. 'sortable' => 1,
  188. 'separator' => '',
  189. ),
  190. 'species' => array(
  191. 'sortable' => 1,
  192. 'separator' => '',
  193. ),
  194. 'abbreviation' => array(
  195. 'sortable' => 1,
  196. 'separator' => '',
  197. ),
  198. ),
  199. 'default' => '-1',
  200. ));
  201. $default_handler = $handler;
  202. $handler = $view->new_display('page', 'Page', 'page_1');
  203. $handler->override_option('path', 'chado/organisms');
  204. $handler->override_option('menu', array(
  205. 'type' => 'normal',
  206. 'title' => 'Organisms',
  207. 'description' => 'A biological organism.',
  208. 'weight' => '10',
  209. 'name' => 'navigation',
  210. ));
  211. $handler->override_option('tab_options', array(
  212. 'type' => 'none',
  213. 'title' => '',
  214. 'description' => '',
  215. 'weight' => 0,
  216. 'name' => 'navigation',
  217. ));
  218. // Add code specific to a local chado installation
  219. // NOTE: Edit $handler above to $default_handler for the default display
  220. if (tripal_core_chado_schema_exists()) {
  221. // Add nid field
  222. $fields = $view->get_items('field', 'default');
  223. $new_fields = array(
  224. 'nid' => array(
  225. 'label' => 'Nid',
  226. 'alter' => array(
  227. 'alter_text' => 0,
  228. 'text' => '',
  229. 'make_link' => 0,
  230. 'path' => '',
  231. 'absolute' => 0,
  232. 'link_class' => '',
  233. 'alt' => '',
  234. 'rel' => '',
  235. 'prefix' => '',
  236. 'suffix' => '',
  237. 'target' => '',
  238. 'help' => '',
  239. 'trim' => 0,
  240. 'max_length' => '',
  241. 'word_boundary' => 1,
  242. 'ellipsis' => 1,
  243. 'html' => 0,
  244. 'strip_tags' => 0,
  245. ),
  246. 'empty' => '',
  247. 'hide_empty' => 0,
  248. 'empty_zero' => 0,
  249. 'hide_alter_empty' => 1,
  250. 'link_to_node' => 0,
  251. 'exclude' => 1,
  252. 'id' => 'nid',
  253. 'table' => 'node',
  254. 'field' => 'nid',
  255. 'relationship' => 'none',
  256. )
  257. );
  258. $fields = $new_fields + $fields;
  259. // Adds organism => Node relationship
  260. $default_handler->override_option('relationships', array(
  261. 'nid' => array(
  262. 'label' => 'Organism to Node',
  263. 'required' => 0,
  264. 'id' => 'nid',
  265. 'table' => 'chado_organism',
  266. 'field' => 'nid',
  267. 'relationship' => 'none',
  268. ),
  269. ));
  270. // Change analysis.name to have a link to the node
  271. $fields['common_name']['alter']['link_to_node'] = 1;
  272. $default_handler->override_option('fields', $fields);
  273. // Only show records with published nodes
  274. /**
  275. $filters = $view->get_items('filter', 'default');
  276. $filters['status'] = array(
  277. 'operator' => '=',
  278. 'value' => '1',
  279. 'group' => '0',
  280. 'exposed' => FALSE,
  281. 'expose' => array(
  282. 'operator' => FALSE,
  283. 'label' => '',
  284. ),
  285. 'id' => 'status',
  286. 'table' => 'node',
  287. 'field' => 'status',
  288. 'relationship' => 'none',
  289. );
  290. $default_handler->override_option('filters', $filters);
  291. */
  292. }
  293. $views[$view->name] = $view;
  294. return $views;
  295. }