tripal_library.views_default.inc 10 KB

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