tripal_featuremap.views_default.inc 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <?php
  2. /**
  3. *
  4. *
  5. * @ingroup tripal_featuremap_views
  6. */
  7. function tripal_featuremap_views_default_views() {
  8. $views = array();
  9. if (!module_exists('tripal_views')) {
  10. return $views;
  11. }
  12. // Main default view
  13. $view = new view;
  14. $view->name = 'featuremap_listing';
  15. $view->description = 'A listing of all chado feature maps';
  16. $view->tag = 'chado default';
  17. $view->base_table = 'featuremap';
  18. $view->core = 6;
  19. $view->api_version = '2';
  20. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  21. $handler = $view->new_display('default', 'Defaults', 'default');
  22. $handler->override_option('fields', array(
  23. 'name' => array(
  24. 'label' => 'Name',
  25. 'alter' => array(
  26. 'alter_text' => 0,
  27. 'text' => '',
  28. 'make_link' => 0,
  29. 'path' => 'node/[nid]',
  30. 'absolute' => 0,
  31. 'link_class' => '',
  32. 'alt' => '',
  33. 'rel' => '',
  34. 'prefix' => '',
  35. 'suffix' => '',
  36. 'target' => '',
  37. 'help' => '',
  38. 'trim' => 0,
  39. 'max_length' => '',
  40. 'word_boundary' => 1,
  41. 'ellipsis' => 1,
  42. 'html' => 0,
  43. 'strip_tags' => 0,
  44. ),
  45. 'empty' => '',
  46. 'hide_empty' => 0,
  47. 'empty_zero' => 0,
  48. 'link_to_node' => 1,
  49. 'hide_alter_empty' => 1,
  50. 'type' => 'separator',
  51. 'separator' => ', ',
  52. 'exclude' => 0,
  53. 'id' => 'name',
  54. 'table' => 'featuremap',
  55. 'field' => 'name',
  56. 'relationship' => 'none',
  57. ),
  58. 'description' => array(
  59. 'label' => 'Description',
  60. 'alter' => array(
  61. 'alter_text' => 0,
  62. 'text' => '',
  63. 'make_link' => 0,
  64. 'path' => '',
  65. 'absolute' => 0,
  66. 'link_class' => '',
  67. 'alt' => '',
  68. 'rel' => '',
  69. 'prefix' => '',
  70. 'suffix' => '',
  71. 'target' => '',
  72. 'help' => '',
  73. 'trim' => 0,
  74. 'max_length' => '',
  75. 'word_boundary' => 1,
  76. 'ellipsis' => 1,
  77. 'html' => 0,
  78. 'strip_tags' => 0,
  79. ),
  80. 'empty' => '',
  81. 'hide_empty' => 0,
  82. 'link_to_node' => 0,
  83. 'empty_zero' => 0,
  84. 'hide_alter_empty' => 1,
  85. 'type' => 'separator',
  86. 'separator' => ', ',
  87. 'exclude' => 0,
  88. 'id' => 'description',
  89. 'table' => 'featuremap',
  90. 'field' => 'description',
  91. 'relationship' => 'none',
  92. ),
  93. 'name_1' => array(
  94. 'label' => 'Map Units',
  95. 'alter' => array(
  96. 'alter_text' => 0,
  97. 'text' => '',
  98. 'make_link' => 0,
  99. 'path' => '',
  100. 'absolute' => 0,
  101. 'link_class' => '',
  102. 'alt' => '',
  103. 'rel' => '',
  104. 'prefix' => '',
  105. 'suffix' => '',
  106. 'target' => '',
  107. 'help' => '',
  108. 'trim' => 0,
  109. 'max_length' => '',
  110. 'word_boundary' => 1,
  111. 'ellipsis' => 1,
  112. 'html' => 0,
  113. 'strip_tags' => 0,
  114. ),
  115. 'empty' => '',
  116. 'hide_empty' => 0,
  117. 'link_to_node' => 0,
  118. 'empty_zero' => 0,
  119. 'hide_alter_empty' => 1,
  120. 'type' => 'separator',
  121. 'separator' => ', ',
  122. 'exclude' => 0,
  123. 'id' => 'name_1',
  124. 'table' => 'cvterm',
  125. 'field' => 'name',
  126. 'relationship' => 'none',
  127. ),
  128. ));
  129. $handler->override_option('sorts', array(
  130. 'name' => array(
  131. 'order' => 'ASC',
  132. 'id' => 'name',
  133. 'table' => 'featuremap',
  134. 'field' => 'name',
  135. 'relationship' => 'none',
  136. ),
  137. ));
  138. $handler->override_option('filters', array(
  139. 'unittype_id' => array(
  140. 'operator' => '=',
  141. 'value' => '',
  142. 'group' => '0',
  143. 'exposed' => TRUE,
  144. 'expose' => array(
  145. 'use_operator' => 0,
  146. 'operator' => 'unittype_id_op',
  147. 'identifier' => 'unittype_id',
  148. 'label' => 'Map Units',
  149. 'remember' => 0,
  150. ),
  151. 'case' => 1,
  152. 'id' => 'unittype_id',
  153. 'table' => 'featuremap',
  154. 'field' => 'unittype_id',
  155. 'relationship' => 'none',
  156. 'values_form_type' => 'select',
  157. 'multiple' => 1,
  158. 'optional' => 0,
  159. 'show_all' => 0,
  160. 'agg' => array(
  161. 'records_with' => 1,
  162. 'aggregates_with' => 1,
  163. ),
  164. ),
  165. 'name_1' => array(
  166. 'operator' => '~',
  167. 'value' => '',
  168. 'group' => '0',
  169. 'exposed' => TRUE,
  170. 'expose' => array(
  171. 'use_operator' => 0,
  172. 'operator' => 'name_1_op',
  173. 'identifier' => 'name_1',
  174. 'label' => 'Name',
  175. 'remember' => 0,
  176. ),
  177. 'case' => 0,
  178. 'id' => 'name_1',
  179. 'table' => 'featuremap',
  180. 'field' => 'name',
  181. 'relationship' => 'none',
  182. 'agg' => array(
  183. 'records_with' => 1,
  184. 'aggregates_with' => 1,
  185. ),
  186. ),
  187. 'description' => array(
  188. 'operator' => '~',
  189. 'value' => '',
  190. 'group' => '0',
  191. 'exposed' => TRUE,
  192. 'expose' => array(
  193. 'use_operator' => 0,
  194. 'operator' => 'description_op',
  195. 'identifier' => 'description',
  196. 'label' => 'Description',
  197. 'remember' => 0,
  198. ),
  199. 'case' => 0,
  200. 'id' => 'description',
  201. 'table' => 'featuremap',
  202. 'field' => 'description',
  203. 'relationship' => 'none',
  204. 'agg' => array(
  205. 'records_with' => 1,
  206. 'aggregates_with' => 1,
  207. ),
  208. ),
  209. 'search_results' => array(
  210. 'operator' => '=',
  211. 'value' => '',
  212. 'group' => '0',
  213. 'exposed' => FALSE,
  214. 'expose' => array(
  215. 'operator' => FALSE,
  216. 'label' => '',
  217. ),
  218. 'id' => 'search_results',
  219. 'table' => 'views',
  220. 'field' => 'search_results',
  221. 'relationship' => 'none',
  222. 'apply_button' => 'Show',
  223. 'no_results_text' => 'Click "Show" to see a list of all feature maps matching the entered criteria. If you leave a any of the criteria blank then the maps will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all maps will be listed.',
  224. ),
  225. ));
  226. $handler->override_option('access', array(
  227. 'type' => 'perm',
  228. 'perm' => 'access chado_featuremap content',
  229. ));
  230. $handler->override_option('cache', array(
  231. 'type' => 'none',
  232. ));
  233. $handler->override_option('title', 'Maps');
  234. $handler->override_option('header', 'Click "Show" to see a list of all feature maps matching the entered criteria. If you leave a any of the criteria blank then the maps will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all maps will be listed.');
  235. $handler->override_option('header_format', '1');
  236. $handler->override_option('header_empty', 1);
  237. $handler->override_option('empty', 'No feature maps match the current criteria.');
  238. $handler->override_option('empty_format', '1');
  239. $handler->override_option('items_per_page', 25);
  240. $handler->override_option('use_pager', '1');
  241. $handler->override_option('style_plugin', 'table');
  242. $handler->override_option('style_options', array(
  243. 'grouping' => '',
  244. 'override' => 1,
  245. 'sticky' => 0,
  246. 'order' => 'asc',
  247. 'summary' => '',
  248. 'columns' => array(
  249. 'name' => 'name',
  250. 'description' => 'description',
  251. 'name_1' => 'name_1',
  252. 'nid' => 'nid',
  253. ),
  254. 'info' => array(
  255. 'name' => array(
  256. 'sortable' => 1,
  257. 'separator' => '',
  258. ),
  259. 'description' => array(
  260. 'sortable' => 1,
  261. 'separator' => '',
  262. ),
  263. 'name_1' => array(
  264. 'sortable' => 1,
  265. 'separator' => '',
  266. ),
  267. 'nid' => array(
  268. 'separator' => '',
  269. ),
  270. ),
  271. 'default' => '-1',
  272. ));
  273. $default_handler = $handler;
  274. $handler = $view->new_display('page', 'Page', 'page_1');
  275. $handler->override_option('path', 'chado/featuremaps');
  276. $handler->override_option('menu', array(
  277. 'type' => 'normal',
  278. 'title' => 'Maps',
  279. 'description' => 'A listing of chado feature maps.',
  280. 'weight' => '0',
  281. 'name' => 'navigation',
  282. ));
  283. $handler->override_option('tab_options', array(
  284. 'type' => 'none',
  285. 'title' => '',
  286. 'description' => '',
  287. 'weight' => 0,
  288. 'name' => 'navigation',
  289. ));
  290. // Add code specific to a local chado installation
  291. // NOTE: Edit $handler above to $default_handler for the default display
  292. if (tripal_core_chado_schema_exists()) {
  293. // Add nid field
  294. $fields = $view->get_items('field', 'default');
  295. $new_fields = array(
  296. 'nid' => array(
  297. 'label' => 'Nid',
  298. 'alter' => array(
  299. 'alter_text' => 0,
  300. 'text' => '',
  301. 'make_link' => 0,
  302. 'path' => '',
  303. 'absolute' => 0,
  304. 'link_class' => '',
  305. 'alt' => '',
  306. 'rel' => '',
  307. 'prefix' => '',
  308. 'suffix' => '',
  309. 'target' => '',
  310. 'help' => '',
  311. 'trim' => 0,
  312. 'max_length' => '',
  313. 'word_boundary' => 1,
  314. 'ellipsis' => 1,
  315. 'html' => 0,
  316. 'strip_tags' => 0,
  317. ),
  318. 'empty' => '',
  319. 'hide_empty' => 0,
  320. 'empty_zero' => 0,
  321. 'hide_alter_empty' => 1,
  322. 'link_to_node' => 0,
  323. 'exclude' => 1,
  324. 'id' => 'nid',
  325. 'table' => 'node',
  326. 'field' => 'nid',
  327. 'relationship' => 'none',
  328. )
  329. );
  330. $fields = $new_fields + $fields;
  331. // Adds feature => Node relationship
  332. $default_handler->override_option('relationships', array(
  333. 'nid' => array(
  334. 'label' => 'Map to Node',
  335. 'required' => 0,
  336. 'id' => 'nid',
  337. 'table' => 'chado_featuremap',
  338. 'field' => 'nid',
  339. 'relationship' => 'none',
  340. ),
  341. ));
  342. // Change analysis.name to have a link to the node
  343. $fields['name']['alter']['link_to_node'] = 1;
  344. $default_handler->override_option('fields', $fields);
  345. // Only show records with published nodes
  346. /**
  347. $filters = $view->get_items('filter', 'default');
  348. $filters['status'] = array(
  349. 'operator' => '=',
  350. 'value' => '1',
  351. 'group' => '0',
  352. 'exposed' => FALSE,
  353. 'expose' => array(
  354. 'operator' => FALSE,
  355. 'label' => '',
  356. ),
  357. 'id' => 'status',
  358. 'table' => 'node',
  359. 'field' => 'status',
  360. 'relationship' => 'none',
  361. );
  362. $default_handler->override_option('filters', $filters);
  363. */
  364. }
  365. $views[$view->name] = $view;
  366. return $views;
  367. }