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