2 /* vim: set expandtab sw=4 ts=4 sts=4: */
10 * This class is inherited by all schema classes
11 * It contains those methods which are common in them
12 * it works like factory pattern
14 * @name Export Relation Schema
19 class PMA_Export_Relation_Schema
24 public $tableDimension;
35 * @param integer value Page Number of the document to be created
39 public function setPageNumber($value)
41 $this->pageNumber
= isset($value) ?
$value : 1;
47 * @param boolean value show grid of the document or not
51 public function setShowGrid($value)
53 $this->showGrid
= (isset($value) && $value == 'on') ?
1 : 0;
56 public function setShowColor($value)
58 $this->showColor
= (isset($value) && $value == 'on') ?
1 : 0;
64 * @param boolean value show table co-ordinates or not
68 public function setTableDimension($value)
70 $this->tableDimension
= (isset($value) && $value == 'on') ?
1 : 0;
74 * Set same width of All Tables
76 * @param boolean value set same width of all tables or not
80 public function setAllTableSameWidth($value)
82 $this->sameWide
= (isset($value) && $value == 'on') ?
1 : 0;
88 * @param boolean value show selected database data dictionary or not
92 public function setWithDataDictionary($value)
94 $this->withDoc
= (isset($value) && $value == 'on') ?
1 : 0;
100 * @param boolean value show only keys or not
104 public function setShowKeys($value)
106 $this->showKeys
= (isset($value) && $value == 'on') ?
1 : 0;
112 * @param string value Orientation will be portrait or landscape
116 public function setOrientation($value)
118 $this->orientation
= (isset($value) && $value == 'P') ?
'P' : 'L';
124 * @param string value paper type can be A4 etc
128 public function setPaper($value)
130 $this->paper
= isset($value) ?
$value : 'A4';
134 * Set title of the page
136 * @param string value title of the page displayed at top of the document
140 public function setPageTitle($title)
142 $this->_pageTitle
=$title;
146 * Set type of export relational schema
148 * @param string value can be pdf,svg,dia,visio,eps etc
152 public function setExportType($value)
154 $this->exportType
=$value;
158 * get all tables involved or included in page
160 * @param string db name of the database
161 * @param integer pageNumber page number whose tables will be fetched in an array
162 * @return Array an array of tables
165 public function getAllTables($db,$pageNumber)
169 $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
170 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
171 . ' AND pdf_page_number = ' . $pageNumber;
173 $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE
);
174 if (!$tab_rs ||
!PMA_DBI_num_rows($tab_rs) > 0) {
175 $this->_die('',__('No tables'));
177 while ($curr_table = @PMA_DBI_fetch_assoc
($tab_rs)) {
178 $alltables[] = PMA_sqlAddslashes($curr_table['table_name']);
184 * Displays an error message
186 * @param integer pageNumber ID of the page choosen
187 * @param string type Schema Type
188 * @param string error_message the error mesage
189 * @global array the PMA configuration array
190 * @global integer the current server id
191 * @global string the current language
192 * @global string the charset to convert to
193 * @global string the current database name
194 * @global string the current charset
195 * @global string the current text direction
196 * @global string a localized string
197 * @global string an other localized string
201 function dieSchema($pageNumber, $type = '', $error_message = '')
204 global $server, $lang, $convcharset, $db;
205 global $charset, $text_dir;
207 require_once './libraries/header.inc.php';
208 echo "<p><strong>" . __("SCHEMA ERROR: ") . $type ."</strong></p>" . "\n";
209 if (!empty($error_message)) {
210 $error_message = htmlspecialchars($error_message);
213 echo ' ' . $error_message . "\n";
215 echo '<a href="schema_edit.php?' . PMA_generate_common_url($db).'&do=selectpage&chpage='.$pageNumber.'&action_choose=0'
216 . '">' . __('Back') . '</a>';
218 require_once './libraries/footer.inc.php';