tbl_select.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Handles table search tab
  5. *
  6. * display table search form, create SQL query from form data
  7. * and include sql.php to execute it
  8. *
  9. * @package PhpMyAdmin
  10. */
  11. /**
  12. * Gets some core libraries
  13. */
  14. require_once 'libraries/common.inc.php';
  15. require_once 'libraries/mysql_charsets.lib.php';
  16. require_once 'libraries/TableSearch.class.php';
  17. $response = PMA_Response::getInstance();
  18. $header = $response->getHeader();
  19. $scripts = $header->getScripts();
  20. $scripts->addFile('makegrid.js');
  21. $scripts->addFile('sql.js');
  22. $scripts->addFile('tbl_select.js');
  23. $scripts->addFile('tbl_change.js');
  24. $scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
  25. $scripts->addFile('gis_data_editor.js');
  26. $post_params = array(
  27. 'ajax_request',
  28. 'session_max_rows'
  29. );
  30. foreach ($post_params as $one_post_param) {
  31. if (isset($_POST[$one_post_param])) {
  32. $GLOBALS[$one_post_param] = $_POST[$one_post_param];
  33. }
  34. }
  35. $table_search = new PMA_TableSearch($db, $table, "normal");
  36. /**
  37. * Not selection yet required -> displays the selection form
  38. */
  39. if (! isset($_POST['columnsToDisplay']) && ! isset($_POST['displayAllColumns'])) {
  40. // Gets some core libraries
  41. include_once 'libraries/tbl_common.inc.php';
  42. //$err_url = 'tbl_select.php' . $err_url;
  43. $url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
  44. /**
  45. * Gets table's information
  46. */
  47. include_once 'libraries/tbl_info.inc.php';
  48. if (! isset($goto)) {
  49. $goto = $GLOBALS['cfg']['DefaultTabTable'];
  50. }
  51. // Defines the url to return to in case of error in the next sql statement
  52. $err_url = $goto . '?' . PMA_generate_common_url($db, $table);
  53. // Displays the table search form
  54. $response->addHTML($table_search->getSelectionForm($goto));
  55. } else {
  56. /**
  57. * Selection criteria have been submitted -> do the work
  58. */
  59. $sql_query = $table_search->buildSqlQuery();
  60. include 'sql.php';
  61. }
  62. ?>