tripal_jbrowse_page.page.inc 1003 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @file
  4. * Builds the Tripal JBrowse page.
  5. */
  6. /**
  7. * Redirect to the JBrowse Instance.
  8. */
  9. function tripal_jbrowse_page_page($scientific_name) {
  10. list($genus, $species) = explode('-', $scientific_name);
  11. $instance = tripal_jbrowse_page_get_instance_id([
  12. 'genus' => $genus,
  13. 'species' => $species
  14. ],
  15. ['load_instance' => TRUE]);
  16. // Determine Query paramters.
  17. $query_params = tripal_jbrowse_mgmt_build_http_query($instance);
  18. $page_q = drupal_get_query_parameters();
  19. foreach ($page_q as $qkey => $qvalue) {
  20. $query_params[$qkey] = $qvalue;
  21. }
  22. // Build the URL.
  23. $settings = tripal_jbrowse_mgmt_get_settings();
  24. $url = url($settings['link'],['query' => $query_params]);
  25. if (variable_get('trpjbrowse_page_embed', 1)) {
  26. drupal_add_css(drupal_get_path('module', 'tripal_jbrowse_page') . '/theme/tripal_jbrowse_page.css');
  27. return theme('jbrowse_instance_embedded_page', ['url' => $url]);
  28. }
  29. else {
  30. drupal_goto($url, array('external' => TRUE));
  31. }
  32. }