schema_edit.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. *
  5. * @package PhpMyAdmin
  6. */
  7. /**
  8. * Gets some core libraries
  9. */
  10. require_once 'libraries/common.inc.php';
  11. require_once 'libraries/db_common.inc.php';
  12. require 'libraries/StorageEngine.class.php';
  13. $active_page = 'db_operations.php';
  14. require_once 'libraries/db_common.inc.php';
  15. $url_query .= '&amp;goto=schema_edit.php';
  16. require_once 'libraries/db_info.inc.php';
  17. /**
  18. * get all variables needed for exporting relational schema
  19. * in $cfgRelation
  20. */
  21. $cfgRelation = PMA_getRelationsParam();
  22. /**
  23. * Now in ./libraries/relation.lib.php we check for all tables
  24. * that we need, but if we don't find them we are quiet about it
  25. * so people can't work without relational variables.
  26. * This page is absolutely useless if you didn't set up your tables
  27. * correctly, so it is a good place to see which tables we can and
  28. * complain ;-)
  29. */
  30. if (! $cfgRelation['relwork']) {
  31. echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n"
  32. . PMA_Util::showDocu('config', 'cfg_Servers_relation') . "\n";
  33. exit;
  34. }
  35. if (! $cfgRelation['displaywork']) {
  36. echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n"
  37. . PMA_Util::showDocu('config', 'cfg_Servers_table_info') . "\n";
  38. exit;
  39. }
  40. if (! isset($cfgRelation['table_coords'])) {
  41. echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n"
  42. . PMA_Util::showDocu('config', 'cfg_Servers_table_coords') . "\n";
  43. exit;
  44. }
  45. if (! isset($cfgRelation['pdf_pages'])) {
  46. echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n"
  47. . PMA_Util::showDocu('config', 'cfg_Servers_pdf_pages') . "\n";
  48. exit;
  49. }
  50. if ($cfgRelation['pdfwork']) {
  51. /**
  52. * User object created for presenting the HTML options
  53. * so, user can interact with it and perform export of relations schema
  54. */
  55. include_once 'libraries/schema/User_Schema.class.php';
  56. $user_schema = new PMA_User_Schema();
  57. /**
  58. * This function will process the user defined pages
  59. * and tables which will be exported as Relational schema
  60. * you can set the table positions on the paper via scratchboard
  61. * for table positions, put the x,y co-ordinates
  62. *
  63. * @param string $do It tells what the Schema is supposed to do
  64. * create and select a page, generate schema etc
  65. */
  66. if (isset($_REQUEST['do'])) {
  67. $user_schema->setAction($_REQUEST['do']);
  68. $user_schema->processUserChoice();
  69. }
  70. /**
  71. * Show some possibility to select a page for the export of relation schema
  72. * Lists all pages created before and can select and edit from them
  73. */
  74. $user_schema->selectPage();
  75. /**
  76. * Create a new page where relations will be drawn
  77. */
  78. $user_schema->showCreatePageDialog($db);
  79. /**
  80. * After selection of page or creating a page
  81. * It will show you the list of tables
  82. * A dashboard will also be shown where you can position the tables
  83. */
  84. $user_schema->showTableDashBoard();
  85. if (isset($_REQUEST['do'])
  86. && ($_REQUEST['do'] == 'edcoord'
  87. || ($_REQUEST['do']== 'selectpage' && isset($user_schema->chosenPage) && $user_schema->chosenPage != 0)
  88. || ($_REQUEST['do'] == 'createpage' && isset($user_schema->chosenPage) && $user_schema->chosenPage != 0))
  89. ) {
  90. /**
  91. * show Export schema generation options
  92. */
  93. $user_schema->displaySchemaGenerationOptions();
  94. if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
  95. ?>
  96. <script type="text/javascript">
  97. //<![CDATA[
  98. ToggleDragDrop('pdflayout');
  99. //]]>
  100. </script>
  101. <?php
  102. }
  103. } // end if
  104. } // end if ($cfgRelation['pdfwork'])
  105. ?>