2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 * This class is inherited by all schema classes
10 * It contains those methods which are common in them
11 * it works like factory pattern
13 class PMA_Export_Relation_Schema
18 public $tableDimension;
29 * @param integer $value Page Number of the document to be created
35 public function setPageNumber($value)
37 $this->pageNumber
= isset($value) ?
$value : 1;
43 * @param boolean $value show grid of the document or not
49 public function setShowGrid($value)
51 $this->showGrid
= (isset($value) && $value == 'on') ?
1 : 0;
57 * @param string $value 'on' to set the the variable
61 public function setShowColor($value)
63 $this->showColor
= (isset($value) && $value == 'on') ?
1 : 0;
69 * @param boolean $value show table co-ordinates or not
75 public function setTableDimension($value)
77 $this->tableDimension
= (isset($value) && $value == 'on') ?
1 : 0;
81 * Set same width of All Tables
83 * @param boolean $value set same width of all tables or not
89 public function setAllTableSameWidth($value)
91 $this->sameWide
= (isset($value) && $value == 'on') ?
1 : 0;
97 * @param boolean $value show selected database data dictionary or not
103 public function setWithDataDictionary($value)
105 $this->withDoc
= (isset($value) && $value == 'on') ?
1 : 0;
111 * @param boolean $value show only keys or not
117 public function setShowKeys($value)
119 $this->showKeys
= (isset($value) && $value == 'on') ?
1 : 0;
125 * @param string $value Orientation will be portrait or landscape
131 public function setOrientation($value)
133 $this->orientation
= (isset($value) && $value == 'P') ?
'P' : 'L';
139 * @param string $value paper type can be A4 etc
145 public function setPaper($value)
147 $this->paper
= isset($value) ?
$value : 'A4';
151 * Set title of the page
153 * @param string $title title of the page displayed at top of the document
159 public function setPageTitle($title)
161 $this->_pageTitle
=$title;
165 * Set type of export relational schema
167 * @param string $value can be pdf,svg,dia,visio,eps etc
173 public function setExportType($value)
175 $this->exportType
=$value;
179 * get all tables involved or included in page
181 * @param string $db name of the database
182 * @param integer $pageNumber page no. whose tables will be fetched in an array
184 * @return Array an array of tables
188 public function getAllTables($db, $pageNumber)
192 $tab_sql = 'SELECT table_name FROM '
193 . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.'
194 . PMA_backquote($cfgRelation['table_coords'])
195 . ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
196 . ' AND pdf_page_number = ' . $pageNumber;
198 $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE
);
199 if (!$tab_rs ||
!PMA_DBI_num_rows($tab_rs) > 0) {
200 $this->dieSchema('', __('This page does not contain any tables!'));
202 while ($curr_table = @PMA_DBI_fetch_assoc
($tab_rs)) {
203 $alltables[] = PMA_sqlAddSlashes($curr_table['table_name']);
209 * Displays an error message
211 * @param integer $pageNumber ID of the chosen page
212 * @param string $type Schema Type
213 * @param string $error_message The error mesage
215 * @global array the PMA configuration array
216 * @global string the current database name
222 function dieSchema($pageNumber, $type = '', $error_message = '')
227 include_once './libraries/header.inc.php';
228 echo "<p><strong>" . __("SCHEMA ERROR: ") . $type . "</strong></p>" . "\n";
229 if (!empty($error_message)) {
230 $error_message = htmlspecialchars($error_message);
233 echo ' ' . $error_message . "\n";
235 echo '<a href="schema_edit.php?' . PMA_generate_common_url($db)
236 . '&do=selectpage&chpage=' . $pageNumber . '&action_choose=0'
237 . '">' . __('Back') . '</a>';
239 include_once './libraries/footer.inc.php';