Continue to replace warning level with error level
[phpmyadmin/ammaryasirr.git] / pmd_pdf.php
blob89f6b5e3f8ec90179032ef7e0c930af28126c526
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin-Designer
6 */
8 include_once 'pmd_common.php';
10 /**
11 * If called directly from the designer, first save the positions
13 if (! isset($scale)) {
14 $no_die_save_pos = 1;
15 include_once 'pmd_save_pos.php';
18 if (isset($mode)) {
19 if ('create_export' != $mode && empty($pdf_page_number)) {
20 die("<script>alert('Pages not found!');history.go(-2);</script>");
23 $pmd_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']);
24 $pma_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']);
25 $scale_q = PMA_sqlAddslashes($scale);
27 if ('create_export' == $mode) {
29 * @see pdf_pages.php
31 $query_default_option = PMA_DBI_QUERY_STORE;
32 $pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
33 if ($pdf_page_number > 0) {
34 $message = PMA_Message::success(__('Page has been created'));
35 $mode = 'export';
36 } else {
37 $message = PMA_Message::error(__('Page creation failed'));
41 $pdf_page_number_q = PMA_sqlAddslashes($pdf_page_number);
43 if ('export' == $mode) {
44 $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) . "'";
46 PMA_query_as_controluser($sql,TRUE,PMA_DBI_QUERY_STORE);
49 if ('import' == $mode) {
50 PMA_query_as_controluser(
51 'UPDATE ' . $pma_table . ',' . $pmd_table .
52 ' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
53 ' . $pmd_table . '.`y`= ' . $pma_table . '.`y` * '. $scale_q .'
54 WHERE
55 ' . $pmd_table . '.`db_name`=' . $pma_table . '.`db_name`
56 AND
57 ' . $pmd_table . '.`table_name` = ' . $pma_table . '.`table_name`
58 AND
59 ' . $pmd_table . '.`db_name`=\''. PMA_sqlAddslashes($db) .'\'
60 AND pdf_page_number = ' . $pdf_page_number_q . ';', TRUE, PMA_DBI_QUERY_STORE);
64 // no need to use pmd/styles
65 require_once './libraries/header_meta_style.inc.php';
67 </head>
68 <body>
69 <br>
70 <div>
71 <?php
72 if (!empty($message)) {
73 $message->display();
76 <form name="form1" method="post" action="pmd_pdf.php">
77 <?php
78 echo PMA_generate_common_hidden_inputs($db);
79 echo '<div>';
80 echo '<fieldset><legend>' . __('Import/Export coordinates for PDF schema') . '</legend>';
82 $choices = array();
84 $table_info_result = PMA_query_as_controluser('SELECT * FROM '
85 . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
86 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
88 if (PMA_DBI_num_rows($table_info_result) > 0) {
89 echo '<p>' . __('Page') . ':';
90 echo '<select name="pdf_page_number">';
92 while($page = PMA_DBI_fetch_assoc($table_info_result)) {
93 echo '<option value="' . $page['page_nr'] . '">';
94 echo htmlspecialchars($page['page_descr']);
95 echo '</option>';
97 echo '</select>';
98 echo '</p>';
99 $choices['import'] = __('Import from selected page');
100 $choices['export'] = __('Export to selected page');
102 $choices['create_export'] = __('Create a page and export to it');
104 if (1 == count($choices)) {
105 echo $choices['create_export'];
106 echo '<input type="hidden" name="mode" value="create_export" />';
107 } else {
108 PMA_display_html_radio('mode', $choices, $checked_choice = '', $line_break = true, $escape_label = false, $class='');
110 echo '<br />';
111 echo '<label for="newpage">' . __('New page name: ') . '</label>';
112 echo '<input id="newpage" type="text" name="newpage" />';
114 echo '<p>' . __('Export/Import to scale') . ':';
116 <select name="scale">
117 <option value="1">1:1</option>
118 <option value="2">1:2</option>
119 <option value="3" selected>1:3 (<?php echo __('recommended'); ?>)</option>
120 <option value="4">1:4</option>
121 <option value="5">1:5</option>
122 </select>
123 </p>
124 <input type="submit" value="<?php echo __('Go'); ?>">
125 </fieldset>
126 </div>
127 </form>
128 </div>
129 </body>
130 </html>