bug 2953050 export VIEW as SQL includes INSERT statement
[phpmyadmin/dkf.git] / pmd_pdf.php
blob48cda974510fb25d95cd6ccbf3eb94b8820c83c2
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin-Designer
7 */
9 /**
12 include_once 'pmd_common.php';
13 if (! isset($scale)) {
14 $no_die_save_pos = 1;
15 include_once 'pmd_save_pos.php';
17 require_once './libraries/relation.lib.php';
19 if (isset($scale) && ! isset($createpage)) {
20 if (empty($pdf_page_number)) {
21 die("<script>alert('Pages not found!');history.go(-2);</script>");
24 $pmd_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']);
25 $pma_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']);
26 $scale_q = PMA_sqlAddslashes($scale);
27 $pdf_page_number_q = PMA_sqlAddslashes($pdf_page_number);
29 if (isset($exp)) {
31 $sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . PMA_sqlAddslashes($db) . "'";
33 PMA_query_as_controluser($sql,TRUE,PMA_DBI_QUERY_STORE);
36 if (isset($imp)) {
37 PMA_query_as_controluser(
38 'UPDATE ' . $pma_table . ',' . $pmd_table .
39 ' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
40 ' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * '. $scale_q .'
41 WHERE
42 ' . $pmd_table . '.`db_name`=' . $pma_table . '.`db_name`
43 AND
44 ' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
45 AND
46 ' . $pmd_table . '.`db_name`=\''. PMA_sqlAddslashes($db) .'\'
47 AND pdf_page_number = ' . $pdf_page_number_q . ';', TRUE, PMA_DBI_QUERY_STORE);
50 die("<script>alert('$strModifications');history.go(-2);</script>");
52 if (isset($createpage)) {
54 * @see pdf_pages.php
56 $query_default_option = PMA_DBI_QUERY_STORE;
58 $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
60 // no need to use pmd/styles
61 require_once './libraries/header_meta_style.inc.php';
63 </head>
64 <body>
65 <br>
66 <div>
67 <form name="form1" method="post" action="pmd_pdf.php">
68 <?php echo PMA_generate_common_hidden_inputs($db); ?>
69 <div>
70 <fieldset><legend><?php echo $GLOBALS['strExport'] . '/' . $GLOBALS['strImport']; ?></legend>
71 <p><?php echo $strExportImportToScale; ?>:
72 <select name="scale">
73 <option value="1">1:1</option>
74 <option value="2">1:2</option>
75 <option value="3" selected>1:3 (<?php echo $strRecommended; ?>)</option>
76 <option value="4">1:4</option>
77 <option value="5">1:5</option>
78 </select>
79 </p>
80 <p><?php echo $strToFromPage; ?>:
82 <select name="pdf_page_number">
83 <?php
84 $table_info_result = PMA_query_as_controluser('SELECT * FROM '.PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']).'
85 WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
86 while($page = PMA_DBI_fetch_assoc($table_info_result))
89 <option value="<?php echo $page['page_nr'] ?>"><?php echo htmlspecialchars($page['page_descr']) ?></option>
90 <?php
93 </select>
94 <input type="submit" name="exp" value="<?php echo $strExport; ?>">
95 <input type="submit" name="imp" value="<?php echo $strImport; ?>">
96 </fieldset>
97 </div>
98 <div>
99 <fieldset><legend><?php echo $GLOBALS['strCreatePage']; ?></legend>
100 <input type="text" name="newpage" />
101 <input type="submit" name="createpage" value="<?php echo $strGo; ?>">
102 </fieldset>
103 </div>
104 </form>
105 </div>
106 </body>
107 </html>