coding style
[phpmyadmin/madhuracj.git] / pmd_pdf.php
blob3a64bcc5dc61f1f4bb0ca95f920e5af13de5aff9
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']);
27 if (isset($exp)) {
29 $sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number . ", ROUND(x/" . $scale . ") , ROUND(y/" . $scale . ") y FROM " . $pmd_table . " WHERE db_name = '" . $db . "'";
31 PMA_query_as_controluser($sql,TRUE,PMA_DBI_QUERY_STORE);
34 if (isset($imp)) {
35 PMA_query_as_controluser(
36 'UPDATE ' . $pma_table . ',' . $pmd_table .
37 ' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale . ',
38 ' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * '.$scale.'
39 WHERE
40 ' . $pmd_table . '.`db_name`=' . $pma_table . '.`db_name`
41 AND
42 ' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
43 AND
44 ' . $pmd_table . '.`db_name`=\''.$db.'\'
45 AND pdf_page_number = '.$pdf_page_number.';',TRUE,PMA_DBI_QUERY_STORE); }
47 die("<script>alert('$strModifications');history.go(-2);</script>");
49 if (isset($createpage)) {
51 * @see pdf_pages.php
53 $query_default_option = PMA_DBI_QUERY_STORE;
55 $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
57 // no need to use pmd/styles
58 require_once './libraries/header_meta_style.inc.php';
60 </head>
61 <body>
62 <br>
63 <div>
64 <form name="form1" method="post" action="pmd_pdf.php">
65 <?php echo PMA_generate_common_hidden_inputs($db); ?>
66 <div>
67 <fieldset><legend><?php echo $GLOBALS['strExport'] . '/' . $GLOBALS['strImport']; ?></legend>
68 <p><?php echo $strExportImportToScale; ?>:
69 <select name="scale">
70 <option value="1">1:1</option>
71 <option value="2">1:2</option>
72 <option value="3" selected>1:3 (<?php echo $strRecommended; ?>)</option>
73 <option value="4">1:4</option>
74 <option value="5">1:5</option>
75 </select>
76 </p>
77 <p><?php echo $strToFromPage; ?>:
79 <select name="pdf_page_number">
80 <?php
81 $table_info_result = PMA_query_as_controluser('SELECT * FROM '.PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']).'
82 WHERE db_name = \''.$db.'\'');
83 while($page = PMA_DBI_fetch_assoc($table_info_result))
86 <option value="<?php echo $page['page_nr'] ?>"><?php echo $page['page_descr'] ?></option>
87 <?php
90 </select>
91 <input type="submit" name="exp" value="<?php echo $strExport; ?>">
92 <input type="submit" name="imp" value="<?php echo $strImport; ?>">
93 </fieldset>
94 </div>
95 <div>
96 <fieldset><legend><?php echo $GLOBALS['strCreatePage']; ?></legend>
97 <input type="text" name="newpage" />
98 <input type="submit" name="createpage" value="<?php echo $strGo; ?>">
99 </fieldset>
100 </div>
101 </form>
102 </div>
103 </body>
104 </html>