2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Contains Table_Stats_Eps class
8 if (! defined('PHPMYADMIN')) {
12 require_once 'libraries/plugins/schema/TableStats.class.php';
15 * Table preferences/statistics
17 * This class preserves the table co-ordinates,fields
18 * and helps in drawing/generating the Tables in EPS.
21 * @name Table_Stats_Eps
24 class Table_Stats_Eps
extends TableStats
30 public $currentCell = 0;
33 * The "Table_Stats_Eps" constructor
35 * @param string $tableName The table name
36 * @param string $font The font name
37 * @param integer $fontSize The font size
38 * @param integer $pageNumber Page number
39 * @param integer &$same_wide_width The max width among tables
40 * @param boolean $showKeys Whether to display keys or not
41 * @param boolean $tableDimension Whether to display table position or not
42 * @param boolean $offline Whether the coordinates are sent
45 * @global object $eps The current eps document
48 * @see PMA_EPS, Table_Stats_Eps::Table_Stats_setWidth,
49 * Table_Stats_Eps::Table_Stats_setHeight
52 $tableName, $font, $fontSize, $pageNumber, &$same_wide_width,
53 $showKeys = false, $tableDimension = false, $offline = false
57 $eps, $GLOBALS['db'], $pageNumber, $tableName,
58 $showKeys, $tableDimension, $offline
62 $this->_setHeightTable($fontSize);
63 // setWidth must me after setHeight, because title
64 // can include table height which changes table width
65 $this->_setWidthTable($font, $fontSize);
66 if ($same_wide_width < $this->width
) {
67 $same_wide_width = $this->width
;
72 * Displays an error when the table cannot be found.
76 protected function showMissingTableError()
78 PMA_Export_Relation_Schema
::dieSchema(
81 sprintf(__('The %s table doesn\'t exist!'), $this->tableName
)
86 * Sets the width of the table
88 * @param string $font The font name
89 * @param integer $fontSize The font size
96 private function _setWidthTable($font,$fontSize)
98 foreach ($this->fields
as $field) {
101 PMA_Font
::getStringWidth($field, $font, $fontSize)
104 $this->width +
= PMA_Font
::getStringWidth(' ', $font, $fontSize);
106 * it is unknown what value must be added, because
107 * table title is affected by the table width value
110 < PMA_Font
::getStringWidth($this->getTitle(), $font, $fontSize)) {
116 * Sets the height of the table
118 * @param integer $fontSize The font size
123 private function _setHeightTable($fontSize)
125 $this->heightCell
= $fontSize +
4;
126 $this->height
= (count($this->fields
) +
1) * $this->heightCell
;
132 * @param boolean $showColor Whether to display color
134 * @global object $eps The current eps document
139 * @see PMA_EPS,PMA_EPS::line,PMA_EPS::rect
141 public function tableDraw($showColor)
144 //echo $this->tableName.'<br />';
145 $eps->rect($this->x
, $this->y +
12, $this->width
, $this->heightCell
, 1);
146 $eps->showXY($this->getTitle(), $this->x +
5, $this->y +
14);
147 foreach ($this->fields
as $field) {
148 $this->currentCell +
= $this->heightCell
;
150 $this->x
, $this->y +
12 +
$this->currentCell
,
151 $this->width
, $this->heightCell
, 1
153 $eps->showXY($field, $this->x +
5, $this->y +
14 +
$this->currentCell
);