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
14 class PMA_Export_Relation_Schema
19 public $tableDimension;
30 * @param integer value Page Number of the document to be created
34 public function setPageNumber($value)
36 $this->pageNumber
= isset($value) ?
$value : 1;
42 * @param boolean value show grid of the document or not
46 public function setShowGrid($value)
48 $this->showGrid
= (isset($value) && $value == 'on') ?
1 : 0;
51 public function setShowColor($value)
53 $this->showColor
= (isset($value) && $value == 'on') ?
1 : 0;
59 * @param boolean value show table co-ordinates or not
63 public function setTableDimension($value)
65 $this->tableDimension
= (isset($value) && $value == 'on') ?
1 : 0;
69 * Set same width of All Tables
71 * @param boolean value set same width of all tables or not
75 public function setAllTableSameWidth($value)
77 $this->sameWide
= (isset($value) && $value == 'on') ?
1 : 0;
83 * @param boolean value show selected database data dictionary or not
87 public function setWithDataDictionary($value)
89 $this->withDoc
= (isset($value) && $value == 'on') ?
1 : 0;
95 * @param boolean value show only keys or not
99 public function setShowKeys($value)
101 $this->showKeys
= (isset($value) && $value == 'on') ?
1 : 0;
107 * @param string value Orientation will be portrait or landscape
111 public function setOrientation($value)
113 $this->orientation
= (isset($value) && $value == 'P') ?
'P' : 'L';
119 * @param string value paper type can be A4 etc
123 public function setPaper($value)
125 $this->paper
= isset($value) ?
$value : 'A4';
129 * Set title of the page
131 * @param string value title of the page displayed at top of the document
135 public function setPageTitle($title)
137 $this->_pageTitle
=$title;
141 * Set type of export relational schema
143 * @param string value can be pdf,svg,dia,visio,eps etc
147 public function setExportType($value)
149 $this->exportType
=$value;
153 * get all tables involved or included in page
155 * @param string db name of the database
156 * @param integer pageNumber page number whose tables will be fetched in an array
157 * @return Array an array of tables
160 public function getAllTables($db,$pageNumber)
164 $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
165 . ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''
166 . ' AND pdf_page_number = ' . $pageNumber;
168 $tab_rs = PMA_query_as_controluser($tab_sql, null, PMA_DBI_QUERY_STORE
);
169 if (!$tab_rs ||
!PMA_DBI_num_rows($tab_rs) > 0) {
170 $this->dieSchema('',__('This page does not contain any tables!'));
172 while ($curr_table = @PMA_DBI_fetch_assoc
($tab_rs)) {
173 $alltables[] = PMA_sqlAddSlashes($curr_table['table_name']);
179 * Displays an error message
181 * @param integer pageNumber ID of the chosen page
182 * @param string type Schema Type
183 * @param string error_message the error mesage
184 * @global array the PMA configuration array
185 * @global string the current database name
189 function dieSchema($pageNumber, $type = '', $error_message = '')
194 require_once './libraries/header.inc.php';
195 echo "<p><strong>" . __("SCHEMA ERROR: ") . $type ."</strong></p>" . "\n";
196 if (!empty($error_message)) {
197 $error_message = htmlspecialchars($error_message);
200 echo ' ' . $error_message . "\n";
202 echo '<a href="schema_edit.php?' . PMA_generate_common_url($db).'&do=selectpage&chpage='.$pageNumber.'&action_choose=0'
203 . '">' . __('Back') . '</a>';
205 require_once './libraries/footer.inc.php';