3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Contributed by Maxime Delorme and merged by lem9
12 * Gets some core scripts
14 require('./libraries/grab_globals.lib.php3');
15 require('./libraries/common.lib.php3');
19 * Settings for relation stuff
21 require('./libraries/relation.lib.php3');
22 $cfgRelation = PMA_getRelationsParam();
26 * Now in ./libraries/relation.lib.php3 we check for all tables
27 * that we need, but if we don't find them we are quiet about it
28 * so people can work without.
29 * This page is absolutely useless if you didn't set up your tables
30 * correctly, so it is a good place to see which tables we can and
33 if (!$cfgRelation['pdfwork']) {
34 echo '<font color="red">' . $strError . '</font><br />' . "\n";
35 $url_to_goto = '<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php3?' . $url_query . '">';
36 echo sprintf($strRelationNotWorking, $url_to_goto, '</a>') . "\n";
41 * Gets the "fpdf" libraries and defines the pdf font path
43 require('./libraries/fpdf/fpdf.php3');
44 // loic1: PHP3 compatibility
45 // define('FPDF_FONTPATH', './libraries/fpdf/font/');
46 $FPDF_font_path = './libraries/fpdf/font/';
50 * Emulates the "array_search" function with PHP < 4.0.5
52 if (PMA_PHP_INT_VERSION
< 40005) {
53 function array_search($needle, $haystack) {
57 while (list($key, $value) = each($haystack)) {
58 if ($value == $needle) {
64 } // end of the "array_search" function
70 * Extends the "FPDF" class and prepares the work
76 class PMA_PDF
extends FPDF
79 * Defines private properties
90 * The PMA_PDF constructor
92 * This function just refers to the "FPDF" constructor: with PHP3 a class
93 * must have a constructor
95 * @param string The page orientation (p, portrait, l or landscape)
96 * @param string The unit for sizes (pt, mm, cm or in)
97 * @param mixed The page format (A3, A4, A5, letter, legal or an array
104 function PMA_PDF($orientation = 'P', $unit = 'mm', $format = 'A4')
106 $this->FPDF($orientation, $unit, $format);
107 } // end of the "PMA_PDF()" method
111 * Sets the scalling factor, defines minimum coordinates and margins
113 * @param double The scalling factor
114 * @param double The minimum X coordinate
115 * @param double The minimum Y coordinate
116 * @param double The left margin
117 * @param double The top margin
121 function PMA_PDF_setScale($scale = 1, $x_min = 0, $y_min = 0, $l_marg = -1, $t_marg = -1)
123 $this->scale
= $scale;
124 $this->x_min
= $x_min;
125 $this->y_min
= $y_min;
126 if ($this->l_marg
!= -1) {
127 $this->l_marg
= $l_marg;
129 if ($this->t_marg
!= -1) {
130 $this->t_marg
= $t_marg;
132 } // end of the "PMA_PDF_setScale" function
136 * Outputs a scalled cell
138 * @param double The cell width
139 * @param double The cell height
140 * @param string The text to output
141 * @param mixed Wether to add borders or not
142 * @param integer Where to put the cursor once the output is done
143 * @param string Align mode
144 * @param integer Whether to fill the cell with a color or not
150 function PMA_PDF_cellScale($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0)
152 $h = $h / $this->scale
;
153 $w = $w / $this->scale
;
154 $this->Cell($w, $h, $txt, $border, $ln, $align, $fill);
155 } // end of the "PMA_PDF_cellScale" function
159 * Draws a scalled line
161 * @param double The horizontal position of the starting point
162 * @param double The vertical position of the starting point
163 * @param double The horizontal position of the ending point
164 * @param double The vertical position of the ending point
170 function PMA_PDF_lineScale($x1, $y1, $x2, $y2)
172 $x1 = ($x1 - $this->x_min
) / $this->scale +
$this->l_marg
;
173 $y1 = ($y1 - $this->y_min
) / $this->scale +
$this->t_marg
;
174 $x2 = ($x2 - $this->x_min
) / $this->scale +
$this->l_marg
;
175 $y2 = ($y2 - $this->y_min
) / $this->scale +
$this->t_marg
;
176 $this->Line($x1, $y1, $x2, $y2);
177 } // end of the "PMA_PDF_lineScale" function
181 * Sets x and y scalled positions
183 * @param double The x position
184 * @param double The y position
190 function PMA_PDF_setXyScale($x, $y)
192 $x = ($x - $this->x_min
) / $this->scale +
$this->l_marg
;
193 $y = ($y - $this->y_min
) / $this->scale +
$this->t_marg
;
194 $this->SetXY($x, $y);
195 } // end of the "PMA_PDF_setXyScale" function
199 * Sets the X scalled positions
201 * @param double The x position
207 function PMA_PDF_setXScale($x)
209 $x = ($x - $this->x_min
) / $this->scale +
$this->l_marg
;
211 } // end of the "PMA_PDF_setXScale" function
215 * Sets the scalled font size
217 * @param double The font size (in points)
221 * @see FPDF::SetFontSize()
223 function PMA_PDF_setFontSizeScale($size)
225 // Set font size in points
226 $size = $size / $this->scale
;
227 $this->SetFontSize($size);
228 } // end of the "PMA_PDF_setFontSizeScale" function
232 * Sets the scalled line width
234 * @param double The line width
238 * @see FPDF::SetLineWidth()
240 function PMA_PDF_setLineWidthScale($width)
242 $width = $width / $this->scale
;
243 $this->SetLineWidth($width);
244 } // end of the "PMA_PDF_setLineWidthScale" function
248 * Displays an error message
250 * @param string the error mesage
252 * @global array the PMA configuration array
253 * @global integer the current server id
254 * @global string the current language
255 * @global string the charset to convert to
256 * @global string the current database name
257 * @global string the current charset
258 * @global string the current text direction
259 * @global string a localized string
260 * @global string an other localized string
264 function PMA_PDF_die($error_message = '')
267 global $server, $lang, $convcharset, $db;
268 global $charset, $text_dir, $strRunning, $strDatabase;
270 include('./header.inc.php3');
272 echo '<p><b>PDF - '. $GLOBALS['strError'] . '</b></p>' . "\n";
273 if (!empty($error_message)) {
274 $error_message = htmlspecialchars($error_message);
277 echo ' ' . $error_message . "\n";
280 echo '<a href="db_details_structure.php3'
282 . '&convcharset=' . $convcharset
283 . '&server=' . $server
284 . '&db=' . urlencode($db)
285 . '">' . $GLOBALS['strBack'] . '</a>';
288 include('./footer.inc.php3');
290 } // end of the "PMA_PDF_die()" function
294 * Aliases the "Error()" function from the FPDF class to the
295 * "PMA_PDF_die()" one
297 * @param string the error mesage
303 function Error($error_message = '')
305 $this->PMA_PDF_die($error_message);
306 } // end of the "Error()" method
307 } // end of the "PMA_PDF" class
311 * Draws tables schema
320 * Defines private properties
326 var $fields = array();
327 var $height_cell = 6;
329 var $primary = array();
333 * Sets the width of the table
335 * @param integer The font size
337 * @global object The current PDF document
343 function PMA_RT_Table_setWidth($ff)
345 // this looks buggy to me... does it really work if
346 // there are fields that require wider cells than the name of the table?
349 reset($this->fields
);
350 while (list(, $field) = each($this->fields
)) {
351 $this->width
= max($this->width
, $pdf->GetStringWidth($field));
353 $this->width +
= $pdf->GetStringWidth(' ');
354 $pdf->SetFont($ff, 'B');
355 $this->width
= max($this->width
, $pdf->GetStringWidth(' ' . $this->table_name
));
356 $pdf->SetFont($ff, '');
357 } // end of the "PMA_RT_Table_setWidth()" method
361 * Sets the height of the table
365 function PMA_RT_Table_setHeight()
367 $this->height
= (count($this->fields
) +
1) * $this->height_cell
;
368 } // end of the "PMA_RT_Table_setHeight()" method
374 * @param boolean Whether to display table position or not
375 * @param integer The font size
376 * @param boolean Whether all tables should have the same width or not
377 * @param integer The max. with among tables
379 * @global object The current PDF document
385 function PMA_RT_Table_draw($show_info, $ff, $same_wide = 0, $same_wide_width = 0)
389 if ($same_wide == 1 && $same_wide_width > 0) {
390 $this->width
= $same_wide_width;
393 $pdf->PMA_PDF_setXyScale($this->x
, $this->y
);
394 $pdf->SetFont($ff, 'B');
395 $pdf->SetTextColor(200);
396 $pdf->SetFillColor(0, 0, 128);
398 $pdf->PMA_PDF_cellScale($this->width
, $this->height_cell
, sprintf('%.0f', $this->width
) . 'x' . sprintf('%.0f', $this->height
) . ' ' . $this->table_name
, 1, 1, 'C', 1);
400 $pdf->PMA_PDF_cellScale($this->width
, $this->height_cell
, $this->table_name
, 1, 1, 'C', 1);
402 $pdf->PMA_PDF_setXScale($this->x
);
403 $pdf->SetFont($ff, '');
404 $pdf->SetTextColor(0);
405 $pdf->SetFillColor(255);
407 reset($this->fields
);
408 while (list(, $field) = each($this->fields
)) {
410 // if (in_array($field, $this->primary)) {
411 if (PMA_isInto($field, $this->primary
) != -1) {
412 $pdf->SetFillColor(215, 121, 123);
414 if ($field == $this->displayfield
) {
415 $pdf->SetFillColor(142, 159, 224);
417 $pdf->PMA_PDF_cellScale($this->width
, $this->height_cell
, ' ' . $field, 1, 1, 'L', 1);
418 $pdf->PMA_PDF_setXScale($this->x
);
419 $pdf->SetFillColor(255);
422 if ($pdf->PageNo() > 1) {
423 $pdf->PMA_PDF_die($GLOBALS['strScaleFactorSmall']);
425 } // end of the "PMA_RT_Table_draw()" method
429 * The "PMA_RT_Table" constructor
431 * @param string The table name
432 * @param integer The font size
433 * @param integer The max. with among tables
435 * @global object The current PDF document
436 * @global integer The current page number (from the
437 * $cfg['Servers'][$i]['table_coords'] table)
438 * @global array The relations settings
439 * @global string The current db name
443 * @see PMA_PDF, PMA_RT_Table::PMA_RT_Table_setWidth,
444 * PMA_RT_Table::PMA_RT_Table_setHeight
446 function PMA_RT_Table($table_name, $ff, &$same_wide_width)
448 global $pdf, $pdf_page_number, $cfgRelation, $db;
450 $this->table_name
= $table_name;
451 $sql = 'DESCRIBE ' . PMA_backquote($table_name);
452 $result = PMA_mysql_query($sql);
453 if (!$result ||
!mysql_num_rows($result)) {
454 $pdf->PMA_PDF_die(sprintf($GLOBALS['strPdfInvalidTblName'], $table_name));
457 while ($row = PMA_mysql_fetch_array($result)) {
458 $this->fields
[] = $row[0];
462 $this->PMA_RT_Table_setWidth($ff);
463 $this->PMA_RT_Table_setHeight();
464 if ($same_wide_width < $this->width
) {
465 $same_wide_width = $this->width
;
469 $sql = 'SELECT x, y FROM '
470 . PMA_backquote($cfgRelation['table_coords'])
471 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
472 . ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\''
473 . ' AND pdf_page_number = ' . $pdf_page_number;
474 $result = PMA_query_as_cu($sql);
476 if (!$result ||
!mysql_num_rows($result)) {
477 $pdf->PMA_PDF_die(sprintf($GLOBALS['strConfigureTableCoord'], $table_name));
479 list($this->x
, $this->y
) = PMA_mysql_fetch_array($result);
480 $this->x
= (double) $this->x
;
481 $this->y
= (double) $this->y
;
484 $this->displayfield
= PMA_getDisplayField($db, $table_name);
487 $sql = 'SHOW index FROM ' . PMA_backquote($table_name);
488 $result = PMA_mysql_query($sql);
489 if ($result && mysql_num_rows($result) > 0) {
490 while ($row = PMA_mysql_fetch_array($result)) {
491 if ($row['Key_name'] == 'PRIMARY') {
492 $this->primary
[] = $row['Column_name'];
496 } // end of the "PMA_RT_Table()" method
497 } // end class "PMA_RT_Table"
502 * Draws relation links
508 class PMA_RT_Relation
511 * Defines private properties
516 var $x_dest, $y_dest;
521 * Gets arrows coordinates
523 * @param string The current table name
524 * @param string The relation column name
526 * @return array Arrows coordinates
530 function PMA_RT_Relation_getXy($table, $column)
532 $pos = array_search($column, $table->fields
);
533 // x_left, x_right, y
534 return array($table->x
, $table->x +
$table->width
, $table->y +
($pos +
1.5) * $table->height_cell
);
535 } // end of the "PMA_RT_Relation_getXy()" method
539 * Do draws relation links
541 * @param boolean Whether to use one color per relation or not
542 * @param integer The id of the link to draw
544 * @global object The current PDF document
550 function PMA_RT_Relation_draw($change_color, $i)
567 list ($a, $b, $c) = $case[$d];
568 $e = (1 - ($j - 1) / 6);
569 $pdf->SetDrawColor($a * 255 * $e, $b * 255 * $e, $c * 255 * $e); }
571 $pdf->SetDrawColor(0);
572 } // end if... else...
574 $pdf->PMA_PDF_setLineWidthScale(0.2);
575 $pdf->PMA_PDF_lineScale($this->x_src
, $this->y_src
, $this->x_src +
$this->src_dir
* $this->w_tick
, $this->y_src
);
576 $pdf->PMA_PDF_lineScale($this->x_dest +
$this->dest_dir
* $this->w_tick
, $this->y_dest
, $this->x_dest
, $this->y_dest
);
577 $pdf->PMA_PDF_setLineWidthScale(0.1);
578 $pdf->PMA_PDF_lineScale($this->x_src +
$this->src_dir
* $this->w_tick
, $this->y_src
, $this->x_dest +
$this->dest_dir
* $this->w_tick
, $this->y_dest
);
581 $root2 = 2 * sqrt(2);
582 $pdf->PMA_PDF_lineScale($this->x_src +
$this->src_dir
* $this->w_tick
* 0.75, $this->y_src
, $this->x_src +
$this->src_dir
* (0.75 - 1 / $root2) * $this->w_tick
, $this->y_src +
$this->w_tick
/ $root2);
583 $pdf->PMA_PDF_lineScale($this->x_src +
$this->src_dir
* $this->w_tick
* 0.75, $this->y_src
, $this->x_src +
$this->src_dir
* (0.75 - 1 / $root2) * $this->w_tick
, $this->y_src
- $this->w_tick
/ $root2);
585 $pdf->PMA_PDF_lineScale($this->x_dest +
$this->dest_dir
* $this->w_tick
/ 2, $this->y_dest
, $this->x_dest +
$this->dest_dir
* (0.5 +
1 / $root2) * $this->w_tick
, $this->y_dest +
$this->w_tick
/ $root2);
586 $pdf->PMA_PDF_lineScale($this->x_dest +
$this->dest_dir
* $this->w_tick
/ 2, $this->y_dest
, $this->x_dest +
$this->dest_dir
* (0.5 +
1 / $root2) * $this->w_tick
, $this->y_dest
- $this->w_tick
/ $root2);
587 $pdf->SetDrawColor(0);
588 } // end of the "PMA_RT_Relation_draw()" method
592 * The "PMA_RT_Relation" constructor
594 * @param string The master table name
595 * @param string The relation field in the master table
596 * @param string The foreign table name
597 * @param string The relation field in the foreign table
602 * @see PMA_RT_Relation::PMA_RT_Relation_getXy
604 function PMA_RT_Relation($master_table, $master_field, $foreign_table, $foreign_field)
606 $src_pos = $this->PMA_RT_Relation_getXy($master_table , $master_field);
607 $dest_pos = $this->PMA_RT_Relation_getXy($foreign_table, $foreign_field);
608 $src_left = $src_pos[0] - $this->w_tick
;
609 $src_right = $src_pos[1] +
$this->w_tick
;
610 $dest_left = $dest_pos[0] - $this->w_tick
;
611 $dest_right = $dest_pos[1] +
$this->w_tick
;
613 $d1 = abs($src_left - $dest_left);
614 $d2 = abs($src_right - $dest_left);
615 $d3 = abs($src_left - $dest_right);
616 $d4 = abs($src_right - $dest_right);
617 $d = min($d1, $d2, $d3, $d4);
620 $this->x_src
= $src_pos[0];
622 $this->x_dest
= $dest_pos[0];
623 $this->dest_dir
= -1;
624 } else if ($d == $d2) {
625 $this->x_src
= $src_pos[1];
627 $this->x_dest
= $dest_pos[0];
628 $this->dest_dir
= -1;
629 } else if ($d == $d3) {
630 $this->x_src
= $src_pos[0];
632 $this->x_dest
= $dest_pos[1];
635 $this->x_src
= $src_pos[1];
637 $this->x_dest
= $dest_pos[1];
640 $this->y_src
= $src_pos[2];
641 $this->y_dest
= $dest_pos[2];
642 } // end of the "PMA_RT_Relation()" method
643 } // end of the "PMA_RT_Relation" class
648 * Draws and send the database schema
657 * Defines private properties
659 var $tables = array();
660 var $relations = array();
675 * Sets X and Y minimum and maximum for a table cell
677 * @param string The table name
681 function PMA_RT_setMinMax($table)
683 $this->x_max
= max($this->x_max
, $table->x +
$table->width
);
684 $this->y_max
= max($this->y_max
, $table->y +
$table->height
);
685 $this->x_min
= min($this->x_min
, $table->x
);
686 $this->y_min
= min($this->y_min
, $table->y
);
687 } // end of the "PMA_RT_setMinMax()" method
691 * Defines relation objects
693 * @param string The master table name
694 * @param string The relation field in the master table
695 * @param string The foreign table name
696 * @param string The relation field in the foreign table
700 * @see PMA_RT_setMinMax()
702 function PMA_RT_addRelation($master_table , $master_field, $foreign_table, $foreign_field)
704 if (!isset($this->tables
[$master_table])) {
705 $this->tables
[$master_table] = new PMA_RT_Table($master_table, $this->ff
, $this->tablewidth
);
706 $this->PMA_RT_setMinMax($this->tables
[$master_table]);
708 if (!isset($this->tables
[$foreign_table])) {
709 $this->tables
[$foreign_table] = new PMA_RT_Table($foreign_table, $this->ff
, $this->tablewidth
);
710 $this->PMA_RT_setMinMax($this->tables
[$foreign_table]);
712 $this->relations
[] = new PMA_RT_Relation($this->tables
[$master_table], $master_field, $this->tables
[$foreign_table], $foreign_field);
713 } // end of the "PMA_RT_addRelation()" method
719 * @global object the current PMA_PDF instance
725 function PMA_RT_strokeGrid()
729 $pdf->SetMargins(0, 0);
730 $pdf->SetDrawColor(200, 200, 200);
732 // Draws horizontal lines
733 for ($l = 0; $l < 21; $l++
) {
734 $pdf->line(0, $l * 10, 297, $l * 10);
737 $pdf->SetXY(0, $l * 10);
738 $label = (string) sprintf('%.0f', ($l * 10 - $this->t_marg
) * $this->scale +
$this->y_min
);
739 $pdf->Cell(5, 5, ' ' . $label);
743 // Draws vertical lines
744 for ($j = 0; $j < 30 ;$j++
) {
745 $pdf->line($j * 10, 0, $j * 10, 210);
746 $pdf->SetXY($j * 10, 0);
747 $label = (string) sprintf('%.0f', ($j * 10 - $this->l_marg
) * $this->scale +
$this->x_min
);
748 $pdf->Cell(5, 7, $label);
750 } // end of the "PMA_RT_strokeGrid()" method
754 * Draws relation arrows
756 * @param boolean Whether to use one color per relation or not
760 * @see PMA_RT_Relation::PMA_RT_Relation_draw()
762 function PMA_RT_drawRelations($change_color)
765 reset($this->relations
);
766 while (list(, $relation) = each($this->relations
)) {
767 $relation->PMA_RT_Relation_draw($change_color, $i);
770 } // end of the "PMA_RT_drawRelations()" method
776 * @param boolean Whether to display table position or not
780 * @see PMA_RT_Table::PMA_RT_Table_draw()
782 function PMA_RT_drawTables($show_info)
784 reset($this->tables
);
785 while (list(, $table) = each($this->tables
)) {
786 $table->PMA_RT_Table_draw($show_info, $this->ff
, $this->same_wide
, $this->tablewidth
);
788 } // end of the "PMA_RT_drawTables()" method
792 * Ouputs the PDF document to a file
794 * @global object The current PDF document
795 * @global string The current database name
796 * @global integer The current page number (from the
797 * $cfg['Servers'][$i]['table_coords'] table)
803 function PMA_RT_showRt()
805 global $pdf, $db, $pdf_page_number;
807 $pdf->SetDisplayMode('fullpage');
808 $pdf->Output($db . '_' . $pdf_page_number . '.pdf', TRUE);
809 //$pdf->Output('', TRUE);
810 } // end of the "PMA_RT_showRt()" method
814 * The "PMA_RT" constructor
816 * @param mixed The scalling factor
817 * @param integer The page number to draw (from the
818 * $cfg['Servers'][$i]['table_coords'] table)
819 * @param boolean Whether to display table position or not
820 * @param boolean Whether to use one color per relation or not
821 * @param boolean Whether to draw grids or not
822 * @param boolean Whether all tables should have the same width or not
824 * @global object The current PDF document
825 * @global string The current db name
826 * @global array The relations settings
832 function PMA_RT($scale, $which_rel, $show_info = 0, $change_color = 0 , $show_grid = 0, $all_tab_same_wide = 0)
834 global $pdf, $db, $cfgRelation;;
836 // Font face depends on the current language
837 $this->ff
= str_replace('"', '', substr($GLOBALS['right_font_family'], 0, strpos($GLOBALS['right_font_family'], ',')));
838 $this->same_wide
= $all_tab_same_wide;
840 // Initializes a new document
841 $pdf = new PMA_PDF('L');
842 $pdf->title
= sprintf($GLOBALS['strPdfDbSchema'], $GLOBALS['db'], $which_rel);
845 $pdf->SetTitle($pdf->title
);
846 $pdf->SetAuthor('phpMyAdmin ' . PMA_VERSION
);
847 $pdf->AliasNbPages();
849 $pdf->SetFont($this->ff
, '', 14);
850 $pdf->SetAutoPageBreak('auto');
852 // Gets tables on this page
853 $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($cfgRelation['table_coords'])
854 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
855 . ' AND pdf_page_number = ' . $which_rel;
856 $tab_rs = PMA_query_as_cu($tab_sql);
857 if (!$tab_rs ||
!mysql_num_rows($tab_rs) > 0) {
858 $pdf->PMA_PDF_die($GLOBALS['strPdfNoTables']);
861 while ($curr_table = @PMA_mysql_fetch_array
($tab_rs)) {
862 $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
863 $intable = '\'' . implode('\', \'', $alltables) . '\'';
866 $sql = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation'])
867 . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
868 . ' AND foreign_db = \'' . PMA_sqlAddslashes($db) . '\' '
869 . ' AND master_table IN (' . $intable . ')'
870 . ' AND foreign_table IN (' . $intable . ')';
871 $result = PMA_query_as_cu($sql);
873 // loic1: also show tables without relations
875 if ($result && mysql_num_rows($result) > 0) {
876 $norelations = FALSE;
877 while ($row = PMA_mysql_fetch_array($result)) {
878 $this->PMA_RT_addRelation($row['master_table'] , $row['master_field'], $row['foreign_table'], $row['foreign_field']);
882 while (list(, $table) = each ($alltables)) {
883 if (!isset($this->tables
[$table])) {
884 $this->tables
[$table] = new PMA_RT_Table($table, $this->ff
, $this->tablewidth
);
885 $this->PMA_RT_setMinMax($this->tables
[$table]);
889 // Defines the scale factor
890 if ($scale == 'auto') {
891 $this->scale
= ceil(max(($this->x_max
- $this->x_min
) / (297 - $this->r_marg
- $this->l_marg
), ($this->y_max
- $this->y_min
) / (210 - $this->t_marg
- $this->b_marg
)) * 100) / 100;
892 $pdf->PMA_PDF_setScale($this->scale
, $this->x_min
, $this->y_min
, $this->l_marg
, $this->t_marg
);
894 $this->scale
= $scale;
895 $pdf->PMA_PDF_setScale($scale);
896 } // end if... else...
898 // Builds and save the PDF document
899 $pdf->PMA_PDF_setLineWidthScale(0.1);
902 $pdf->SetFontSize(10);
903 $this->PMA_RT_strokeGrid();
905 $pdf->PMA_PDF_setFontSizeScale(14);
906 if ($norelations == FALSE) {
907 $this->PMA_RT_drawRelations($change_color);
909 $this->PMA_RT_drawTables($show_info);
911 $this->PMA_RT_showRt();
912 } // end of the "PMA_RT()" method
913 } // end of the "PMA_RT" class
921 if (!isset($pdf_page_number)) {
922 $pdf_page_number = 1;
924 $show_grid = (isset($show_grid) && $show_grid == 'on') ?
1 : 0;
925 $show_color = (isset($show_color) && $show_color == 'on') ?
1 : 0;
926 $show_table_dimension = (isset($show_table_dimension) && $show_table_dimension == 'on') ?
1 : 0;
927 $all_tab_same_wide = (isset($all_tab_same_wide) && $all_tab_same_wide == 'on') ?
1 : 0;
929 PMA_mysql_select_db($db);
931 $rt = new PMA_RT('auto', $pdf_page_number, $show_table_dimension, $show_color, $show_grid, $all_tab_same_wide);