tripal_contact.views.inc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions for views integration of
  5. * chado/tripal_contact tables. Supplementary functions can be found in
  6. * ./views/
  7. *
  8. * Documentation on views integration can be found at
  9. * http://views2.logrus.com/doc/html/index.html.
  10. */
  11. /**
  12. *
  13. * @ingroup tripal_feature_views
  14. */
  15. function tripal_contact_views_default_views() {
  16. $views = array();
  17. if (!module_exists('tripal_views')) {
  18. return $views;
  19. }
  20. // Main default view
  21. $view = new view;
  22. $view->name = 'contact_listing';
  23. $view->description = 'A listing of chado contacts';
  24. $view->tag = 'chado default';
  25. $view->base_table = 'contact';
  26. $view->core = 6;
  27. $view->api_version = '2';
  28. $view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
  29. $handler = $view->new_display('default', 'Defaults', 'default');
  30. $handler->override_option('fields', array(
  31. 'name' => array(
  32. 'label' => 'Name',
  33. 'alter' => array(
  34. 'alter_text' => 0,
  35. 'text' => '',
  36. 'make_link' => 0,
  37. 'path' => '',
  38. 'absolute' => 0,
  39. 'link_class' => '',
  40. 'alt' => '',
  41. 'rel' => '',
  42. 'prefix' => '',
  43. 'suffix' => '',
  44. 'target' => '',
  45. 'help' => '',
  46. 'trim' => 0,
  47. 'max_length' => '',
  48. 'word_boundary' => 1,
  49. 'ellipsis' => 1,
  50. 'html' => 0,
  51. 'strip_tags' => 0,
  52. ),
  53. 'empty' => '',
  54. 'hide_empty' => 0,
  55. 'empty_zero' => 0,
  56. 'hide_alter_empty' => 1,
  57. 'type' => 'separator',
  58. 'separator' => ', ',
  59. 'exclude' => 0,
  60. 'id' => 'name',
  61. 'table' => 'contact',
  62. 'field' => 'name',
  63. 'relationship' => 'none',
  64. ),
  65. 'name_1' => array(
  66. 'label' => 'Type',
  67. 'alter' => array(
  68. 'alter_text' => 0,
  69. 'text' => '',
  70. 'make_link' => 0,
  71. 'path' => '',
  72. 'absolute' => 0,
  73. 'link_class' => '',
  74. 'alt' => '',
  75. 'rel' => '',
  76. 'prefix' => '',
  77. 'suffix' => '',
  78. 'target' => '',
  79. 'help' => '',
  80. 'trim' => 0,
  81. 'max_length' => '',
  82. 'word_boundary' => 1,
  83. 'ellipsis' => 1,
  84. 'html' => 0,
  85. 'strip_tags' => 0,
  86. ),
  87. 'empty' => '',
  88. 'hide_empty' => 0,
  89. 'empty_zero' => 0,
  90. 'hide_alter_empty' => 1,
  91. 'type' => 'separator',
  92. 'separator' => ', ',
  93. 'exclude' => 0,
  94. 'id' => 'name_1',
  95. 'table' => 'cvterm',
  96. 'field' => 'name',
  97. 'relationship' => 'none',
  98. ),
  99. 'description' => array(
  100. 'label' => 'Description',
  101. 'alter' => array(
  102. 'alter_text' => 0,
  103. 'text' => '',
  104. 'make_link' => 0,
  105. 'path' => '',
  106. 'absolute' => 0,
  107. 'link_class' => '',
  108. 'alt' => '',
  109. 'rel' => '',
  110. 'prefix' => '',
  111. 'suffix' => '',
  112. 'target' => '',
  113. 'help' => '',
  114. 'trim' => 0,
  115. 'max_length' => '',
  116. 'word_boundary' => 1,
  117. 'ellipsis' => 1,
  118. 'html' => 0,
  119. 'strip_tags' => 0,
  120. ),
  121. 'empty' => '',
  122. 'hide_empty' => 0,
  123. 'empty_zero' => 0,
  124. 'hide_alter_empty' => 1,
  125. 'type' => 'separator',
  126. 'separator' => ', ',
  127. 'exclude' => 0,
  128. 'id' => 'description',
  129. 'table' => 'contact',
  130. 'field' => 'description',
  131. 'relationship' => 'none',
  132. ),
  133. ));
  134. $handler->override_option('filters', array(
  135. 'search_results' => array(
  136. 'operator' => '=',
  137. 'value' => '',
  138. 'group' => '0',
  139. 'exposed' => FALSE,
  140. 'expose' => array(
  141. 'operator' => FALSE,
  142. 'label' => '',
  143. ),
  144. 'id' => 'search_results',
  145. 'table' => 'views',
  146. 'field' => 'search_results',
  147. 'relationship' => 'none',
  148. 'apply_button' => 'Show',
  149. 'no_results_text' => 'Click "Show" to see a list of all contacts matching the entered criteria. If you leave a any of the criteria blank then the contacts will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all contacts will be listed.',
  150. ),
  151. 'type_id' => array(
  152. 'operator' => '=',
  153. 'value' => '',
  154. 'group' => '0',
  155. 'exposed' => TRUE,
  156. 'expose' => array(
  157. 'use_operator' => 0,
  158. 'operator' => 'type_id_op',
  159. 'identifier' => 'type_id',
  160. 'label' => 'Type',
  161. 'remember' => 0,
  162. ),
  163. 'case' => 1,
  164. 'id' => 'type_id',
  165. 'table' => 'contact',
  166. 'field' => 'type_id',
  167. 'relationship' => 'none',
  168. 'values_form_type' => 'select',
  169. 'multiple' => 1,
  170. 'optional' => 0,
  171. 'show_all' => 0,
  172. 'agg' => array(
  173. 'records_with' => 1,
  174. 'aggregates_with' => 1,
  175. ),
  176. ),
  177. 'name' => array(
  178. 'operator' => '~',
  179. 'value' => '',
  180. 'group' => '0',
  181. 'exposed' => TRUE,
  182. 'expose' => array(
  183. 'use_operator' => 0,
  184. 'operator' => 'name_op',
  185. 'identifier' => 'name',
  186. 'label' => 'Name Contains',
  187. 'remember' => 0,
  188. ),
  189. 'case' => 0,
  190. 'id' => 'name',
  191. 'table' => 'contact',
  192. 'field' => 'name',
  193. 'relationship' => 'none',
  194. 'agg' => array(
  195. 'records_with' => 1,
  196. 'aggregates_with' => 1,
  197. ),
  198. ),
  199. 'description' => array(
  200. 'operator' => '~',
  201. 'value' => '',
  202. 'group' => '0',
  203. 'exposed' => TRUE,
  204. 'expose' => array(
  205. 'use_operator' => 0,
  206. 'operator' => 'description_op',
  207. 'identifier' => 'description',
  208. 'label' => 'Description Contains',
  209. 'remember' => 0,
  210. ),
  211. 'case' => 0,
  212. 'id' => 'description',
  213. 'table' => 'contact',
  214. 'field' => 'description',
  215. 'relationship' => 'none',
  216. 'agg' => array(
  217. 'records_with' => 1,
  218. 'aggregates_with' => 1,
  219. ),
  220. ),
  221. ));
  222. $handler->override_option('access', array(
  223. 'type' => 'perm',
  224. 'perm' => 'access content',
  225. ));
  226. $handler->override_option('cache', array(
  227. 'type' => 'none',
  228. ));
  229. $handler->override_option('title', 'Contacts');
  230. $handler->override_option('header', 'Click "Show" to see a list of all contacts matching the entered criteria. If you leave a any of the criteria blank then the contacts will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all contacts will be listed.');
  231. $handler->override_option('header_format', '2');
  232. $handler->override_option('header_empty', 0);
  233. $handler->override_option('empty', 'No contacts match the current criteria.');
  234. $handler->override_option('empty_format', '2');
  235. $handler->override_option('items_per_page', 50);
  236. $handler->override_option('use_pager', '1');
  237. $handler->override_option('style_plugin', 'table');
  238. $handler->override_option('style_options', array(
  239. 'grouping' => '',
  240. 'override' => 1,
  241. 'sticky' => 0,
  242. 'order' => 'asc',
  243. 'summary' => '',
  244. 'columns' => array(
  245. 'name' => 'name',
  246. 'name_1' => 'name_1',
  247. 'description' => 'description',
  248. ),
  249. 'info' => array(
  250. 'name' => array(
  251. 'sortable' => 1,
  252. 'separator' => '',
  253. ),
  254. 'name_1' => array(
  255. 'sortable' => 1,
  256. 'separator' => '',
  257. ),
  258. 'description' => array(
  259. 'sortable' => 0,
  260. 'separator' => '',
  261. ),
  262. ),
  263. 'default' => 'name',
  264. ));
  265. $handler = $view->new_display('page', 'Page', 'page_1');
  266. $handler->override_option('path', 'chado/contacts');
  267. $handler->override_option('menu', array(
  268. 'type' => 'normal',
  269. 'title' => 'Contacts',
  270. 'description' => 'Contacts can be persons, institutes, groups, or organizations.',
  271. 'weight' => '10',
  272. 'name' => 'navigation',
  273. ));
  274. $handler->override_option('tab_options', array(
  275. 'type' => 'none',
  276. 'title' => '',
  277. 'description' => '',
  278. 'weight' => 0,
  279. 'name' => 'navigation',
  280. ));
  281. $views[$view->name] = $view;
  282. return $views;
  283. }