tripal_contact.views_default.inc 7.5 KB

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