2 /* vim: set expandtab sw=4 ts=4 sts=4: */
10 * Gets some core libraries
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/config/page_settings.class.php';
14 require_once 'libraries/export.lib.php';
16 PMA_PageSettings
::showGroup('Export');
18 $response = PMA_Response
::getInstance();
19 $header = $response->getHeader();
20 $scripts = $header->getScripts();
21 $scripts->addFile('export.js');
23 // $sub_part is used in PMA_Util::getDbInfo() to see if we are coming from
24 // db_export.php, in which case we don't obey $cfg['MaxTableList']
25 $sub_part = '_export';
26 require_once 'libraries/db_common.inc.php';
27 $url_query .= '&goto=db_export.php';
39 ) = PMA_Util
::getDbInfo($db, isset($sub_part) ?
$sub_part : '');
44 $export_page_title = __('View dump (schema) of database');
46 // exit if no tables in db found
47 if ($num_tables < 1) {
48 PMA_Message
::error(__('No tables found in database.'))->display();
52 $multi_values = '<div class="export_table_list_container">';
53 if (isset($_GET['structure_or_data_forced'])) {
54 $force_val = htmlspecialchars($_GET['structure_or_data_forced']);
58 $multi_values .= '<input type="hidden" name="structure_or_data_forced" value="'
60 $multi_values .= '<table class="export_table_select">'
61 . '<thead><tr><th></th>'
62 . '<th>' . __('Tables') . '</th>'
63 . '<th class="export_structure">' . __('Structure') . '</th>'
64 . '<th class="export_data">' . __('Data') . '</th>'
67 . '<td class="export_table_name all">' . __('Select all') . '</td>'
68 . '<td class="export_structure all">'
69 . '<input type="checkbox" id="table_structure_all" /></td>'
70 . '<td class="export_data all"><input type="checkbox" id="table_data_all" />'
74 $multi_values .= "\n";
76 // when called by libraries/mult_submits.inc.php
77 if (!empty($_POST['selected_tbl']) && empty($table_select)) {
78 $table_select = $_POST['selected_tbl'];
81 // Check if the selected tables are defined in $_GET
82 // (from clicking Back button on export.php)
83 foreach (array('table_select', 'table_structure', 'table_data') as $one_key) {
84 if (isset($_GET[$one_key])) {
85 $_GET[$one_key] = urldecode($_GET[$one_key]);
86 $_GET[$one_key] = explode(",", $_GET[$one_key]);
90 foreach ($tables as $each_table) {
91 if (isset($_GET['table_select'])) {
92 $is_checked = PMA_getCheckedClause(
93 $each_table['Name'], $_GET['table_select']
95 } elseif (isset($table_select)) {
96 $is_checked = PMA_getCheckedClause(
97 $each_table['Name'], $table_select
100 $is_checked = ' checked="checked"';
102 if (isset($_GET['table_structure'])) {
103 $structure_checked = PMA_getCheckedClause(
104 $each_table['Name'], $_GET['table_structure']
107 $structure_checked = $is_checked;
109 if (isset($_GET['table_data'])) {
110 $data_checked = PMA_getCheckedClause(
111 $each_table['Name'], $_GET['table_data']
114 $data_checked = $is_checked;
116 $table_html = htmlspecialchars($each_table['Name']);
117 $multi_values .= '<tr>';
118 $multi_values .= '<td><input type="checkbox" name="table_select[]"'
119 . ' value="' . $table_html . '"' . $is_checked . ' /></td>';
120 $multi_values .= '<td class="export_table_name">'
121 . str_replace(' ', ' ', $table_html) . '</td>';
122 $multi_values .= '<td class="export_structure">'
123 . '<input type="checkbox" name="table_structure[]"'
124 . ' value="' . $table_html . '"' . $structure_checked . ' /></td>';
125 $multi_values .= '<td class="export_data">'
126 . '<input type="checkbox" name="table_data[]"'
127 . ' value="' . $table_html . '"' . $data_checked . ' /></td>';
128 $multi_values .= '</tr>';
131 $multi_values .= "\n";
132 $multi_values .= '</tbody></table></div>';
134 $export_type = 'database';
135 require_once 'libraries/display_export.inc.php';