openlayers_test.pages.inc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @file
  4. * Pages for test module
  5. */
  6. /**
  7. * Callback for OpenLayers Test Show Maps Page
  8. */
  9. function openlayers_test_show_maps() {
  10. $output = '';
  11. // Render all maps
  12. $maps = openlayers_maps();
  13. foreach ($maps as $name => $map) {
  14. $output .= '
  15. <h3>' . $map->title . '</h3>
  16. ' . openlayers_render_map($map) . '
  17. ';
  18. }
  19. /*
  20. // Create collapsed fieldset
  21. //$render_fieldset = openlayers_render_map();
  22. $element = array(
  23. '#value' => $render_fieldset['themed'],
  24. '#title' => t('Fieldset Example'),
  25. '#collapsed' => TRUE,
  26. '#collapsible' => TRUE,
  27. );
  28. $fieldset = theme_fieldset($element);
  29. */
  30. return $output;
  31. }
  32. /**
  33. * Callback for OpenLayers Test JS Page
  34. */
  35. function openlayers_test_js() {
  36. drupal_add_js(drupal_get_path('module', 'openlayers_test') . '/js/qunit/qunit.js');
  37. drupal_add_css(drupal_get_path('module', 'openlayers_test') . '/js/qunit/qunit.css');
  38. drupal_add_js(drupal_get_path('module', 'openlayers_test') . '/js/openlayers_test.js');
  39. $output = '';
  40. // Display QUnit stuff
  41. $output .= '
  42. <h1 id="qunit-header">OpenLayers QUnit Tests</h1>
  43. <h2 id="qunit-banner"></h2>
  44. <h2 id="qunit-userAgent"></h2>
  45. <ol id="qunit-tests"></ol>
  46. ';
  47. // Render only specific maps
  48. $maps = array('default', 'behaviors_test');
  49. foreach ($maps as $name => $map) {
  50. $output .= '
  51. ' . openlayers_render_map($map) . '
  52. ';
  53. }
  54. return $output;
  55. }