schema_edit.php 3.9 KB

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